Ask Your Question
1

How can I use external libraries from a Python processor?

asked 2017-09-12 10:46:33 -0600

jeff gravatar image

updated 2017-09-12 15:42:01 -0600

metadaddy gravatar image

I have a Python script that uses the pandas module. When I try to import it into my script, I get this error: No module named pandas. How can I configure the Jython script processor to use external libraries?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-09-12 15:41:43 -0600

metadaddy gravatar image

updated 2017-09-20 13:08:56 -0600

LC gravatar image

You can use external Python modules with SDC's Jython script evaluator as long as they don't include any Python extensions written in C. Append the Python package location to sys.path; for example, to import requests:

import sys
# Set to wherever the requests package lives on your machine
sys.path.append('/Library/Python/2.7/site-packages')
import requests

The problem with pandas and other Python packages such as NumPy is that, even if you import the Python modules, you will not be able to use them, since they include C extensions, which cannot be loaded by Jython. There are initiatives such as JyNI that aim to bridge the gap between Jython and C extensions; SDC-7313 tracks inclusion of JyNI with the SDC Jython Evaluator.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-09-12 10:46:33 -0600

Seen: 255 times

Last updated: Sep 20 '17