ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 221 forks source link

Segfault in numpy when importing libtiff #763

Open gnthibault opened 8 years ago

gnthibault commented 8 years ago

I installed libtiff from pip, and from source myself, using anaconda 2.7, and everytime I try to import it using import libtiff, I get a nasty segmentation fault.

I am on linux centOS, kernel build 3.10.0-327.13.1.el7.x86_64

My configuration:

conda info -a
Using Anaconda Cloud api site https://api.anaconda.org
Current conda install:

             platform : linux-64
        conda version : 4.0.5
  conda-build version : 1.20.0
       python version : 2.7.11.final.0
     requests version : 2.9.1
     root environment : /home/technic105/anaconda2  (writable)
  default environment : /home/technic105/anaconda2
     envs directories : /home/technic105/anaconda2/envs
        package cache : /home/technic105/anaconda2/pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/linux-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : None
    is foreign system : False

# conda environments:
#
root                  *  /home/technic105/anaconda2

sys.version: 2.7.11 |Anaconda 4.0.0 (64-bit)| (defaul...
sys.prefix: /home/technic105/anaconda2
sys.executable: /home/technic105/anaconda2/bin/python
conda location: /home/technic105/anaconda2/lib/python2.7/site-packages/conda
conda-build: /home/technic105/anaconda2/bin/conda-build
conda-convert: /home/technic105/anaconda2/bin/conda-convert
conda-develop: /home/technic105/anaconda2/bin/conda-develop
conda-env: /home/technic105/anaconda2/bin/conda-env
conda-index: /home/technic105/anaconda2/bin/conda-index
conda-inspect: /home/technic105/anaconda2/bin/conda-inspect
conda-metapackage: /home/technic105/anaconda2/bin/conda-metapackage
conda-pipbuild: /home/technic105/anaconda2/bin/conda-pipbuild
conda-server: /home/technic105/anaconda2/bin/conda-server
conda-sign: /home/technic105/anaconda2/bin/conda-sign
conda-skeleton: /home/technic105/anaconda2/bin/conda-skeleton
user site dirs: 

CIO_TEST: <not set>
CONDA_DEFAULT_ENV: <not set>
CONDA_ENVS_PATH: <not set>
LD_LIBRARY_PATH: <not set>
PATH: /usr/local/cuda/bin:/home/technic105/anaconda2/bin:/usr/local/cuda/bin:/home/technic105/anaconda2/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/technic105/.local/bin:/home/technic105/bin
PYTHONHOME: <not set>
PYTHONPATH: <not set>

WARNING: could not import _license.show_info
# try:
# $ conda install -n root _license

Output when using gdb:

gdb python
(gdb) r -c "import libtiff"
Starting program: /home/technic105/anaconda2/bin/python -c "import libtiff"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /home/technic105/anaconda2/lib/python2.7/site-packages/numpy/core/../../../../libiomp5.so
Detaching after fork from child process 26774.

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeff51de0 in PyArray_API () from /home/technic105/anaconda2/lib/python2.7/site-packages/numpy/core/multiarray.so
Missing separate debuginfos, use: debuginfo-install libgcc-4.8.5-4.el7.x86_64

Is it a bug, or is there something I am doing wrong ?

Thank you in advance

groutr commented 8 years ago

Do you still get the segfault when you use libtiff from our conda repos? conda install libtiff You'll probably need to remove your custom-compiled version of libtiff.

gnthibault commented 8 years ago

Thank you for your answer, I receive [SSL: CERTIFICATE_VERIFY_FAILED] when trying to use conda, how can I overcome that problem, I would like to disable ssl certificate checking ?

EDIT: ok the faq covers this problem: https://docs.continuum.io/anaconda-repository/faq

And... the result is exactly the same, importing libtiff generates a segmentation fault on my setup, and gdb reveals that the segfault arise in the same place than previously.

anemes commented 8 years ago

I encounter the same problem with linux conda 3.14.1

             platform : linux-64
        conda version : 3.14.1
  conda-build version : 1.14.1
       python version : 2.7.10.final.0
     requests version : 2.7.0
     root environment : /software/2015/x86_64/anaconda/2.3.0  (read only)
  default environment : /mnt/lib/python2.7/conda/envs/safl
     envs directories : /home/nemesa/.conda/envs
                        /home/nemesa/envs
                        /software/2015/x86_64/anaconda/2.3.0/envs
        package cache : /home/nemesa/.conda/envs/.pkgs
                        /home/nemesa/envs/.pkgs
                        /software/2015/x86_64/anaconda/2.3.0/pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/linux-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : None
    is foreign system : False

with a python2.7.12 install with latest numpy=1.11.1 libtiff=0.4.4

(gdb) r -c "import libtiff"
Starting program: /bin/python -c "import libtiff"
[Thread debugging using libthread_db enabled]
Missing separate debuginfo for /mnt/lib/python2.7/site-packages/numpy/core/../../../../libiomp5.so
Detaching after fork from child process 28514.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff1211e20 in PyArray_API ()
   from /mnt/lib/python2.7/site-packages/numpy/core/multiarray.so
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.el6_7.7.x86_64 libgcc-4.4.7-11.el6.x86_64 libjpeg-turbo-1.2.1-3.el6_5.x86_64 libtiff-3.9.4-10.el6_5.x86_64

The conda install libtiff command states libtiff is already installed (i think conda install sources the C library?), so to install pylibtiff you have to use pip install libtiff.

The error is the same if cloned and installed from github. non-conda virtualenv python2.7 with same version numbers works fine.

gnthibault commented 8 years ago

I still have this problem, and it prevents me from using anaconda... It is really a shame because all other tools packaged into it are really powerfull.

But As I can't even load my data I can't use any through anaconda.

With the hope that someone from ContinuumIO take a look at this, here is the backtrace I get with gdb:

Program received signal SIGSEGV, Segmentation fault. 0x00007fffeff3ede0 in PyArray_API () from /home/user/anaconda2/lib/python2.7/site-packages/numpy/core/multiarray.so Missing separate debuginfos, use: debuginfo-install libgcc-4.8.5-4.el7.x86_64 (gdb) bt

0 0x00007fffeff3ede0 in PyArray_API () from /home/user/anaconda2/lib/python2.7/site-packages/numpy/core/multiarray.so

1 0x00007fffe75a6464 in _import_array ()

at /home/user/anaconda2/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1673

2 inittif_lzw () at libtiff/src/tif_lzw.c:1308

3 0x00007ffff7af5fa5 in _PyImport_LoadDynamicModule (name=0xa6ba30 "libtiff.tif_lzw",

pathname=0xa6ca40 "/home/user/anaconda2/lib/python2.7/site-packages/libtiff/tif_lzw.so", fp=<optimized out>) at ./Python/importdl.c:53

4 0x00007ffff7af4621 in import_submodule (mod=0x7ffff7e97a98, subname=0xa6ba38 "tif_lzw", fullname=0xa6ba30 "libtiff.tif_lzw")

at Python/import.c:2722

5 0x00007ffff7af4894 in load_next (mod=0x7ffff7e97a98, altmod=0x7ffff7d92b50 <_Py_NoneStruct>, p_name=,

buf=0xa6ba30 "libtiff.tif_lzw", p_buflen=0x7fffffffc130) at Python/import.c:2537

6 0x00007ffff7af4ec0 in import_module_level (level=, fromlist=0x7ffff7d92b50 <_Py_NoneStruct>, locals=,

globals=<optimized out>, name=0x0) at Python/import.c:2246

7 PyImport_ImportModuleLevel (name=, globals=, locals=,

fromlist=0x7ffff7d92b50 <_Py_NoneStruct>, level=<optimized out>) at Python/import.c:2310

8 0x00007ffff7ad487f in builtin_import (self=, args=, kwds=) at Python/bltinmodule.c:49

9 0x00007ffff7a2adc3 in PyObject_Call (func=0x7ffff7fcdfc8, arg=, kw=) at Objects/abstract.c:2546

10 0x00007ffff7ad4d63 in PyEval_CallObjectWithKeywords (func=0x7ffff7fcdfc8, arg=0x7fffe7c3e890, kw=) at Python/ceval.c:4219

11 0x00007ffff7ad99f6 in PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2622

12 0x00007ffff7adf1ce in PyEval_EvalCodeEx (co=0x7fffe7c38f30, globals=, locals=, args=,

argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3582

13 0x00007ffff7adf2e2 in PyEval_EvalCode (co=, globals=, locals=) at Python/ceval.c:669

14 0x00007ffff7af1122 in PyImport_ExecCodeModuleEx (name=0xa87290 "libtiff.tiff_sample_plane", co=0x7fffe7c38f30,

pathname=0xa82330 "/home/user/anaconda2/lib/python2.7/site-packages/libtiff/tiff_sample_plane.pyc") at Python/import.c:731

15 0x00007ffff7af386e in load_source_module (name=0xa87290 "libtiff.tiff_sample_plane",

pathname=0xa82330 "/home/user/anaconda2/lib/python2.7/site-packages/libtiff/tiff_sample_plane.pyc", fp=<optimized out>)
at Python/import.c:1121

16 0x00007ffff7af4621 in import_submodule (mod=0x7ffff7e97a98, subname=0xa87298 "tiff_sample_plane",

fullname=0xa87290 "libtiff.tiff_sample_plane") at Python/import.c:2722

17 0x00007ffff7af4894 in load_next (mod=0x7ffff7e97a98, altmod=0x7ffff7e97a98, p_name=,

buf=0xa87290 "libtiff.tiff_sample_plane", p_buflen=0x7fffffffc6d0) at Python/import.c:2537

18 0x00007ffff7af4ec0 in import_module_level (level=, fromlist=0x7fffe8584810, locals=,

globals=<optimized out>, name=0x0) at Python/import.c:2246

19 PyImport_ImportModuleLevel (name=, globals=, locals=, fromlist=0x7fffe8584810,

level=<optimized out>) at Python/import.c:2310

20 0x00007ffff7ad487f in builtin_import (self=, args=, kwds=) at Python/bltinmodule.c:49

21 0x00007ffff7a2adc3 in PyObject_Call (func=0x7ffff7fcdfc8, arg=, kw=) at Objects/abstract.c:2546

22 0x00007ffff7ad4d63 in PyEval_CallObjectWithKeywords (func=0x7ffff7fcdfc8, arg=0x7fffe8569d10, kw=) at Python/ceval.c:4219

23 0x00007ffff7ad99f6 in PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2622

ilanschnell commented 8 years ago

@gnthibault are you using the libtiff from conda or pip still?