Newbie problems ...

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Esteban Osella
Posts: 3
Joined: Mon Aug 13, 2018 8:09 am

Newbie problems ...

Post by Esteban Osella » Mon Feb 18, 2019 7:28 am

Hi everyone:
I'm trying to get started with opensim in order to run some cycling models. I've installed the core following the instructions, but when triyed to use the first example, I got the following message:

Code: Select all

Traceback (most recent call last):
  File "build_simple_arm_model.py", line 34, in <module>
    import opensim as osim
ImportError: No module named opensim
Additionally, in matlab, when triyed to run the model taken from https://simtk.org/docman/?group_id=1553 I'm getting

Code: Select all

Undefined function or variable 'Model'.

Error in RUNME (line 78)
cyclingModel = Model('Model/FESCyclingModel.osim');
where it tries to load the model as

Code: Select all

cyclingModel = Model('Model/FESCyclingModel.osim');
sounds like Matlab doesn't know where to take the api or something like that...isn't it?

Thanks for any suggest!

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Newbie problems ...

Post by Dimitar Stanev » Mon Feb 18, 2019 10:30 am

Have you installed OpenSim's python bindings?

They could be installed by executing the following command

Code: Select all

pythonX setup.py install --user
(X is 2 or 3)

In my case the setup script was located under the installation dir of opensim-core, which I built manually:

~/dev/opensim-core/install/lib/python2.7/site-packages

(you can also check with pip: pipX list | grep opensim)

If you have OpenSim's bindings already installed then you can try calling

Code: Select all

import opensim
cyclingModel = opensim.Model('Model/FESCyclingModel.osim')
Just make sure that the correct version of python is used.

User avatar
Esteban Osella
Posts: 3
Joined: Mon Aug 13, 2018 8:09 am

Re: Newbie problems ...

Post by Esteban Osella » Tue Feb 19, 2019 12:40 pm

Hi: thanks for your reply. I first used the "impatient mode" :x in the guide and got the problem previously described. After that, I tried with cmake-gui, and it wasn't able to find the simbody location, no matter if I force its location or leave it empty. Then, I took the time, read the cmake process, and I forced the rout to matlab. It correctly found maltab and installation whent well.

Then, at the ctest instance, got the following errors:
The following tests FAILED:

Code: Select all

	 92 - python_tests (Failed)
	 93 - python_examples (Failed) 
	 99 - Java_TestTables (Failed)
	102 - Java_TestC3DFileAdapter (Failed)
	105 - Matlab_wiringInputsAndOutputsWithTableReporter (Failed)
	106 - Matlab_RunHopper_answers (Failed)
	107 - Matlab_RunHopperWithDevice_answers (Failed)
	113 - Matlab_testOsimC3D (Failed)
Then, when trying to install the pyton bindings, got the following

Code: Select all

$ python setup.py 
Traceback (most recent call last):
  File "setup.py", line 12, in <module>
    exec(compile(open('opensim/version.py').read(), 'opensim/version.py', 'exec'))
FileNotFoundError: [Errno 2] No such file or directory: 'opensim/version.py'
and naturally, wasn't able to run the examples.

Additionally, couldn't run the matlab scripts, but I didin't had time to see many details on it.

Any suggest? thanks!

Esteban

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Newbie problems ...

Post by Dimitar Stanev » Tue Feb 19, 2019 4:01 pm

From where did you download OpenSim?

There are instructions (README.md) on github how to properly build the dependencies (simbody). Make sure to checkout on the correct version (tag v4.0).

https://github.com/opensim-org/opensim-core/tree/4.0

I am not sure if Matlab was tested on Linux. You don't have to build Java bindings to work with python.

User avatar
Esteban Osella
Posts: 3
Joined: Mon Aug 13, 2018 8:09 am

Re: Newbie problems ...

Post by Esteban Osella » Tue Feb 19, 2019 7:19 pm

Hi: Thanks again. Yes, I took the code directly from github and followed the instructions from the readme. I've just done the same on my personal (legacy, say PC 'B') computer and (after 2 hangs 'cos insufficient memory when using -j8 :D ) finally got compiled. Unfortunately, ctest gave similar errors to those at lab (say PC 'A'):

Code: Select all

ctest results on PC 'B':
The following tests FAILED:
	 92 - python_tests (Failed)
	 93 - python_examples (Failed)
	 99 - Java_TestTables (Failed)
	102 - Java_TestC3DFileAdapter (Failed)
