Grokbase Groups Pig user April 2012
Hey guys, thanks for the quick answers...

I've installed Jython 2.5 and that's what did the trick.

Thanks again! :)
On Thu, Apr 19, 2012 at 5:45 PM, kumar palaniappan wrote:

Sorry..I think I answered the wrong thread.

From: kumar palaniappan <>
Sent: Thu, April 19, 2012 1:36:03 PM
Subject: Re: Python UDF for piglatin script not finding re module

I am using CDUH3 distribution and Pig is 0.8.
I installed jython 2.2.1. Let me install jython 2.5.0 and see


From: Gianmarco De Francisci Morales <>
Sent: Thu, April 19, 2012 1:32:36 PM
Subject: Re: Python UDF for piglatin script not finding re module


welcome to the community!

First question is, how did you install pig?
Source or some other distribution?

Second, Pig wants jython.version=2.5.0
Which version have you installed?


On Thu, Apr 19, 2012 at 21:29, Fernando Doglio <
Hello everyone, new pig user here.

I've being toying around with pig for a while now, and I wanted to create
my first UDF in Python. It all went fine until I wanted to use RegExps.

I tried importing the "re" module on my python script, but when I did that,
I got an error message:

[main] ERROR - ERROR 1121: Python
Error. Traceback (most recent call last):

File "", line 3, in <module>

import re
ImportError: No module named re

Looking around the net, I ended up installing "jython" on my system, that
didn't do the trick, but doing a bit more research, I found out that the
sys.path variable was different when I ran the script using the "jython"
command and when I used the "pig" command:

*Using Jython*

['', '/usr/share/jython/Lib', '/usr/lib/site-python', '__classpath__']

*Using pig*

['/pig/lib/Lib', '__classpath__', '__pyclasspath__/']1

So I went back to my script, and manually changed the "sys.path" variable
to look like the first example up there.. now when I run the script with
pig, I get the following message:

File "", line 8, in <module>

import re
File "/usr/share/jython/Lib/", line 7, in <module>

import sre, sys
File "/usr/share/jython/Lib/", line 97, in <module>

import sre_compile
File "/usr/share/jython/Lib/", line 17, in <module>

assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch

According to someone on stackoverflow, this is due to the fact that my
manually installed "jython" version is different from the one used by

Now, finally, my question is: how do I get my python script to run on pig

Thanks so much for reading and if you can, for answering!

Fernando Doglio

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupuser @
categoriespig, hadoop
postedApr 19, '12 at 7:30p
activeApr 19, '12 at 8:59p



site design / logo © 2022 Grokbase