stanfordnmbl / osim-rl

Reinforcement learning environments with musculoskeletal models
http://osim-rl.stanford.edu/
MIT License
896 stars 249 forks source link

No module named opensim #217

Open W4Guru opened 4 years ago

W4Guru commented 4 years ago

Hello everyone,

How can run the Python scripts in OpenSim when they use the command "import opensim as osim"? ScriptingShell Window reply "ImportError: No module named opensim".

I'm running OpenSim 4.1. and already installed python 3.7.6. I can use the commands and scripts in Python (and Anaconda), after running the setup.py but it do not fix the issue in OpenSim. I think it's not that hard, but I can't figure it out alone :-/

Best regards

kidzik commented 4 years ago

For now, we've only tested osim-rl with OpenSim 4.0 conda binaries posted here https://anaconda.org/kidzik/opensim Reproducing steps from here might be the easiest way to go.

W4Guru commented 4 years ago

Finally! Many thanks for your reply! It was a basic misunderstanding of how the workflow really works. The main problem was not the installation of the opensim package but the slight differences running python scripts in OpenSim. The command “import opensim as osim” doesn’t work instead use org.opensim as osim although it is not necessary because the packages are already included.

However, one problem remains. Is there a possibility to use the command printToXML? I get the error “org.opensim.modeling.Model object has not attribute PrintToXML”. In a python environment this command is no problem.

Best regards

kidzik commented 4 years ago

Sounds great! Exporting to xml is not a part of osim-rl package but indeed it might be available in OpenSim. I don't know if it's exposed in the python interface though -- to get the most up-to-date advice please follow up on OpenSim forum

AffDk commented 3 years ago

Hi,

I had an already installed Anaconda (navigator version 1.9.12) on my computer and followed the instruction to installed osim-rl from the following website:

http://osim-rl.stanford.edu/docs/quickstart/

The installation went through smoothly, at least I did not see any warning or error message. After that when I open Anaconda navigator, I can see osim-rl is added to the available environments. when I choose osim-rl environment, it gives me two possibilities ("open terminal" and "open with python"),

if I choose "open terminal"

I run "activate opensim-rl" as instructed by the website that this must be done every time I also run "python -c "import opensim" " and apparently this one is fine too. At least, it does not generate any error or warning message.

but when I choose "open with python" and run "from osim.env import L2RunEnv" I face an error message as mentioned in this thread.

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'osim'

I followed the conversation in this thread and tried

import org.opensim as osim

I received a similar error "No module named 'org'"

Any suggestion here?

Best regards, Afshin

zsundayjj commented 1 year ago

I also met the same problem. Have you solved it? Could you tell me how it was resolved.

AffDk commented 1 year ago

Hi, No. This was my sideline activity for a long time ago. I stopped working on it.