Errors while running CTest
Matlab's related errors aren't here 'cos I didn't configured the cmake file to look for it, as I did on PC 'A'.

I'm aware that matlab ins't necessary in order to run python examples, but I was interested in working with some models which had been ported to matlab with the opensim library, but at this stage....... i'm considering porting those models to C++ and work directly there!! :lol:

Obviously, any other help, will be really appreciated!

Thanks!

User avatar
Vidhey Oza
Posts: 4
Joined: Tue Jun 11, 2019 3:12 am

Re: Newbie problems ...

Post by Vidhey Oza » Thu Jun 13, 2019 10:35 pm

Hi, I have the same problems with using Python bindings for OpenSim. I also tried bypassing the Java binding in cmake, but I get this error while executing make:

Code: Select all

[ 94%] Compiling Java sources and creating jar archive.
warning: [options] bootstrap class path not set in conjunction with -source 6
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.
make[2]: *** [Bindings/Java/src/org-opensim-modeling.jar] Error 2
make[1]: *** [Bindings/Java/CMakeFiles/JavaBindings.dir/all] Error 2
make: *** [all] Error 2
These are the lines I execute as given in the github readme for compiling from source:

Code: Select all

cmake ../opensim-core \
      -DCMAKE_INSTALL_PREFIX="~/opensim_install" \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DBUILD_PYTHON_WRAPPING=ON \
      -DOPENSIM_DEPENDENCIES_DIR="~/opensim_dependencies_install" \
      -DWITH_BTK=ON
      
make -j8
Notice how I didn't use DBUILD_JAVA_WRAPPING. I tried make with -j8 as well as without it, but got the same results.

I'm confused since I have Java 8 only, no other older or even newer versions.

Any suggestions, please?

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Newbie problems ...

Post by Dimitar Stanev » Sun Jun 16, 2019 12:43 am

You can try configuring the project through cmake-gui in order to check whether a correct Java version is selected. I am not sure, but you might need to check the advanced options as well. Each time that you select an option, the new fields will be highlighted with red in the cmake GUI. Make sure that they are properly configured before building the project.

User avatar
Vidhey Oza
Posts: 4
Joined: Tue Jun 11, 2019 3:12 am

Re: Newbie problems ...

Post by Vidhey Oza » Wed Jun 19, 2019 2:47 am

So I tried installing with CMake GUI, there were 100+ warnings but no errors. These are warnings like:

Code: Select all

/Users/vidhey/opensim-core-source/OpenSim/Simulation/Model/PathPointSet.h:44: Warning 315: Nothing known about 'OpenSim::Set< OpenSim::AbstractPathPoint,OpenSim::Object >::Set'.

or:

/Users/vidhey/opensim-core-source/OpenSim/Common/C3DFileAdapter.h:88: Warning 509: Overloaded method OpenSim::C3DFileAdapter::C3DFileAdapter(OpenSim::C3DFileAdapter &&) effectively ignored, /Users/vidhey/opensim-core-source/OpenSim/Common/C3DFileAdapter.h:87: Warning 509: as it is shadowed by OpenSim::C3DFileAdapter::C3DFileAdapter(OpenSim::C3DFileAdapter const &).

or:

/Users/vidhey/opensim-core-source/OpenSim/Tools/VectorFunctionForActuators.h:140:18: 'OpenSim::VectorFunctionForActuators::evaluate' hides overloaded virtual functions
I disabled installing with java wrapping.

But on performaing install in Xcode, I get this with "Build failed":

Code: Select all

make: *** No rule to make target `/Users/vidhey/opensim-core-build/Bindings/Python/version.py', needed by `/Users/vidhey/opensim-core-build/Bindings/Python/RelWithDebInfo/opensim/version.py'.  Stop.
Command /bin/sh failed with exit code 2
When I try to import opensim in python after installing with sudo python setup.py install at home, I get this:

Code: Select all

$ python
Python 2.7.15 (default, Jun 17 2018, 12:46:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import opensim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.13-x86_64/egg/opensim/__init__.py", line 1, in <module>
  File "build/bdist.macosx-10.13-x86_64/egg/opensim/simbody.py", line 13, in <module>
ImportError: cannot import name _simbody
After installing, I added the opensim home to the PATH and its libraries to the DYLD_LIBRARY_PATH.

What am I missing?

POST REPLY