DLL load failed while importing _simbody: The specified module could not be found

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Nev Pires
Posts: 3
Joined: Tue Aug 05, 2014 11:56 am

DLL load failed while importing _simbody: The specified module could not be found

Post by Nev Pires » Fri Apr 07, 2023 4:17 pm

I'm following the instructions found here: https://simtk-confluence.stanford.edu:8 ... +in+Python

I opened a command window and ran the following:

Code: Select all

cd "C:\OpenSim 4.4\sdk\Python
python -m pip install .
Everything seems that it runs correctly.

When I then try to run

Code: Select all

import opensim
it fails and I get the error:

Code: Select all

Traceback (most recent call last):
  File "C:\Users\npires.OMG\OneDrive - OMG PLC\Work Projects\Codes\recover-video-transfer-list\recover_video_transfer_list.py", line 6, in <module>
    import opensim
  File "C:\ProgramData\Anaconda3\lib\opensim\__init__.py", line 6, in <module>
    from .simbody import *
  File "C:\ProgramData\Anaconda3\lib\opensim\simbody.py", line 13, in <module>
    from . import _simbody
ImportError: DLL load failed while importing _simbody: The specified module could not be found.
I'm running Windows 11, OpenSim 4.4 and Python 3.10.9 packaged by Anaconda.

I have added the OpenSim 4.4/bin folder to the environment variables

Not sure why it's failing to import the opensim module as by all indications, it's been installed correctly.

Thanks!

Tags:

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: DLL load failed while importing _simbody: The specified module could not be found

Post by Thomas Uchida » Sat Apr 08, 2023 8:36 am

Please see Topic 16108: viewtopicPhpbb.php?f=91&t=16108. The documentation (the box at the top of the "Scripting in Python" page, https://simtk-confluence.stanford.edu:8 ... +in+Python) says that "Python version 3.8 is supported for OpenSim version 4.3+."

User avatar
Mazen Al Borno
Posts: 10
Joined: Fri Jan 27, 2023 2:19 pm

Re: DLL load failed while importing _simbody: The specified module could not be found

Post by Mazen Al Borno » Wed Apr 12, 2023 3:29 pm

Just debugged this issue on a student's computer. Adding these lines worked in his case:

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

POST REPLY