MIT-SPARK / TEASER-plusplus

A fast and robust point cloud registration library
MIT License
1.81k stars 344 forks source link

[BUG] Import teaserpp_python before scipy may cause ImportError #160

Open jingnanshi opened 1 year ago

jingnanshi commented 1 year ago

Describe the bug Import teaserpp_python before scipy may cause scipy to use the system path to libstdc++.so instead of the one in anaconda. Error message looks like this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/stats/__init__.py", line 467, in <module>
    from ._stats_py import *
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/stats/_stats_py.py", line 46, in <module>
    from . import distributions
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/stats/distributions.py", line 8, in <module>
    from ._distn_infrastructure import (rv_discrete, rv_continuous, rv_frozen)
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/stats/_distn_infrastructure.py", line 24, in <module>
    from scipy import optimize
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/__init__.py", line 211, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/optimize/__init__.py", line 413, in <module>
    from ._linprog import linprog, linprog_verbose_callback
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/optimize/_linprog.py", line 21, in <module>
    from ._linprog_highs import _linprog_highs
  File "/home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/optimize/_linprog_highs.py", line 20, in <module>
    from ._highs._highs_wrapper import _highs_wrapper
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/jnshi/miniconda3/envs/casper-3d/lib/python3.9/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-39-x86_64-linux-gnu.so)

Steps to Reproduce Seems to happen in a Python 3.9 environment when you install scipy before teaserpp_python

MedericFourmy commented 1 year ago

I had the same error when running the teaser_python_ply.py example. Somehow, changing import orders with open3d solved the issue:

import open3d as o3d
import teaserpp_python

-> bug

import teaserpp_python
import open3d as o3d

-> OK