krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
378 stars 96 forks source link

Installation from source in python virtual environment fails in ubuntu 20.04 (python 3.7) #168

Closed joaomcm closed 12 months ago

joaomcm commented 1 year ago

Installing Current version of Klampt on python 3.7 and Ubuntu 20.04 from source succeeds, but even after adding ODE, tinyXML and Assimp to LD_LIBRARY_PATH, importing klampt results in the following error:

>>> import klampt                                                                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                                         
  File "<stdin>", line 1, in <module>                                                                                                                                                                      
  File "/home/motion/miniconda3/envs/habitat/lib/python3.7/site-packages/Klampt-0.9.0-py3.7-linux-x86_64.egg/klampt/__init__.py", line 9, in <module>                                                      
    from .robotsim import *                                                                                                                                                                                
  File "/home/motion/miniconda3/envs/habitat/lib/python3.7/site-packages/Klampt-0.9.0-py3.7-linux-x86_64.egg/klampt/robotsim.py", line 18, in <module>                                                     
    from . import _robotsim                                                                                                                                                                                
ImportError: /lib/x86_64-linux-gnu/libfreeimage.so.3: undefined symbol: _TIFFDataSize, version LIBTIFF_4.0  

This issue can be fixed following this bug report for libfreeimage: https://bugs.launchpad.net/savos/+bug/1979176

i.e.:

sudo add-apt-repository ppa:savoury1/graphics
sudo apt update
sudo apt install 
sudo apt-get install libfreeimage3 libfreeimage-dev 

to update libfreeimage to a working version (3.18.0+ds2-7).

Further, installing Klampt on conda virtual environments from source requires following this tutorial to alter the LD_LIBRARY_PATH upon environment activation: https://stackoverflow.com/questions/46826497/conda-set-ld-library-path-for-env-only

In my case, setting env_vars.sh in activate.d to

export OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libtinyxml.so:/usr/lib/x86_64-linux-gnu/libode.so:/usr/lib/x86_64-linux-gnu/libassimp.so:"${LD_LIBRARY_PATH}"

Solved the issue.

Hope this helps anyone else having similar issues.

krishauser commented 12 months ago

Resolved with 0.9.1 release