ImportError: DLL load failed while importing _simbody

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Jip Helsloot
Posts: 6
Joined: Wed May 03, 2023 1:49 am

ImportError: DLL load failed while importing _simbody

Post by Jip Helsloot » Tue Jun 27, 2023 12:26 am

Dear,

When following the installation guide on the website: https://simtk-confluence.stanford.edu:8 ... +in+Python
the following error appears:

ImportError: DLL load failed while importing _simbody: cannot find given module.

The website says: 'If you get an error about loading DLL failure check that PATH has been updated correctly before relaunching the shell' (
Spyder OpenSim error.png
Spyder OpenSim error.png (115.13 KiB) Viewed 503 times
) but I feel like the path is correct and the simbody file is in the map (
opensim path.png
opensim path.png (130.62 KiB) Viewed 503 times
see ).

How and to which path should I change to be able to import _simbody?

I am looking forward to your response.

Kind regards,

Jip Helsloot

User avatar
Mohammadreza Rezaie
Posts: 381
Joined: Fri Nov 24, 2017 12:48 am

Re: ImportError: DLL load failed while importing _simbody

Post by Mohammadreza Rezaie » Tue Jun 27, 2023 10:38 am

Hi, please specify the versions of OpenSim and Python installed. Also, do you use official Python or Conda distribution?

User avatar
Matthias Kindler
Posts: 9
Joined: Tue Dec 06, 2022 1:02 am

Re: ImportError: DLL load failed while importing _simbody

Post by Matthias Kindler » Wed Jun 28, 2023 8:01 am

Hello, for me this helped:
I guess you are using windows...
I had to add these two lines before every opensim import...

import os
os.add_dll_directory("C:/OpenSim 4.4/bin")

"C:/OpenSim 4.4/bin" could be different depending on where you installed Opensim

User avatar
Jip Helsloot
Posts: 6
Joined: Wed May 03, 2023 1:49 am

Re: ImportError: DLL load failed while importing _simbody

Post by Jip Helsloot » Fri Jun 30, 2023 12:32 am

I tried this because I am working on windows:
import os
os.add_dll_directory("C:/OpenSim 4.4/bin")
Unfortunately this didn't work for me, I still get the same error.



@Mohammadreza Rezaie
My OpenSim version is 4.4 and my python version is 3.9
I used anaconda and spyder.

Best,

Jip

User avatar
Mohammadreza Rezaie
Posts: 381
Joined: Fri Nov 24, 2017 12:48 am

Re: ImportError: DLL load failed while importing _simbody

Post by Mohammadreza Rezaie » Mon Jul 03, 2023 8:03 am

The package comes with OpenSim 4.4 installer works with Python 3.8 only. But you can use the conda package that works with recent versions: https://anaconda.org/opensim-org/opensim

POST REPLY