Installation Moco on Conda on macOS

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Louis Paire
Posts: 8
Joined: Mon Apr 01, 2024 12:12 pm

Installation Moco on Conda on macOS

Post by Louis Paire » Wed Apr 03, 2024 2:19 am

Hi everyone,
I'm a beginner in OpenSim and OpenSim Moco, I try to install it on my laptop which is a mac. I install the OpenSim pkg which give an application, and I try to install Moco on Conda but the the problem is related to the moco version (0.4) for Mac. In Windows, it is 4.5.ipopt is a basic library that should be covered in this version and it is not. So I don't really know what to do or follow any idea ?

User avatar
Nicholas Bianco
Posts: 1053
Joined: Thu Oct 04, 2012 8:09 pm

Re: Installation Moco on Conda on macOS

Post by Nicholas Bianco » Wed Apr 03, 2024 10:16 am

Hi Louis,

If you've installed OpenSim 4.5 manually, then it already includes Moco!

Are you trying to install OpenSim via the pre-built conda packages? The officially released conda packages do not yet support Moco.

If you want to install OpenSim into a conda environment: create and activate the environment, navigate to "C:\OpenSim 4.5\sdk\Python", and run the following line:

Code: Select all

python -m pip install .
Note that this installer should work for a generic Python environment, not just Python.

Best,
Nick

User avatar
Louis Paire
Posts: 8
Joined: Mon Apr 01, 2024 12:12 pm

Re: Installation Moco on Conda on macOS

Post by Louis Paire » Tue Apr 09, 2024 4:50 am

Thanks a lot for the answer, I think a almost fix the issue. Now I just have two issues :

- First, when I create a virtual conda env to install Moco as you advice me, it works perflecty. However, when I try to write a code using opensim importation, I have an error as I didn't install the package even if the same importation works in the terminal.

- Second, how do you work with unix command to open OpenSim with python like :
os.add_dll_directory('...')
because this command is not avaible on macos.


Thanks again for your precious help and have a great day !

User avatar
Nicholas Bianco
Posts: 1053
Joined: Thu Oct 04, 2012 8:09 pm

Re: Installation Moco on Conda on macOS

Post by Nicholas Bianco » Tue Apr 09, 2024 9:30 am

Hi Louis,

If you're installing the Python interface from the OpenSim 4.5 release, you shouldn't need to call "os.add_dll_directory()". Could you provide more details on the steps that you've tried and the error message you are receiving?

-Nick

User avatar
Louis Paire
Posts: 8
Joined: Mon Apr 01, 2024 12:12 pm

Re: Installation Moco on Conda on macOS

Post by Louis Paire » Tue Apr 09, 2024 11:36 am

Ok I see my issue but I don't know how to fix it. The error comes when I restart de environnment and it is about the library and this command :
export DYLD_LIBRARY_PATH="/Applications/OpenSim\ 4.5/sdk/lib"
export DYLD_LIBRARY_PATH="/Applications/OpenSim\ 4.5/sdk/Simbody/lib"

It not really export the library so the importation can't do it.

User avatar
Louis Paire
Posts: 8
Joined: Mon Apr 01, 2024 12:12 pm

Re: Installation Moco on Conda on macOS

Post by Louis Paire » Thu Jun 13, 2024 12:05 am

Hi everyone,

We finally managed to successfully install OpenSim on macOS, and it works well. Together with my supervisor, Ana Carolina Cardoso de Sousa, we created a detailed tutorial for installing OpenSim and OpenSim Moco on macOS and Windows for scripting with Python (using PyCharm or VSCode). It is very detailed, but if you encounter any issues, feel free to share them on this forum.

I am also using this thread to share my supervisor's work :D. We have developed a predictive framework for functional electrical stimulation (FES) cycling. Please check out this work!

Tutorial Site:
https://anacsousa.notion.site/Tutorial- ... 7f072d6b09

FES Cycling Work:
https://simtk.org/projects/fes-cycling

Ana Carolina Cardoso de Sousa LinkedIn:
https://www.linkedin.com/in/ana-sousa-67523984

Don't hesitate to take a look at this work!

User avatar
Nicholas Bianco
Posts: 1053
Joined: Thu Oct 04, 2012 8:09 pm

Re: Installation Moco on Conda on macOS

Post by Nicholas Bianco » Mon Jun 17, 2024 12:33 pm

Hi Louis,

Thank you for the detailed instructions! We are working on simplifying the Python installation process in OpenSim soon using conda packages, but I would also like to clean up our installation pages, so this is a great reference point.

Best,
Nick

POST REPLY