stanfordnmbl / osim-rl

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

ModuleNotFoundError: No module named 'opensim' #186

Open krishnbera opened 5 years ago

krishnbera commented 5 years ago

Even after succesfully creating the conda environment and installing all the required dependencies, I get this error when I run python -c "import opensim"

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

I am using default Python 3.7

Output for conda list:

packages in environment at /home/krishn/.conda/envs/opensim-rl:

Name Version Build Channel _libgcc_mutex 0.1 main
ca-certificates 2019.6.16 hecc5488_0 conda-forge certifi 2019.6.16 py37_0 conda-forge cloudpickle 1.2.1 pypi_0 pypi curl 7.64.1 hbc83047_0
cycler 0.10.0 pypi_0 pypi expat 2.2.6 he6710b0_0
freeglut 3.0.0 4 kidzik future 0.17.1 pypi_0 pypi gettext 0.19.8.1 hc5be6a0_1002 conda-forge git 2.22.0 pl526hce37bd2_0 conda-forge gym 0.13.1 pypi_0 pypi kiwisolver 1.1.0 pypi_0 pypi krb5 1.16.1 h173b8e3_7
lapack 3.6.1 ha44fe06_2 conda-forge libcurl 7.64.1 h20c2e04_0
libedit 3.1.20181209 hc058e9b_0
libffi 3.2.1 hd88cf55_4
libgcc-ng 9.1.0 hdf63c60_0
libgfortran 3.0.0 1
libiconv 1.15 h516909a_1005 conda-forge libssh2 1.8.2 h1ba5d50_0
libstdcxx-ng 9.1.0 hdf63c60_0
matplotlib 3.1.1 pypi_0 pypi ncurses 6.1 he6710b0_1
numpy 1.16.4 pypi_0 pypi openblas 0.2.19 0 kidzik opensim 4.0.0 15 kidzik openssl 1.1.1c h516909a_0 conda-forge osim-rl 3.0.2 pypi_0 pypi perl 5.26.2 h14c3975_0
pip 19.1.1 py37_0
pyglet 1.3.2 pypi_0 pypi pyparsing 2.4.0 pypi_0 pypi python 3.7.3 h0371630_0
python-dateutil 2.8.0 pypi_0 pypi readline 7.0 h7b6447c_5
redis 3.2.1 pypi_0 pypi scipy 1.3.0 pypi_0 pypi setuptools 41.0.1 py37_0
six 1.12.0 pypi_0 pypi sqlite 3.28.0 h7b6447c_0
timeout-decorator 0.4.1 pypi_0 pypi tk 8.6.9 hed695b0_1002 conda-forge wheel 0.33.4 py37_0
xz 5.2.4 h14c3975_4
zlib 1.2.11 h7b6447c_3

kidzik commented 5 years ago

I've reproduced your environment and for me it also doesn't work with python 3.7. We will work on that. In the meantime, can you try it with python 3.6?

krishnbera commented 5 years ago

Hi, I re-installed the environment for python 3.6, on running python -c "from osim.env import RunEnv", I get the following error:

Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'RunEnv'

kidzik commented 5 years ago

This time it is an error in documentation. Please follow the guidelines from the main README https://github.com/stanfordnmbl/osim-rl#basic-usage The name of the environment in the new challenge is L2M2019Env.

RunEnv is not available anymore. Can you tell me where did you find the reference to it?

krishnbera commented 5 years ago

Yes, it was from the Quickstart section of Documentation. Also, I am unable to load "Arm2DEnv". Can you confirm if this too has been renamed?

kidzik commented 5 years ago

Thanks for pointing that! They are temporarily moved here https://github.com/stanfordnmbl/osim-rl/tree/master/examples/under-construction as we were cleaning up the code and the documentation. We will be fixing that soon, but of course, you can also use them as-is just by running that code in your scripts. I hope that helps for now...

krishnbera commented 5 years ago

Hi, I am now facing trouble in importing the "Arm2DEnv" from under-construction folder. Can you please specify how to import the environment? I mean something like from ABC.DEF import XYZ.

gautam1858 commented 5 years ago

The code base has to be refactored and its under-construction, quick patch would be for you is to just paste the arm2d.py file inside osim.env and run the code

krishnbera commented 5 years ago

Hi, I tried to run the 'Arm3DEnv' after pasting the files arm.py and arm2d.py inside .../osim/env/. I am trying to run the following code:

from osim.env import Arm3dEnv

env = Arm3dEnv(visualize=True)
observation = env.reset()
total_reward = 0.0

for i in range(200):
    # make a step given by the controller and record the state and the reward
    observation, reward, done, info = env.step(env.action_space.sample())
    total_reward += reward
    if done:
        break
print("Total reward %f" % total_reward)

However, the visualizer window just pops up and closes. Moreover, it generates the following output.

Updating Model file from 30000 to latest format... Loaded model MoBL_ARMS_Upper_Limb_Model_OpenSim from file /home/krishn/Documents/gym/stanford/osim-rl-master/osim/models/MoBL_ARMS_J_Simple_032118.osim GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'default'. The duplicate is being renamed to 'default_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'default'. The duplicate is being renamed to 'default_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'default'. The duplicate is being renamed to 'default_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'default'. The duplicate is being renamed to 'default_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'default'. The duplicate is being renamed to 'default_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'default'. The duplicate is being renamed to 'default_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_2'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_0'. GeometryPath 'geometrypath' has subcomponents with duplicate name 'pathwrap'. The duplicate is being renamed to 'pathwrap_1'. simbody-visualizer: Relink /home/krishn/.conda/envs/opensim-rl/bin/../lib/././libgfortran.so.3' with/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime' 0 Traceback (most recent call last): File "demo.py", line 10, in observation, reward, done, info = env.step(env.action_space.sample()) File "/home/krishn/Documents/gym/stanford/osim-rl-master/osim/env/osim.py", line 362, in step return [ obs, self.get_reward(), self.is_done() or (self.osim_model.istep >= self.spec.timestep_limit), {} ] File "/home/krishn/Documents/gym/stanford/osim-rl-master/osim/env/osim.py", line 293, in get_reward raise NotImplementedError NotImplementedError simbody-visualizer: received Shutdown message. Goodbye.

krishnbera commented 5 years ago

Any idea when the 'Arm2DEnv' will get fixed? I am trying to run it by patching the code but it is not working.

smsong commented 5 years ago

@krishnbera Arm2DEnv is now up. You can test it with: https://github.com/stanfordnmbl/osim-rl/blob/master/examples/arm2d.py

krishnbera commented 5 years ago

@smsong I am able to run it now. Thank you.

kidzik commented 5 years ago

We've just updated the environment so that targets show above the ground. https://github.com/stanfordnmbl/osim-rl/commit/bffb4b0562d1696a79cf348e348696e674422937

There was a change in the OpenSim model that we didn't account for before)

git pull
pip install . -U

in the local repository and with the conda environment activated should do the job