1

I'm running Python through Java's Scripting Engine. The basic hello world is working well, but it fails when I import pandas in the python script.

    StringWriter stringWriter = new StringWriter();
    ScriptContext scriptContext = new SimpleScriptContext();
    scriptContext.setWriter(stringWriter);
    ScriptEngineManager manager = new ScriptEngineManager();

    ScriptEngine engine = manager.getEngineByName("python");

ImportError: No module named pandas

Is there a way to install it for Scripting Engine?

I have pandas on my machine installed through command line but that's not the python being used here.

7
  • perhaps you need to run on cmd line: pip install pandas Commented Aug 30, 2020 at 13:47
  • Its already installed through cmd line and is working outside. Commented Aug 30, 2020 at 13:53
  • uh okay, perhaps stackoverflow.com/questions/27235286/… might help Commented Aug 30, 2020 at 14:13
  • I've followed the same approach. Pandas doesn't work for it. Commented Aug 30, 2020 at 14:20
  • maybe, we can find the path of python.exe that java is using, by letting the engine print: import sys print(sys.executable) Commented Aug 30, 2020 at 14:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.