Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

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

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?