Python API Installation problems on OSX
Posted: Fri Apr 01, 2022 2:41 am
Hi,
I tried to install different versions of OpenSim (4.2 and 4.3) Python API on a MAC computer (M1 chip) without success.
CASE 1: OpenSim 4.2 using Python 2.7 (the most promising):
sudo python setup.py install --> runs smoothly
In my .bashrc I included
export PYTHONPATH=/Applications/OpenSim\ 4.2/sdk/Python:$PYTHONPATH
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/OpenSim\ 4.2/sdk/lib
Problem:
Once installed, I try to import OpenSim module and get this error:
Python 2.7.16 (default, Jun 18 2021, 03:23:52)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import opensim as os
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "opensim/__init__.py", line 1, in <module>
from .simbody import *
File "opensim/simbody.py", line 17, in <module>
_simbody = swig_import_helper()
File "opensim/simbody.py", line 16, in swig_import_helper
return importlib.import_module('_simbody')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named _simbody
CASE 2: OpenSim 4.3 using Python 2.7:
Problem: I get invalid syntax error messages:
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/simulation.py to simulation.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/simulation.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/version.py to version.pyc
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/examplecomponents.py to examplecomponents.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/examplecomponents.py", line 84
def safeDownCast(obj: "OpenSimObject") -> "OpenSim::ToyReflexController *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/tools.py to tools.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/tools.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/actuators.py to actuators.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/actuators.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/common.py to common.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/common.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/analyses.py to analyses.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/analyses.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/simbody.py to simbody.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/simbody.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/moco.py to moco.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/moco.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
Many thanks in advance!
Mario
I tried to install different versions of OpenSim (4.2 and 4.3) Python API on a MAC computer (M1 chip) without success.
CASE 1: OpenSim 4.2 using Python 2.7 (the most promising):
sudo python setup.py install --> runs smoothly
In my .bashrc I included
export PYTHONPATH=/Applications/OpenSim\ 4.2/sdk/Python:$PYTHONPATH
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/OpenSim\ 4.2/sdk/lib
Problem:
Once installed, I try to import OpenSim module and get this error:
Python 2.7.16 (default, Jun 18 2021, 03:23:52)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import opensim as os
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "opensim/__init__.py", line 1, in <module>
from .simbody import *
File "opensim/simbody.py", line 17, in <module>
_simbody = swig_import_helper()
File "opensim/simbody.py", line 16, in swig_import_helper
return importlib.import_module('_simbody')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named _simbody
CASE 2: OpenSim 4.3 using Python 2.7:
Problem: I get invalid syntax error messages:
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/simulation.py to simulation.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/simulation.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/version.py to version.pyc
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/examplecomponents.py to examplecomponents.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/examplecomponents.py", line 84
def safeDownCast(obj: "OpenSimObject") -> "OpenSim::ToyReflexController *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/tools.py to tools.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/tools.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/actuators.py to actuators.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/actuators.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/common.py to common.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/common.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/analyses.py to analyses.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/analyses.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/simbody.py to simbody.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/simbody.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-11.5-arm64/egg/opensim/moco.py to moco.pyc
File "build/bdist.macosx-11.5-arm64/egg/opensim/moco.py", line 74
def value(self) -> "PyObject *":
^
SyntaxError: invalid syntax
Many thanks in advance!
Mario