wkentaro / octomap-python

Python binding of the OctoMap library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: libdynamicedt3d.so.1.8

fzy139 opened this issue · comments

Hi,
I'm trying to install octomap with pip in a conda env and it turns out to be that import error.Is there anything else I should install?
ImportError: libdynamicedt3d.so.1.8: cannot open shared object file: No such file or directory

                                                       Thanks a lot!

It is working on the Travis: https://travis-ci.com/wkentaro/octomap-python.
Can you check what is the difference between your env and the env on Travis?
e.g., OS

It is working on the Travis: https://travis-ci.com/wkentaro/octomap-python.
Can you check what is the difference between your env and the env on Travis?
e.g., OS

Hi wkentaro,
I've done it.I should install the liboctomap-dev and libdynamicedt3d-dev before I install the octomap-python.Thank for what you've done.

It's strange, since these dynamic link libraries should be installed via pip.

Name: octomap-python
Version: 1.8.0.post12
Summary: Python binding of the OctoMap library.
Home-page: https://github.com/wkentaro/octomap-python
Author: None
Author-email: None
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: numpy
Required-by: 
Files:
  ../../../bin/binvox2bt
  ../../../bin/bt2vrml
  ../../../bin/compare_octrees
  ../../../bin/convert_octree
  ../../../bin/edit_octree
  ../../../bin/eval_octree_accuracy
  ../../../bin/graph2tree
  ../../../bin/log2graph
  ../../../include/dynamicEDT3D/bucketedqueue.h
  ../../../include/dynamicEDT3D/bucketedqueue.hxx
  ../../../include/dynamicEDT3D/dynamicEDT3D.h
  ../../../include/dynamicEDT3D/dynamicEDTOctomap.h
  ../../../include/dynamicEDT3D/point.h
  ../../../include/octomap/AbstractOcTree.h
  ../../../include/octomap/AbstractOccupancyOcTree.h
  ../../../include/octomap/ColorOcTree.h
  ../../../include/octomap/CountingOcTree.h
  ../../../include/octomap/MCTables.h
  ../../../include/octomap/MapCollection.h
  ../../../include/octomap/MapCollection.hxx
  ../../../include/octomap/MapNode.h
  ../../../include/octomap/MapNode.hxx
  ../../../include/octomap/OcTree.h
  ../../../include/octomap/OcTreeBase.h
  ../../../include/octomap/OcTreeBaseImpl.h
  ../../../include/octomap/OcTreeBaseImpl.hxx
  ../../../include/octomap/OcTreeDataNode.h
  ../../../include/octomap/OcTreeDataNode.hxx
  ../../../include/octomap/OcTreeIterator.hxx
  ../../../include/octomap/OcTreeKey.h
  ../../../include/octomap/OcTreeNode.h
  ../../../include/octomap/OcTreeStamped.h
  ../../../include/octomap/OccupancyOcTreeBase.h
  ../../../include/octomap/OccupancyOcTreeBase.hxx
  ../../../include/octomap/Pointcloud.h
  ../../../include/octomap/ScanGraph.h
  ../../../include/octomap/math/Pose6D.h
  ../../../include/octomap/math/Quaternion.h
  ../../../include/octomap/math/Utils.h
  ../../../include/octomap/math/Vector3.h
  ../../../include/octomap/octomap.h
  ../../../include/octomap/octomap_deprecated.h
  ../../../include/octomap/octomap_timing.h
  ../../../include/octomap/octomap_types.h
  ../../../include/octomap/octomap_utils.h
  ../../../share/dynamicEDT3D/dynamicEDT3DConfig-version.cmake
  ../../../share/dynamicEDT3D/dynamicEDT3DConfig.cmake
  ../../../share/dynamic_edt_3d/package.xml
  ../../../share/octomap/octomap-config-version.cmake
  ../../../share/octomap/octomap-config.cmake
  ../../../share/octomap/package.xml
  ../../libdynamicedt3d.a
  ../../libdynamicedt3d.so
  ../../libdynamicedt3d.so.1.8
  ../../libdynamicedt3d.so.1.8.0
  ../../liboctomap.a
  ../../liboctomap.so
  ../../liboctomap.so.1.8
  ../../liboctomap.so.1.8.0
  ../../liboctomath.a
  ../../liboctomath.so
  ../../liboctomath.so.1.8
  ../../liboctomath.so.1.8.0
  ../../pkgconfig/dynamicEDT3D.pc
  ../../pkgconfig/octomap.pc
  octomap.so
  octomap_python-1.8.0.post12.dist-info/INSTALLER
  octomap_python-1.8.0.post12.dist-info/METADATA
  octomap_python-1.8.0.post12.dist-info/RECORD
  octomap_python-1.8.0.post12.dist-info/WHEEL
  octomap_python-1.8.0.post12.dist-info/top_level.txt

