cancel
Showing results for 
Search instead for 
Did you mean: 

Java Scoring Code Call from Python

Java Scoring Code Call from Python

Dear DataRobot,

 

I am trying to make a prediction with scoring code with this:

# Install the package from PyPI:
# pip install datarobot-predict

from datarobot_predict.scoring_code import ScoringCodeModel

model = ScoringCodeModel("6630ac05b6becefec9870200-66309f8060fa5a048d67c235-agent-10.0.6.jar")

result = model.predict(datasetFromPath)

Screenshot 2024-04-30 at 5.37.34 PM.png

And this is the Py4JError error code received:

1st part of the Py4JError1st part of the Py4JError

 

last part of Py4JErrorlast part of Py4JError

 

Pls advise, tks.

Labels (3)
0 Kudos
1 Reply
jbaekdahl
DataRobot Employee
DataRobot Employee

Hello,

 

This error is because of a bug in the py4j package that triggers in some cases on Windows.

Could you please try the following steps to work around the issue:

1. Download the py4j source package from https://pypi.org/project/py4j/#files

2. Extract the file named /py4j-0.10.9.7/py4j-java/py4j0.10.9.7.jar

3. Move it to the path C:\share\py4j\py4j0.10.9.7.jar

If you have installed a different py4j version than 0.10.9.7, use that version instead.

 

This should allow py4j to find the jar file that it needs.

 

Best Regards,

Jesper

Software Engineer, Scoring Code