OpenSim 4.1 - Install - Ubuntu 20.04
Posted: Thu Dec 03, 2020 6:16 am
Hi everyone,
I've had to install OpenSim in Ubuntu 20.04 a few times in the last couple of months, and I had a bit of a hard time installing it.
This post is just a resume of the procedure with all steps (basically command lines, I am not using the CMake GUI). I hope these notes help others!
1. Go to the root of your system and open the .bashrc file:
2. Add these commands at the end of the file:
4. Open a new terminal and create a folder for OpenSim build:
5. Update the system and install required dependencies:
Important note: OpenSim does not build successfully with swig4. If possible, do not install this version, just swig3.0.
6. Build OpenSim dependencies:
7. Build OpenSim. This step takes a while, and my computer freezes with -j higher than 2:
8. Test and install OpenSim:
9. During tests, two of them may fail (`95:python_tests`, `96:python_examples`). For fixing this, follow steps 10-12, and then test and install OpenSim again (step 8).
10. Run python setup:
11. Change the `.bashrc`:
12. Add the path to opensim:
I've had to install OpenSim in Ubuntu 20.04 a few times in the last couple of months, and I had a bit of a hard time installing it.
This post is just a resume of the procedure with all steps (basically command lines, I am not using the CMake GUI). I hope these notes help others!
1. Go to the root of your system and open the .bashrc file:
Code: Select all
cd
gedit .bashrc
3. Save the file and close the terminal.alias python=python3
alias swig=swig3.0
4. Open a new terminal and create a folder for OpenSim build:
Code: Select all
mkdir opensim
cd opensim
Code: Select all
sudo apt-get update
sudo apt install build-essential
sudo apt install python3-pip
pip3 install numpy
sudo apt-get --yes install -y swig3.0 git cmake cmake-curses-gui
sudo apt-get --yes install freeglut3-dev libxi-dev libxmu-dev liblapack-dev python-dev openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
6. Build OpenSim dependencies:
Code: Select all
git clone https://github.com/opensim-org/opensim-core.git
mkdir opensim_dependencies_build
cd opensim_dependencies_build
cmake ../opensim-core/dependencies/ \
-DCMAKE_INSTALL_PREFIX='~/opensim/opensim_dependencies_install' \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j8
Code: Select all
cd ..
mkdir opensim_build
cd opensim_build
cmake ../opensim-core \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX='~/opensim/install' \
-DOPENSIM_DEPENDENCIES_DIR="~/opensim/opensim_dependencies_install" \
-DBUILD_PYTHON_WRAPPING=ON \
-DBUILD_JAVA_WRAPPING=OFF \
-DWITH_BTK=ON
make -j2
Code: Select all
ctest -j2
make -j2 install
10. Run python setup:
Code: Select all
cd ~/opensim/install/lib/python3.8/site-packages
sudo python3 setup.py install
Code: Select all
cd
gedit .bashrc
All steps are, of course, based on opensim-core instructions: https://github.com/opensim-org/opensim- ... -makefilesexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim/install/lib