I have the same issue on macOS Mojave 10.14.6

Installing octomap beforehand did not fix it for me either.

Please put the output of pip show --files octomap-python?

Thank you for the quick response.

Name: octomap-python
Version: 1.8.0.post12
Summary: Python binding of the OctoMap library.
Home-page: https://github.com/wkentaro/octomap-python
Author: None
Author-email: None
License: BSD
Location: /Users/biggzlar/anaconda3/envs/octo/lib/python3.6/site-packages
Requires: numpy
Required-by:
Files:
  ../../../bin/binvox2bt
  ../../../bin/bt2vrml
  ../../../bin/compare_octrees
  ../../../bin/convert_octree
  ../../../bin/edit_octree
  ../../../bin/eval_octree_accuracy
  ../../../bin/graph2tree
  ../../../bin/log2graph
  ../../../include/dynamicEDT3D/bucketedqueue.h
  ../../../include/dynamicEDT3D/bucketedqueue.hxx
  ../../../include/dynamicEDT3D/dynamicEDT3D.h
  ../../../include/dynamicEDT3D/dynamicEDTOctomap.h
  ../../../include/dynamicEDT3D/point.h
  ../../../include/octomap/AbstractOcTree.h
  ../../../include/octomap/AbstractOccupancyOcTree.h
  ../../../include/octomap/ColorOcTree.h
  ../../../include/octomap/CountingOcTree.h
  ../../../include/octomap/MCTables.h
  ../../../include/octomap/MapCollection.h
  ../../../include/octomap/MapCollection.hxx
  ../../../include/octomap/MapNode.h
  ../../../include/octomap/MapNode.hxx
  ../../../include/octomap/OcTree.h
  ../../../include/octomap/OcTreeBase.h
  ../../../include/octomap/OcTreeBaseImpl.h
  ../../../include/octomap/OcTreeBaseImpl.hxx
  ../../../include/octomap/OcTreeDataNode.h
  ../../../include/octomap/OcTreeDataNode.hxx
  ../../../include/octomap/OcTreeIterator.hxx
  ../../../include/octomap/OcTreeKey.h
  ../../../include/octomap/OcTreeNode.h
  ../../../include/octomap/OcTreeStamped.h
  ../../../include/octomap/OccupancyOcTreeBase.h
  ../../../include/octomap/OccupancyOcTreeBase.hxx
  ../../../include/octomap/Pointcloud.h
  ../../../include/octomap/ScanGraph.h
  ../../../include/octomap/math/Pose6D.h
  ../../../include/octomap/math/Quaternion.h
  ../../../include/octomap/math/Utils.h
  ../../../include/octomap/math/Vector3.h
  ../../../include/octomap/octomap.h
  ../../../include/octomap/octomap_deprecated.h
  ../../../include/octomap/octomap_timing.h
  ../../../include/octomap/octomap_types.h
  ../../../include/octomap/octomap_utils.h
  ../../../share/dynamicEDT3D/dynamicEDT3DConfig-version.cmake
  ../../../share/dynamicEDT3D/dynamicEDT3DConfig.cmake
  ../../../share/dynamic_edt_3d/package.xml
  ../../../share/octomap/octomap-config-version.cmake
  ../../../share/octomap/octomap-config.cmake
  ../../../share/octomap/package.xml
  ../../libdynamicedt3d.1.8.0.dylib
  ../../libdynamicedt3d.1.8.dylib
  ../../libdynamicedt3d.a
  ../../libdynamicedt3d.dylib
  ../../liboctomap.1.8.0.dylib
  ../../liboctomap.1.8.dylib
  ../../liboctomap.a
  ../../liboctomap.dylib
  ../../liboctomath.1.8.0.dylib
  ../../liboctomath.1.8.dylib
  ../../liboctomath.a
  ../../liboctomath.dylib
  ../../pkgconfig/dynamicEDT3D.pc
  ../../pkgconfig/octomap.pc
  octomap.cpython-36m-darwin.so
  octomap_python-1.8.0.post12.dist-info/INSTALLER
  octomap_python-1.8.0.post12.dist-info/METADATA
  octomap_python-1.8.0.post12.dist-info/RECORD
  octomap_python-1.8.0.post12.dist-info/WHEEL
  octomap_python-1.8.0.post12.dist-info/top_level.txt

