MocoCasADiSolver is not available

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Aaron Fox
Posts: 271
Joined: Sun Aug 06, 2017 10:54 pm

MocoCasADiSolver is not available

Post by Aaron Fox » Sun Apr 14, 2024 11:53 pm

Hi Moco Team,

I am working with a student on some analysis with Moco and they are having some troubles with the Python install of OpenSim/Moco. They have run into this problem with both 4.4 and 4.5 having installed through the conda package, where the CasADi solver is not available (see attached screenshot when trying to solve a problem). I haven't been able to troubleshoot this as I can't replicate the issue on my own computer, and I've never had this problem come up when installing via conda - and I also thought all dependencies were dealt with when doing so.

Any advice would be much apreciated.

Aaron
Attachments
Screenshot_CasadiUnavailable.png
Screenshot_CasadiUnavailable.png (322.15 KiB) Viewed 1653 times

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

Re: MocoCasADiSolver is not available

Post by Nicholas Bianco » Mon Apr 15, 2024 12:02 pm

Hi Aaron,

The OpenSim conda packages currently do not include Moco since we are still working through the details of building Moco's dependencies in the conda framework. But yes, we are working on it, so stay tuned!

For now, you should install OpenSim into your Python environments (conda or otherwise) using the typical approach. Navigate to the folder 'sdk\Python' in your OpenSim install directory and in your Python environment call

Code: Select all

python -m pip install .
You will also need to add the "\bin" directory of the OpenSim install to your PATH.

Best,
Nick

User avatar
Aaron Fox
Posts: 271
Joined: Sun Aug 06, 2017 10:54 pm

Re: MocoCasADiSolver is not available

Post by Aaron Fox » Mon Apr 15, 2024 4:27 pm

Thanks Nick.

Perhaps I don't have this problem on my computer due to having previously installed for Python in this way?

I'll take this solution and see if it fixes the problem.

Aaron

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

Re: MocoCasADiSolver is not available

Post by Nicholas Bianco » Tue Apr 16, 2024 9:57 am

Perhaps I don't have this problem on my computer due to having previously installed for Python in this way?
Possibly. If you create a fresh conda environment you can test the install instructions independent of your current Python environment.

User avatar
Tylan Templin
Posts: 40
Joined: Mon Jan 15, 2018 10:55 am

Re: MocoCasADiSolver is not available

Post by Tylan Templin » Fri Apr 26, 2024 7:28 pm

Hi Nick,

I am getting a similar error when running the exampleMocoTrack.py script.

I created a fresh python 3.11 env and conda installed opensim.
Then installed opensim from the sdk/Python folder as you described above
and added C:\OpenSim 4.5\bin to my environment variables.

Still getting:

RuntimeError: std::exception in 'OpenSim::MocoInverseSolution OpenSim::MocoInverse::solve() const': MocoCasADiSolver is not available.
Thrown at MocoCasADiSolver.cpp:455 in solveImpl().

Any thoughts why that might be persisting?

Thanks,

Ty

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

Re: MocoCasADiSolver is not available

Post by Nicholas Bianco » Sat Apr 27, 2024 10:32 am

Hi Tylan,

Moco is not currently available through the OpenSim conda package. We are working on including Moco support in the conda packages, so stay tuned. In the meantime, you can install OpenSim (downloaded from SimTK) into your Python environment manually, as described above.

-Nick

User avatar
Aaron Fox
Posts: 271
Joined: Sun Aug 06, 2017 10:54 pm

Re: MocoCasADiSolver is not available

Post by Aaron Fox » Tue Apr 30, 2024 6:14 pm

Hi Nick,

Quick question as a follow up to this - what is the difference between the opensim and opensim-moco conda packages? I have been installing the opensim-moco version in the conda environments I create and this seems to carry all the Moco features (e.g. Casadi solver) with it.

Aaron

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

Re: MocoCasADiSolver is not available

Post by Nicholas Bianco » Fri May 03, 2024 8:09 am

Hi Aaron,

Yes, thanks for pointing that out. The opensim-moco package has install options for OpenSim 4.4, 4.4.1, and 4.5 on Windows only. We are working on support for Mac and Linux as well in a unified install process.

-Nick

User avatar
Aaron Fox
Posts: 271
Joined: Sun Aug 06, 2017 10:54 pm

Re: MocoCasADiSolver is not available

Post by Aaron Fox » Wed Jun 26, 2024 4:22 pm

Hi Nick,

Mohammadreza pointed out in a thread over on the main OpenSim forum that there is a Linux package available on the opensim-admin channel for OpenSim 4.5. Is this what you are currently working on as supportfor Mac/Linux, and would it be stable to use? As you'll see from the thread I linked above, I'm looking for an easy Linux solution for the HPC cluster I've gained access to at my institution.

Aaron

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

Re: MocoCasADiSolver is not available

Post by Nicholas Bianco » Wed Jun 26, 2024 5:19 pm

Hi Aaron,

I can't guarantee any packages on opensim_admin to be totally stable, but it should work fine for your purposes. Very soon we will have officially conda pacakges on the opensim-org channel, so stay tuned for that too.

Best,
Nick

POST REPLY