Python 3.11 and OpenSim 3.3 Integration Issues

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Walter Menke
Posts: 3
Joined: Wed Nov 03, 2021 4:47 am

Python 3.11 and OpenSim 3.3 Integration Issues

Post by Walter Menke » Tue Oct 22, 2024 2:51 pm

Hi everyone,

I've been trying to get Python 3.11 to integrate with OpenSim 3.3 (on Windows 11) so I can run a bunch of Static Optimizations and Joint Reaction Analyses. Doing that seems to be the easy part, and actually getting the package imported seems to be the real struggle. I've been heavily using the Scripting in Python help page (https://opensimconfluence.atlassian.net ... +in+Python).

I have added the environment variables, and I'm in the C:\OpenSim 3.3\sdk\Python directory when I run the setup.py file. Once that script runs, it does print out version 3.3 in the command window for me, but when I do my "import opensim as osim" and "osim.GetVersionAndDate()" it gives me the AttributeError that the opensim module does not have GetVersionAndDate. I've looked through the 3 troubleshooting tips, and none of them apply to me (as far as I'm aware).

Am I missing something pretty obvious here? Thanks for any help and assistance.

Tags:

User avatar
Ayman Habib
Posts: 2247
Joined: Fri Apr 01, 2005 12:24 pm

Re: Python 3.11 and OpenSim 3.3 Integration Issues

Post by Ayman Habib » Tue Oct 22, 2024 3:19 pm

Hi Walter,

Thanks for reporting. Can you explain how you're getting the OpenSim python bindings? Basically before version 4.0 we used to build in-house bindings with a fixed version of python. Considering that OpenSim 3.3 was released in 2015 and used the python version available then, it's not surprising that changes in python itself and/or in the runtime that was linked with OpenSim would cause breakage.

We highly recommend that you upgrade to version 4.5+ and to use the conda packages that we provide from the page below which enable a one line install (python 3.9-3.11 are available)
https://anaconda.org/opensim-org/opensim

Hope this helps,
-Ayman

User avatar
Walter Menke
Posts: 3
Joined: Wed Nov 03, 2021 4:47 am

Re: Python 3.11 and OpenSim 3.3 Integration Issues

Post by Walter Menke » Wed Oct 23, 2024 7:23 am

Hi Dr. Habib,

Thanks for your reply! I'm using the powershell in VS Code to run the setup.py as recommended in the help documentation for dealing with OpenSim 4.2 or earlier. It does indeed process the dependencies for OpenSim 3.3 as printed out after running that file. But, after the import statement for the opensim package, it doesn't recognize any classes or methods (as in, GetVersionAndDate()). I also see the opensim.py script in the opensim folder of C:\OpenSim 3.3\sdk\Python which has the classes and methods, etc.

The only reason for using the older version here is that I'm using the Lerner et al. 2015 model to deal with medial and lateral contact forces at the knee. To my current knowledge, that model doesn't play well with the modern versions of OpenSim or I would simply move up to there.

I completely understand the deprecation of support for such an old version, so if that's the case (since it looks like Python was around v2.7 at the time), then I'll manage to find a workaround some other way. I appreciate your time and help! Thanks.

User avatar
Walter Menke
Posts: 3
Joined: Wed Nov 03, 2021 4:47 am

Re: Python 3.11 and OpenSim 3.3 Integration Issues

Post by Walter Menke » Thu Oct 24, 2024 5:13 pm

UPDATE:

I've managed to get this to work between OpenSim 3.3 and Matlab 2023a using parts of the BOPS 2.0 package (https://simtk.org/projects/bops). This seems like it will be the way to go if you're using a considerably older version of OpenSim!

POST REPLY