pinocchio: Built from source, encoutered ImportError: libeigenpy.so: cannot open shared object file: No such file or directory
Dear Pinocchio team,
First of all thanks for the great project. I’m trying to use pinocchio3 casadi-python interface. And when I run a simple script, the first line import pinocchio fails.
fenglongsong@ubuntu:~/Desktop/test_algo$ python3 test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
import pinocchio
File "/usr/local/lib/python3/dist-packages/pinocchio/__init__.py", line 6, in <module>
from .pinocchio_pywrap_default import *
ImportError: libeigenpy.so: cannot open shared object file: No such file or directory
I was following the tutorial on Pinocchio website here and I did add these lines into ~/.bashrc and run source ~/.bashrc
export PATH=/usr/local/bin:$PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/usr/local/lib/python3/dist-packages:$PYTHONPATH
export CMAKE_PREFIX_PATH=/usr/local:$CMAKE_PREFIX_PATH
export PATH=/opt/openrobots/bin:$PATH
export PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/openrobots/lib/python3.8/site-packages:$PYTHONPATH
export CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH
I’m suscepting this is related to the possible error in installing Pinocchio by build from the source. When I was doing the cmake .. step, this is what I got:
fenglongsong@ubuntu:~/Documents/pinocchio3/pinocchio/build(pinocchio3-preview)$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DPYTHON_EXECUTABLE=/usr/bin/python3
-- Package version (ROS package.xml): 2.9.1
-- Default C++ standard: 201402
-- C++ standard sufficient: Minimal required 11, currently defined: 14
-- Found Boost: /usr/include (found version "1.71.0") found components: filesystem serialization system
-- The Python bindings of Pinocchio will be compiled along the main library. If you want to disable this feature, please set the option BUILD_PYTHON_INTERFACE to OFF.
-- Found Python3: /usr/bin/python3 (found version "3.8.10") found components: Interpreter Development
-- PythonLibraryDirs: /usr/lib/x86_64-linux-gnu
-- PythonLibVersionString: 3.8.10
-- Python site lib: lib/python3/dist-packages
-- Found Boost: /usr/include (found version "1.71.0") found components: python38
-- Boost_PYTHON_LIBRARY: /usr/lib/x86_64-linux-gnu/libboost_python38.so
-- eigenpy FOUND. eigenpy at /opt/openrobots/lib/libeigenpy.so
CMake Warning (dev) at /opt/openrobots/lib/cmake/eigenpy/python.cmake:68 (message):
Macro FINDPYTHON has already been called. Several call to FINDPYTHON may
not find the same Python version (for a yet unknown reason).
Call Stack (most recent call first):
/opt/openrobots/lib/cmake/eigenpy/eigenpyConfig.cmake:142 (FINDPYTHON)
cmake/package-config.cmake:97 (find_package)
CMakeLists.txt:163 (ADD_PROJECT_DEPENDENCY)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found Python3: /usr/bin/python3 (found version "3.8.10") found components: Interpreter NumPy Development
-- PythonLibraryDirs: /usr/lib/x86_64-linux-gnu
-- PythonLibVersionString: 3.8.10
-- Python site lib: lib/python3/dist-packages
-- Python include dirs: /usr/include/python3.8
-- checking for numpy
-- NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.8/dist-packages/numpy/core/include
-- NUMPY_VERSION=1.23.1
-- NumPy include dir: /usr/local/lib/python3.8/dist-packages/numpy/core/include
-- checking for numpy
-- NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.8/dist-packages/numpy/core/include
-- NUMPY_VERSION=1.23.1
-- Python compiler: CPython
-- Found Boost: /usr/include (found version "1.71.0") found components: unit_test_framework
-- Doxygen rendering: using MathJax backend
-- Configuring done
-- Generating done
-- Build files have been written to: /home/fenglongsong/Documents/pinocchio3/pinocchio/build
Clearly there is a warning information about eigenpy. And when I run make -j4, there was long information in the terminal and I’m taking the last a few lines here, since the information has been repeatedly saying Entering directory XXX or Leaving directory XXX.
[ 98%] Built target example-cpp-geometry-models
make[2]: Entering directory '/home/fenglongsong/Documents/pinocchio3/pinocchio/build'
make[2]: Nothing to be done for 'examples/CMakeFiles/example-cpp-forward-dynamics-derivatives.dir/build'.
make[2]: Leaving directory '/home/fenglongsong/Documents/pinocchio3/pinocchio/build'
make[2]: Entering directory '/home/fenglongsong/Documents/pinocchio3/pinocchio/build'
make[2]: Nothing to be done for 'examples/CMakeFiles/example-cpp-inverse-dynamics-derivatives.dir/build'.
make[2]: Leaving directory '/home/fenglongsong/Documents/pinocchio3/pinocchio/build'
[100%] Built target example-cpp-forward-dynamics-derivatives
[100%] Built target example-cpp-inverse-dynamics-derivatives
make[1]: Leaving directory '/home/fenglongsong/Documents/pinocchio3/pinocchio/build'
/usr/bin/cmake -E cmake_progress_start /home/fenglongsong/Documents/pinocchio3/pinocchio/build/CMakeFiles 0
Would you guys have any advice to fix this? Besides, my purpose of build from source is because I want to use the python bindings in pinocchio3, especially pinocchio.casadi. Do you think in this case building from source is necessary? Will there be other ways to achieve this? Thanks a lot!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (11 by maintainers)
Ok I forgot that when installing in
/usr/local, python on ubuntu wants modules in/usr/local/lib/python3.8/dist-packages. This can be set with-DPYTHON_STANDARD_LAYOUT=ON -DPYTHON_DEB_LAYOUT=ONcmake options.In other words, I added this at the end of the dockerfile:
But now I have:
And for this issue, I don’t have an answer. Maybe someone else can help, otherwise I’m afraid you’ll have to wait for pinocchio 3 release.
Ok, so here is a Dockerfile which work:
Is this helping, @FenglongSong ?