failure to find sconepy modules in python

SCONE is a software tool for predictive simulations of biomechanical movement. It uses OpenSim for modeling and simulation, and performs optimization using various control strategies, including feed-forward control, proprioceptic feedback control, and bal
POST REPLY
User avatar
Akito Fukunishi
Posts: 3
Joined: Tue Nov 03, 2020 10:29 pm

failure to find sconepy modules in python

Post by Akito Fukunishi » Sat May 18, 2024 4:08 pm

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.

User avatar
Thomas Geijtenbeek
Posts: 419
Joined: Wed Mar 12, 2014 8:08 am

Re: failure to find sconepy modules in python

Post by Thomas Geijtenbeek » Tue May 21, 2024 12:14 am

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.

User avatar
Akito Fukunishi
Posts: 3
Joined: Tue Nov 03, 2020 10:29 pm

Re: failure to find sconepy modules in python

Post by Akito Fukunishi » Tue May 21, 2024 9:05 am

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!

User avatar
Nilay Khare
Posts: 3
Joined: Sat Jun 01, 2024 2:07 am

Re: failure to find sconepy modules in python

Post by Nilay Khare » Fri Jun 07, 2024 5:15 am

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'
_______________________________________________-

User avatar
Thomas Geijtenbeek
Posts: 419
Joined: Wed Mar 12, 2014 8:08 am

Re: failure to find sconepy modules in python

Post by Thomas Geijtenbeek » Fri Jun 07, 2024 6:24 am

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.

User avatar
Nilay Khare
Posts: 3
Joined: Sat Jun 01, 2024 2:07 am

Re: failure to find sconepy modules in python

Post by Nilay Khare » Fri Jun 07, 2024 6:54 am

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'

User avatar
Thomas Geijtenbeek
Posts: 419
Joined: Wed Mar 12, 2014 8:08 am

Re: failure to find sconepy modules in python

Post by Thomas Geijtenbeek » Fri Jun 07, 2024 6:59 am

Are you using the correct Python version (3.9)?

User avatar
Nilay Khare
Posts: 3
Joined: Sat Jun 01, 2024 2:07 am

Re: failure to find sconepy modules in python

Post by Nilay Khare » Fri Jun 07, 2024 8:27 am

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!

POST REPLY