Error log:

Traceback (most recent call last):
  File "run.py", line 2, in <module>
    import octomap
ImportError: dlopen(/Users/biggzlar/anaconda3/envs/octo/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so, 2): Library not loaded: /private/var/folders/hs/0ggtspzs07bfg6x4dtm1b2880000gn/T/pip-install-_ttpxv31/octomap-python/src/octomap/lib/libdynamicedt3d.1.8.dylib
  Referenced from: /Users/biggzlar/anaconda3/envs/octo/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so
  Reason: image not found

It seems dylib is properly installed. Maybe linking fails.
Can you run otool -L /Users/biggzlar/anaconda3/envs/octo/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so?

FYI: If you are in a rush, you can run pip install octomap-python --no-binary octomap-python to avoid using the wheel file, which is prebuilt and install from source.
But I also want to fix the issue of binary actually.

Output of otool -L ...:

/Users/biggzlar/anaconda3/envs/octo/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so:
	/private/var/folders/hs/0ggtspzs07bfg6x4dtm1b2880000gn/T/pip-install-_ttpxv31/octomap-python/src/octomap/lib/libdynamicedt3d.1.8.dylib (compatibility version 1.8.0, current version 1.8.0)
	/private/var/folders/hs/0ggtspzs07bfg6x4dtm1b2880000gn/T/pip-install-_ttpxv31/octomap-python/src/octomap/lib/liboctomap.1.8.dylib (compatibility version 1.8.0, current version 1.8.0)
	/private/var/folders/hs/0ggtspzs07bfg6x4dtm1b2880000gn/T/pip-install-_ttpxv31/octomap-python/src/octomap/lib/liboctomath.1.8.dylib (compatibility version 1.8.0, current version 1.8.0)
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

What might be of interest is, that when I go to uninstall via pip, it shows the following list of file locations. Maybe this is just an issue with conda environments? I.e. the binary is not searching in the right spot?

    ...
    /Users/biggzlar/anaconda3/envs/octo/lib/libdynamicedt3d.1.8.0.dylib
    /Users/biggzlar/anaconda3/envs/octo/lib/libdynamicedt3d.1.8.dylib
    /Users/biggzlar/anaconda3/envs/octo/lib/libdynamicedt3d.a
    /Users/biggzlar/anaconda3/envs/octo/lib/libdynamicedt3d.dylib
    /Users/biggzlar/anaconda3/envs/octo/lib/liboctomap.1.8.0.dylib
    /Users/biggzlar/anaconda3/envs/octo/lib/liboctomap.1.8.dylib
    ...

I think the problem is that the dylib file paths are absolute.
e.g. /private/var/folders/hs/0ggtspzs07bfg6x4dtm1b2880000gn/T/pip-install-_ttpxv31/octomap-python/src/octomap/lib/libdynamicedt3d.1.8.dylib

It should be relative or something like @rpath/libdynamicedt3d.1.8.dylib.
I think this is the problem of the binary generator https://github.com/wkentaro/octomap-python-wheels.

In Ubuntu + Anaconda, it shows like below

% ldd .anaconda3/lib/python3.7/site-packages/octomap.cpython-37m-x86_64-linux-gnu.so
	linux-vdso.so.1 =>  (0x00007ffc9ffb7000)
	libdynamicedt3d.so.1.8 => not found
	liboctomap.so.1.8 => not found
	liboctomath.so.1.8 => not found
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3361fed000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3361ce4000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3361ace000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f33618b1000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f33614e7000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f33625bc000)

but lib is installed

% ls .anaconda3/lib/liboctomap*
.anaconda3/lib/liboctomap.a  .anaconda3/lib/liboctomap.so  .anaconda3/lib/liboctomap.so.1.8  .anaconda3/lib/liboctomap.so.1.8.0

