Page 1 of 1

failure to find sconepy modules in python

Posted: Sat May 18, 2024 4:08 pm
by simakito2
Hello,

I try to use SconePy libraries to utilize the Scone engine with Python.
However, I could not compile any of the Python codes of the Scone project (e.g., sconegym, depRL, and even sconepy_example.py) just because the prompt could not find the sconepy modules (the error message is "ModuleNotFoundError: No module named 'sconepy'").

According to the documentation (https://scone.software/doku.php?id=sconepy), the only procedure required should be just installing SCONE.
I assumed that some required protocols to activate Scone's Python API (e.g., making a path) could be automatically completed after installation, but it seems they are not.

Could you tell me how I can activate API modules?
I'm using Windows OS.

Thank you in advance for your help.

Re: failure to find sconepy modules in python

Posted: Tue May 21, 2024 12:14 am
by tgeijten
The path of the SconePy module should automatically be detected in sconetools.py, but this only works if:
  • SCONE is installed in the default folder (C:\Program Files\SCONE)
  • You are using Python version 3.9
If you are using a different install folder, you can update the module search manually. See sconetools.py for more details on how to add a custom module search path.

Re: failure to find sconepy modules in python

Posted: Tue May 21, 2024 9:05 am
by simakito2
Thank you for fast reply.
The reason why I could not import the module is certainly the location of SCONE folder.
Following your suggestion, adding the path to the SCONE\bin manually by modifying the code of sconetools.py works!

Re: failure to find sconepy modules in python

Posted: Fri Jun 07, 2024 5:15 am
by nilaykhare
I am facing the same issue, however, the path seems correct for Sconepy module.

I have installed scone at default location. C:\Program Files\SCONE. and path to sconepy.cp39-win_amd64.pyd is C:\Program Files\SCONE\bin.

However, the path for sconepy_example.py is different from that of the document. It is at C:\Program Files\SCONE\scone\scenarios\SconePy. when I am running it. receiving following output-
_________________________________
sconepy found at C:/Program Files/SCONE/bin
Traceback (most recent call last):
File "C:\Program Files\SCONE\scone\scenarios\SconePy\sconepy_example.py", line 3, in <module>
from sconetools import sconepy
File "C:\Program Files\SCONE\scone\scenarios\SconePy\sconetools.py", line 49, in <module>
import sconepy
ModuleNotFoundError: No module named 'sconepy'
_______________________________________________-

Re: failure to find sconepy modules in python

Posted: Fri Jun 07, 2024 6:24 am
by tgeijten
The sconepy_example.py should be installed in your Windows Documents folder, in the SCONE subfolder. Is this not the case?

You should not run the sconepy_example.py directly from the Program Files folder.

Re: failure to find sconepy modules in python

Posted: Fri Jun 07, 2024 6:54 am
by nilaykhare
Thanks for the quick response. Yes, later I realized it. I tried to run it with the scone folder in documents, but it still shows the same error.

sconepy found at C:/Program Files/SCONE/bin
Traceback (most recent call last):
File "C:\Users\nilay\Documents\SCONE\SconePy\sconepy_example.py", line 3, in <module>
from sconetools import sconepy
File "C:\Users\nilay\Documents\SCONE\SconePy\sconetools.py", line 49, in <module>
import sconepy
ModuleNotFoundError: No module named 'sconepy'

Re: failure to find sconepy modules in python

Posted: Fri Jun 07, 2024 6:59 am
by tgeijten
Are you using the correct Python version (3.9)?

Re: failure to find sconepy modules in python

Posted: Fri Jun 07, 2024 8:27 am
by nilaykhare
I checked the Python interpreter version as per your suggestion and found it was incorrect. Switching to version 3.9 resolved the issue. Thank you!