Page 1 of 1

DLL load failed: The specified module could not be found

Posted: Fri Apr 14, 2023 1:23 pm
by xhua
Hi OpenSim experts

I am using python script to run OpenSim. When I run

Code: Select all

import opensim
it fails and I got the error below:

Code: Select all

Traceback (most recent call last):
  File "D:\XijinHua\GitHub_xj-hua\Simulation_printAFO_CAMG_20230107\Simulation_printAFO\test.py", line 1, in <module>
    import opensim
  File "C:\Python 3.7.6\Python37\lib\site-packages\opensim-4.1-py3.7.egg\opensim\__init__.py", line 1, in <module>
    from .simbody import *
  File "C:\Python 3.7.6\Python37\lib\site-packages\opensim-4.1-py3.7.egg\opensim\simbody.py", line 18, in <module>
    _simbody = swig_import_helper()
  File "C:\Python 3.7.6\Python37\lib\site-packages\opensim-4.1-py3.7.egg\opensim\simbody.py", line 17, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Python 3.7.6\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.
My OpenSim version is 4.1 and python version is 3.7.6.

I know there are a few topics related to the "DLL load failed" issue in the forum, but the problem for me is that I could run the script successfully well without this error a month ago. A month later, I got this error without changing anything. I would like to continue using my well configured script, but I am not sure why this happened. Is there anyone know the reasons and could provide any help? Thanks.

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

Posted: Fri Apr 14, 2023 10:28 pm
by kernalnet
Hi, please double-check if OpenSim bin folder already exists in your system environment path.

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

Posted: Sat Apr 15, 2023 2:57 am
by xhua
Yes, it is still in the system environment path.

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

Posted: Sat Apr 15, 2023 3:37 am
by kernalnet
Please double-check if there is only one version of OpenSim in the environment path. Otherwise, there may be interference.

You can also try this one before importing OpenSim:

Code: Select all

import sys
sys.path.insert(0, opensim_bin_directory)