so it works.

python -c 'import octomap'

I will work on fixing this, but for short-term you need to use --no-binary option, because I don't think I can fix it immediately

Thank you!
Could you give instructions on how to compile the binary myself if I go the --no-binary route?

The binary files (e.g., octomap..so, liboctomap..so) are compiled and installed automatically. you just need to run with the options I told.

Thanks! Sadly, for me, this leads to the same error. The library again isn't found (and searched for in the same temp directory). :(

Oh, really. Maybe you need to wait until I solve this

Has the binary issue being solved?
I am having the same problem.

Has the binary issue being solved?
I am having the same problem.

Sadly me too.

i was able to fix this by adding the path to the .so to LD_LIBRARY_PATH

I am having the same issue on macOS Catalina. @LucasBruder can you be more specific?

(py3.6.10) student-net-vpn-2142:octomap-python mgsa$ python -c "import octomap"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(/Users/mgsa/sp/py3.6.10/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so, 2): Library not loaded: /private/var/folders/v_/87m7kb0x3sl15z2_cypyd4c40000gn/T/pip-install-1ye7easn/octomap-python/src/octomap/lib/libdynamicedt3d.1.8.dylib
  Referenced from: /Users/mgsa/sp/py3.6.10/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so
  Reason: image not found

I am having the same issue on macOS Catalina. @LucasBruder can you be more specific?

(py3.6.10) student-net-vpn-2142:octomap-python mgsa$ python -c "import octomap"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(/Users/mgsa/sp/py3.6.10/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so, 2): Library not loaded: /private/var/folders/v_/87m7kb0x3sl15z2_cypyd4c40000gn/T/pip-install-1ye7easn/octomap-python/src/octomap/lib/libdynamicedt3d.1.8.dylib
  Referenced from: /Users/mgsa/sp/py3.6.10/lib/python3.6/site-packages/octomap.cpython-36m-darwin.so
  Reason: image not found

Something like the below might work, although I've never tried this on OSX

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Users/mgsa/sp/py3.6.10/lib/python3.6/site-packages/
python -c "import octomap"

Thank you for your answer. However, it still does not work. I could not install the library as I get back to that image not found error every way I try

Let me have a look.

Let me have a look.

Do you need any info? Thank you

Below command should work in the wild

git clone https://github.com/wkentaro/octomap-python.git
cd octomap-python

wget https://raw.githubusercontent.com/wkentaro/dotfiles/master/local/bin/install_anaconda3.sh
bash ./install_anaconda3.sh .
source .anaconda3/bin/activate

pip install -e .

cd examples
python -c 'import octomap'
./insertPointCloud.py
./getLabels.py

I have been able to create "fixed" manylinux wheel following the instructions at How to include external library with python wheel package using the mentioned auditwheel tool.

Feel free to try the fixed package: pip install -i https://osgar.robotika.cz/subt/pip/ octomap-python==1.8.0.post12

Hello @wkentaro,
Has this bug been fixed yet? I'm having the same problem during import the octomap package.

ImportError: libdynamicedt3d.so.1.8: cannot open shared object file: No such file or directory

I already installed libdynamicedt3d separately on my PC (using apt-get), but the version is 1.9. Is it possible to use this package with the 1.9 version of libdynamicedt? Or, I should use the 1.8 version? Do you know how I can install this lib on 1.8 version?

Feel free to try the fixed package: pip install -i https://osgar.robotika.cz/subt/pip/ octomap-python==1.8.0.post12

Thanks for your work - Is it possible to create such package for other python versions (3.8+), too?

had to add extra_link_args to the Extension in setup.py to resolve this linker issue:

Extension(
            'octomap',
            ['octomap/octomap.pyx'],
            extra_link_args=['-Wl,-rpath,$ORIGIN/../lib'],

$ORIGIN is here the path to the executable, see https://unix.stackexchange.com/questions/22926/where-do-executables-look-for-shared-objects-at-runtime for more info. Depending on how you install with pip, the path will differ. E.g. when installing with pip install -e ./, it should be $ORIGIN/src/octomap/lib.

I think this has something to do with the current version of the octomap library that is added as a submodule to the repo. When I clone the repo with --recursive, i am able to import octomap, this is likely because when building the library without the local octomap submodule, the globally installed one is used, which in my case is the latest version of the octomap library.