Support Questions

Find answers, ask questions, and share your expertise

Is there a way to have pig default to python 3.4

avatar
Super Collaborator

we got python 3.4 installed and is there a way to have pig use 3.4 as default python instead of 2.6?

1 ACCEPTED SOLUTION

avatar
Rising Star

You need to update the pig.properties value to be like the below to force it to use a different python alias when using the new Pig 13+ Python Streaming functions:

pig.streaming.udf.python.command=python3

View solution in original post

3 REPLIES 3

avatar
Guru

Are you talking about running a Pig UDF written in Python? You need to make sure you are using streaming_python instead of jython. What does your REGISTER command look like?

avatar
Rising Star

You need to update the pig.properties value to be like the below to force it to use a different python alias when using the new Pig 13+ Python Streaming functions:

pig.streaming.udf.python.command=python3

avatar
New Contributor

Adding that setting is not really working for me, I'm doing something like this

register 's3://fernandos-tests/python-udfs/python-version.py' using streaming_python as pyudfs;
...
results = FOREACH limited GENERATE pyudfs.version();

DUMP results;

My python code looking like...

from pig_util import outputSchema

import sys

@outputSchema('word:chararray')
def version():
    return sys.version

And still getting python version 2.7

Any hints?