When running a Python within a Pig script, the following error was seen:
- The wrong version of Python may be reported, for example, Python version 2.7.10 installed but when "sys.version" is run in Python, a different version is displayed, such as "
- Some modules may not import correctly:
ImportError: No module named json
Jython is being used with version 2.5.3 and does not contain the same number of modules as standard Python distributions.
- Review the Pig script and confirm that Jython is being used, for example, this line runs the Python script utils.py via Jython:
REGISTER './utils.py' using jython as utils;
- Review Jython documentation to add the required module into Jython. Note that upgrading to Jython 2.7 will likely help as extra modules are included such as the JSON module from the example above.