Skip to content
Advertisement

Jython error when trying to import a Python library

I have a simple python script that I want to call, the script has a demo pandas DataFrame which I want to return to my Java code.

import re
import sys
sys.path.append('D:/JythonProject/venv/Lib/site-packages')
from dateutil.parser import parse
import pandas as pd  # You may need to pip install these libraries

The error that it is throwing

 import pandas as pd  # You may need to pip install these libraries
SyntaxError: ('no viable alternative at input '"{dependency}: {e}"'', ('D:\Projects\snowflakeConnector\venv\Lib\site-packages\pandas\__init__.py', 13, 37, '        missing_dependencies.append(f"{dependency}: {e}")n'))

I know the error is being thrown when trying to import pandas but I don’t know why.

Advertisement

Answer

Jython does not work properly with pandas also for other libraries you have to point out to the venv in the script.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement