I have a Python script, and when I run it in Spyder or others editors/IDEs, it runs perfectly but when I double click it, or try to run by Pentaho Shell step, it don't run because I'm using the pandas module.
ERROR:
2017/09/25 16:00:18 - etl_script.py - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : (stderr) Traceback (most recent call last):
2017/09/25 16:00:18 - etl_script.py - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : (stderr) File "C:\Users\giorge.luiz\etl_script.py", line 8, in <module>
2017/09/25 16:00:18 - etl_script.py - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : (stderr) import pandas as pd
2017/09/25 16:00:18 - etl_script.py - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : (stderr) ImportError: No module named pandas
How can I solve this?
Probably the IDE you are using ships with a different version or python executable than what you have saved in your PATH environment variable.
To exactly find out if it is so, try creating a script as such:
import sys
print(sys.executable)
Try to execute inside the IDE and with double-click and/or Pentaho Shell step and notice if the path are the same or different.
A quick and 'dirty' way to use the script outside the IDE with the same modules you are used to is to add (under *nix systems):
#!<path-to-executable>
at the beginning of your script (must be the first line) and make the script executable ( chmod u+x scriptname.py).
Notes:
<path-to-executable>
is the path you get printed with print(sys.executable)