opensim-core icon indicating copy to clipboard operation
opensim-core copied to clipboard

Possibly outdated confluence documentation for setting up Python scripting

Open itbellix opened this issue 1 year ago • 2 comments

Hi, I am setting up scripting in Python (Ubuntu) as described in this confluence page. I have built OpenSim successfully but I am having some issues following the instructions since it appears to me that the folder structure is now different. For example, one of the steps instructs to navigate to a folder I cannot find anywhere in the directories that were created by the opensim-core-linux-build-script.sh script (such as cd <OPENSIM_INSTALL_DIR>/lib/python3.7/site-packages). Also other steps appear to have changed.

Is this possible?

Thank you and have a nice day, Italo

itbellix avatar Sep 01 '23 14:09 itbellix

@itbellix Indeed it's possible and very likely that the instructions for installation from source are outdated, we strongly recommend end users switch to conda environment where the package is self contained and there's support for a variety of platforms and python versions, however if you need to stay on the cutting edge and use your own build you'll have to do the manual wiring step which is more error-prone. Please let us know where you found the outdated docs so we can update them.

The build script that you pointed to, tests the python packaging in non-conda environment so you can refer to that, note however that you'll need to manually install the build artifact into your own python environment (different for different users/setup). This is not done by the build script.

Hope this helps

aymanhab avatar Sep 05 '23 18:09 aymanhab

Hi @aymanhab, thank you for your answer. Indeed, I am planning to use my own build, and I managed for now to install OpenSim and configure scripting with Python without using the conda environment.

What caused me some troubles is that the instructions reported here on how to configure scripting with Python in Ubuntu did not correspond to the result of building OpenSim on my machine. Here a list of mismatches, hoping that this can be useful to you:

  1. The instruction say to run sudo apt-get install python-setuptools in a terminal. This is alright and worked for me
  2. Then the instructions say that one should navigate to "sdk/python folder in your OpenSim installation. Assuming that OpenSim is installed into directory OPENSIM_INSTALL_DIR, perform the following: ... ". In my case, it was not very clear where the OpenSim installation is, as the build produces automatically a opensim-core and opensim-workspace folders. Maybe it would be helpful to list the instructions for the default situation, where the setup.py appears to be (in my case) located at opensim-core/sdk/Python. The current instructions mention a lib/python3.7/site-packages directory that I could not find anywhere, and this is a bit confusing.
  3. Lastly, it is necessary to add the OpenSim libraries to the LD_LIBRARY_PATH. Here I feel that something changed too, since there I could not find a <OPENSIM_INSTALL_DIR>/lib folder, rather I ended up adding the libraries with these two commands (that I copied in my bashrc as well):
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim-core/sdk/lib
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim-workspace/opensim-core-dependencies-install/simbody/lib For now they appear to be sufficient, but I am not sure if I should add to the library path all the lib folders found in the various folders under opensim-core-dependencies-install

I hope that this explanation is clear enough, let me know if it makes sense to you.

Thank you again!

itbellix avatar Sep 06 '23 15:09 itbellix