Page 2 of 2
Re: OpenSim Python Scripting
Posted: Mon Mar 13, 2023 3:56 pm
by ongcf
Here are steps that work on my M1 machine using miniconda, on OSX 13.2.1
Create, activate, and install opensim in new environment (this worked for me with 3.7, 3.8, 3.9, 3.10)
Code: Select all
conda create -n opensim_py38 python=3.8
conda activate opensim_py38
conda install -c opensim-org opensim
Then when I launch python (typing 'python' in the terminal window), 'import opensim' works for me with no errors.
I could replicate the "no module" issue, but only if I tried python 3.11. This I think makes sense since there is no python 3.11 build on conda yet:
https://anaconda.org/opensim-org/opensim/files
Re: OpenSim Python Scripting
Posted: Mon Mar 13, 2023 8:18 pm
by albornomazen
Thanks Carmichael. These exact lines you posted did not work with me ("No module name opensim" error). However, it is with osx 12.3.
I was able to fix the problem with the student's computer by adding these lines:
import sys
osim_path = 'D:/Dokumente/Programme/OpenSim/opensim-core/sdk/Python'
sys.path.insert(0,osim_path)
import opensim as osim
all the best,
Mazen
Re: OpenSim Python Scripting
Posted: Sat Apr 08, 2023 11:08 am
by kernalnet
Hi, I'm a windows user with Python 3.9.16. When I try to install OpenSim or Moco via conda, wrong build (py38np120) would be installed and finally, the same error ("No module name opensim")
My fix was to, first, ask conda to look for all available opensim versions and builds:
Code: Select all
conda search -c opensim-org opensim
Which prints:
Code: Select all
Loading channels: done
# Name Version Build Channel
opensim 4.4 py37np120 opensim-org
opensim 4.4 py38np120 opensim-org
opensim 4.4 py39np120 opensim-org
Then, follow this template and install the correct build:
conda install -c <channel> <package_name>=<version>=<build_string>
Code: Select all
conda install -c opensim-org opensim=4.4=py39np120
Hope this helps,
Mohammadreza
Re: OpenSim Python Scripting
Posted: Tue Apr 11, 2023 4:55 am
by jiana
Thanks Mohammadreza. I finally solve the by combining Mohammadreza and Carmichael's experience.
Here are my solution:
Mac M1 13.2.1
python 3.8.8
step1&2&3:
Code: Select all
conda create -n opensim_py38 python=3.8
conda activate opensim_py38
conda search -c opensim-org opensim
then you can see:
Code: Select all
Loading channels: done
# Name Version Build Channel
opensim 0.1.0 py37hf15cd22_1 opensim-org
opensim 4.4 py310np121 opensim-org
opensim 4.4 py37np121 opensim-org
opensim 4.4 py38np121 opensim-org
opensim 4.4 py39np120 opensim-org
opensim 4.4 py39np121 opensim-org
step4:
install opensim according to your python version, here I choose py38np121
Code: Select all
conda install -c opensim-org opensim=4.4=py38np121
--------finish installation-------
all the best,
Jia
Re: OpenSim Python Scripting
Posted: Wed Apr 12, 2023 1:01 pm
by albornomazen
Thanks Mohammadreza and Jia.
Just a question for the community: I have two students (one on Mac M1 and one on Windows) where they have successfully installed Opensim on their computers, but the Simbody GUI does not show up when running their code (after "model.setUseVisualizer(True)"). I remember seeing this before, but don't remember the fix...
all the best,
Mazen