I have just made a new installation of OpenSim 4.4 in Python 3.8 numpy 1.20 environment. On trying to run Moco I get an error:
"std::exception in 'OpenSim::MocoSolution OpenSim::MocoStudy::solve() const': MocoCasADiSolver is not available.
Thrown at MocoCasADiSolver.cpp:448 in solveImpl()"
Comparing GUI installation on the same machine with the OpenSim package inside Python environmen, I cannot help noticing that the latter contains no CasADi dlls unlike the former.
Could you please help to resolve the issue?
MocoCasADiSolver is not available in python
- Ekaterina Stansfield
- Posts: 6
- Joined: Mon Jul 03, 2017 5:37 am
- Mohammadreza Rezaie
- Posts: 390
- Joined: Fri Nov 24, 2017 12:48 am
Re: MocoCasADiSolver is not available in python
Hi, if you are using Conda environment, OpenSim recommends using the conda package: https://anaconda.org/opensim-org/opensim-moco
https://simtk-confluence.stanford.edu:8 ... +in+Python
You can also try adding these lines at the beginning of your script:
https://simtk-confluence.stanford.edu:8 ... +in+Python
You can also try adding these lines at the beginning of your script:
Code: Select all
import os
os.add_dll_directory('<dir/to/bin>')
- katya stansfield
- Posts: 4
- Joined: Mon Dec 02, 2019 8:39 pm
Re: MocoCasADiSolver is not available in python
Thank you for help: I installed opensim-moco in a python38 miniconda environment** and run "os.add_dll_directory..." (I assume that the path to bin folder is the path inside the environment). However, I still get the following:
File c:\Users\...\miniconda3\envs\py38\lib\opensim\__init__.py:7
5 os.add_dll_directory(os.path.dirname(os.path.realpath(__file__)))
6 else:
----> 7 os.add_dll_directory(DLL_PATH)
9 from .simbody import *
10 from .common import *
NameError: name 'DLL_PATH' is not defined
Is there a solution?
**Just to mention -- I do not have the same problem with installing openism without moco in the same environment...
File c:\Users\...\miniconda3\envs\py38\lib\opensim\__init__.py:7
5 os.add_dll_directory(os.path.dirname(os.path.realpath(__file__)))
6 else:
----> 7 os.add_dll_directory(DLL_PATH)
9 from .simbody import *
10 from .common import *
NameError: name 'DLL_PATH' is not defined
Is there a solution?
**Just to mention -- I do not have the same problem with installing openism without moco in the same environment...
- Mohammadreza Rezaie
- Posts: 390
- Joined: Fri Nov 24, 2017 12:48 am
Re: MocoCasADiSolver is not available in python
Hi, the issue of DLL_PATH was fixed in the 4.4.1 version, which can be installed by:
Also, make sure that the miniconda paths exist in your environment path, e.g.:
Let me know how it goes.
Code: Select all
conda install -c opensim-org opensim-moco=4.4.1
Code: Select all
\miniconda3
\miniconda3\Scripts
\miniconda3\Library\bin
\miniforge3\Library\usr\bin
\miniforge3\Library\mingw-w64\bin
- Ekaterina Stansfield
- Posts: 6
- Joined: Mon Jul 03, 2017 5:37 am
Re: MocoCasADiSolver is not available in python
Thank you -- this version required python 3.9, not 3.8 -- Once the correct environment was created, the installation was painless. Thanks again for your help.
- katya stansfield
- Posts: 4
- Joined: Mon Dec 02, 2019 8:39 pm
Re: MocoCasADiSolver is not available in python
Is there any version of opensim-moco that can be installed on Unix?