opensim-core: Run time error when trying to visualize the sim

Ubuntu 22.04, Python 3.9.15, and opensim 4.4.

I am getting the following errors when I set the visualize=True, it runs when I set the visualize=False.

  • RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': SimTK Exception thrown at VisualizerProtocol.cpp:162:
    • /home/aurelien/anaconda3/envs/opensim/simbody/libexec/simbody/Final system error was errno=2 (No such file or directory). (Required condition ‘status == 0’ was not met.)
  • RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': std::exception

These are the steps I took to create my conda environment

  1. conda create -n opensim python=3.9
  2. conda activate opensim
  3. conda install -c opensim-org opensim=4.4=py39np120

Am I missing an install step to be able to visualize the sim?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I have been having issues making the opensim-core on various Ubuntus. If following the build instructions is not working then another way to get the visualisation to work in conda on Ubuntu is:

  1. conda install -c opensim-org opensim
  2. conda install -c conda-forge simbody

This should allow you to enable visualisation.

A little update to this issue @aymanhab @nickbianco :

  • The conda package does not contain the simbody visualizer, this is why if you install using conda install -c opensim-org opensim, and activate visualization, it crashes. I was able to get a complete error message in Ubuntu 22.04. Is esentially the same error we where getting initially, but now it shows that the executable ‘simbody-visualizer’ cannot be found.
Traceback (most recent call last):
  File "/home/albert/test.py", line 115, in <module>
    state = arm.initSystem()
            ^^^^^^^^^^^^^^^^
  File "/home/albert/anaconda3/envs/test/lib/python3.11/site-packages/opensim/simulation.py", line 24815, in initSystem
    return _simulation.Model_initSystem(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': SimTK Exception thrown at VisualizerProtocol.cpp:165:
  Error detected by Simbody method VisualizerProtocol::ctor(): Unable to spawn executable 'simbody-visualizer' from directories:
  /home/albert/anaconda3/envs/test/bin/
  /home/albert/anaconda3/envs/test/bin/
  /home/albert/anaconda3/condabin/
  /home/albert/anaconda3/bin/
  /usr/local/sbin/
  /usr/local/bin/
  /usr/sbin/
  /usr/bin/
  /sbin/
  /bin/
  /usr/games/
  /usr/local/games/
  /snap/bin/
  Final system error was errno=2 (No such file or directory).
  (Required condition 'status == 0' was not met.)

Traceback (most recent call last):
  File "/home/albert/test.py", line 115, in <module>
    state = arm.initSystem()
            ^^^^^^^^^^^^^^^^
  File "/home/albert/anaconda3/envs/test/lib/python3.11/site-packages/opensim/simulation.py", line 24815, in initSystem
    return _simulation.Model_initSystem(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': std::exception
  • I have checked the conda package from https://anaconda.org/opensim-org/opensim, and the simbody-visualizer executable is not present. I think this is the reason why @A-Artemis could not use it on Ubuntu 22.04, and why it is failing in the colab notebooks.

  • If I install opensim-core from scratch, and try to execute the visualizer on isolation, I get RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': std::exception. After executing /home/albert/opensim-core/sdk/Simbody/libexec/simbody/simbody-visualizer: error while loading shared libraries: libSimTKcommon.so.3.8: cannot open shared object file: No such file or directory as @A-Artemis suggested, it can be executed on isolation.

  • If I add the directory /home/albert/opensim-core/sdk/Simbody/libexec/simbody/ to conda path with conda develop, the new path is shown in the error as a place where it looked for the executable, but it is still throwing the same error (even with the executable in one of the directories now). If I add it to PYTHONPATH, there is not difference either.

@A-Artemis, @mrrezaie Thank you for looking into this!. I will test against the google colab tutorials and get back to you with the results.

This is the only solution that I have found that allows me to use the visualizer for 4.4 (On Ubuntu 22 and Python 3.11).

  1. Follow the instructions here https://github.com/opensim-org/opensim-core/wiki/Build-Instructions
  2. Place these two line lines at the bottom of your ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim-workspace/opensim-core-dependencies-install/simbody/lib
export PYTHONPATH=~opensim-core/sdk/Python:$PYTHONPATH
  1. Activate (or create) your conda environment
# You might need to run the following line
# apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6

conda create -n opensim -c conda-forge anaconda python==3.11.4
conda activate opensim
conda install -c anaconda libgcc
  1. Go to cd ~/opensim-core/sdk/Python and check that setup.py and opensim are present.
  2. Run pip install -e .

It should now be possible to run with the visualizer!