POT icon indicating copy to clipboard operation
POT copied to clipboard

pip install in conda env yields undefined symbol: _ZSt28__throw_bad_array_new_lengthv

Open alexisthual opened this issue 3 years ago • 2 comments

Package installation doesn't work in conda env and yields the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alexis/singbrain/repo/POT/ot/__init__.py", line 22, in <module>
    from . import lp
  File "/home/alexis/singbrain/repo/POT/ot/lp/__init__.py", line 22, in <module>
    from .emd_wrap import emd_c, check_result, emd_1d_sorted
ImportError: /home/alexis/singbrain/repo/POT/ot/lp/emd_wrap.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZSt28__throw_bad_array_new_lengthv

To Reproduce

Steps to reproduce the behavior:

  1. conda create -n pot python=3.7
  2. conda activate pot
  3. pip install .
  4. In a python prompt: import ot

Environment (please complete the following information):

  • OS: Ubuntu 21.10
  • Python version: 3.7
  • How was POT installed (source, pip, conda): pip

Output of the following code snippet:

import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import ot; print("POT", ot.__version__)
Linux-5.13.0-19-generic-x86_64-with-debian-11.0
Python 3.7.7 (default, Mar 26 2020, 15:48:22) 
[GCC 7.3.0]
NumPy 1.19.1
SciPy 1.5.2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alexis/singbrain/repo/POT/ot/__init__.py", line 22, in <module>
    from . import lp
  File "/home/alexis/singbrain/repo/POT/ot/lp/__init__.py", line 22, in <module>
    from .emd_wrap import emd_c, check_result, emd_1d_sorted
ImportError: /home/alexis/singbrain/repo/POT/ot/lp/emd_wrap.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZSt28__throw_bad_array_new_lengthv

From what I read, it could be that I am not using the right version of gcc, but it might be worth documenting here!

alexisthual avatar Apr 20 '22 09:04 alexisthual

Hell @alexisthual,

I think this bug may come from a local compilation of POT. Could you try to import ot not in the POT folder in your environment? It should work.

rflamary avatar Apr 20 '22 11:04 rflamary

I just started a python prompt from a different folder, imported ot and got the same error :open_mouth:

alexisthual avatar Apr 20 '22 11:04 alexisthual

Hello, do you still have the bug?

rflamary avatar Nov 22 '22 10:11 rflamary

Hi!

I just tried the same procedure again, and got a different error this time:

〉python
Python 3.7.15 (default, Nov  7 2022, 22:00:21) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alexis/singbrain/repo/POT/ot/__init__.py", line 22, in <module>
    from . import lp
  File "/home/alexis/singbrain/repo/POT/ot/lp/__init__.py", line 22, in <module>
    from .emd_wrap import emd_c, check_result, emd_1d_sorted
ModuleNotFoundError: No module named 'ot.lp.emd_wrap'

alexisthual avatar Nov 22 '22 10:11 alexisthual

can you try the impoart from another folder? the cpp file is not compiled locally but if you are in thje POT repo it is trying to import the local version

rflamary avatar Nov 29 '22 12:11 rflamary

in anay case you should install with pîp install pot or diecrtly using the git url for master version

rflamary avatar Nov 29 '22 12:11 rflamary

can you try the impoart from another folder? the cpp file is not compiled locally but if you are in thje POT repo it is trying to import the local version

You are right, changing folders solved this issue! :heavy_check_mark:

alexisthual avatar Nov 30 '22 23:11 alexisthual

ok i'm closing this then, since pot need ompilation you should not import from the source unless you install it with developor compile with -inplace

rflamary avatar Dec 03 '22 22:12 rflamary