ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 223 forks source link

Compiler issue after conda update #7363

Closed amueller closed 6 years ago

amueller commented 6 years ago

I updated some packages (I think including glibc) and now I can't compile sklearn any more:

/home/andy/anaconda3/compiler_compat/ld: cannot find -lpthread

conda list output is here: https://pastebin.com/uNu1VjKF

mingwandroid commented 6 years ago

We do not provide a glibc (except in the sysroot or of new compiler packages).

Do you mean you updated some system packages?

mingwandroid commented 6 years ago

You are using a very fragile mix of old packages, new packages and pip packages. I recommend you use only new packages if possible.

Also please show the full output of your build.

amueller commented 6 years ago

Sorry, I meant glib. What are old packages vs new packages? I realized the naming scheme changed but I don't know what that means.... I'll provide the output of the compiler when I'm back at the machine but this is in the middle of some cython compilation. What are you looking for?

amueller commented 6 years ago

Full output here:

creating build/temp.linux-x86_64-3.6/sklearn/__check_build
compile options: '-I/home/andy/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/home/andy/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/home/andy/anaconda3/include/python3.6m -c'
gcc: sklearn/__check_build/_check_build.c
gcc -pthread -shared -B /home/andy/anaconda3/compiler_compat -L/home/andy/anaconda3/lib -Wl,-rpath=/home/andy/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/sklearn/__check_build/_check_build.o -Lbuild/temp.linux-x86_64-3.6 -o sklearn/__check_build/_check_build.cpython-36m-x86_64-linux-gnu.so
/home/andy/anaconda3/compiler_compat/ld: cannot find -lgcc_s
/home/andy/anaconda3/compiler_compat/ld: cannot find -lpthread
/home/andy/anaconda3/compiler_compat/ld: cannot find -lc
/home/andy/anaconda3/compiler_compat/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
/home/andy/anaconda3/compiler_compat/ld: cannot find -lgcc_s
/home/andy/anaconda3/compiler_compat/ld: cannot find -lpthread
/home/andy/anaconda3/compiler_compat/ld: cannot find -lc
/home/andy/anaconda3/compiler_compat/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
error: Command "gcc -pthread -shared -B /home/andy/anaconda3/compiler_compat -L/home/andy/anaconda3/lib -Wl,-rpath=/home/andy/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/sklearn/__check_build/_check_build.o -Lbuild/temp.linux-x86_64-3.6 -o sklearn/__check_build/_check_build.cpython-36m-x86_64-linux-gnu.so" failed with exit status 1
Makefile:24: recipe for target 'inplace' failed
make: *** [inplace] Error 1

I did a "conda update --all" hoping that would resolve the mixing of packages, though I don't think it did. New output of conda list here: https://pastebin.com/ekU6n0wy

amueller commented 6 years ago

did a completely clean environment, exactly the same result.

ca-certificates           2017.08.26           h1d4fec5_0  
certifi                   2017.11.5        py35h9749603_0  
cycler                    0.10.0           py35hc4d5149_0  
dbus                      1.10.22              h3b5a359_0  
decorator                 4.1.2            py35h3a268aa_0  
expat                     2.2.5                he0dffb1_0  
fontconfig                2.12.4               h88586e7_1  
freetype                  2.8                  hab7d2ae_1  
glib                      2.53.6               h5d9569c_2  
gst-plugins-base          1.12.2               he3457e5_0  
gstreamer                 1.12.2               h4f93127_0  
icu                       58.2                 h9c2bf20_1  
intel-openmp              2018.0.0             h15fc484_7  
ipykernel                 4.6.1            py35h29d130c_0  
ipython                   6.2.1            py35hd850d2a_1  
ipython_genutils          0.2.0            py35hc9e07d0_0  
jedi                      0.10.2           py35hc33c70f_0  
jpeg                      9b                   h024ee3a_2  
jupyter_client            5.1.0            py35h2bff583_0  
jupyter_core              4.4.0            py35ha89e94b_0  
libedit                   3.1                  heed3624_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 7.2.0                h7cc24e2_2  
libgfortran-ng            7.2.0                h9f7466a_2  
libpng                    1.6.32               hbd3595f_4  
libsodium                 1.0.15               hf101ebd_0  
libstdcxx-ng              7.2.0                h7a57d05_2  
libxcb                    1.12                 hcd93eb1_4  
libxml2                   2.9.4                h2e8b1d7_6  
matplotlib                2.1.0            py35h2cbf27e_0  
mkl                       2018.0.0             hb491cac_4  
ncurses                   6.0                  h9df7e31_2  
numpy                     1.13.3           py35hd829ed6_0  
openssl                   1.0.2m               h26d622b_1  
pcre                      8.41                 hc27e229_1  
pexpect                   4.2.1            py35h8b56cb4_0  
pickleshare               0.7.4            py35hd57304d_0  
pip                       9.0.1            py35h7e7da9d_4  
prompt_toolkit            1.0.15           py35hc09de7a_0  
ptyprocess                0.5.2            py35h38ce0a3_0  
pygments                  2.2.0            py35h0f41973_0  
pyparsing                 2.2.0            py35h041ed72_1  
pyqt                      5.6.0            py35h0e41ada_5  
python                    3.5.4               h417fded_24  
python-dateutil           2.6.1            py35h90d5b31_1  
pytz                      2017.3           py35hb13c558_0  
pyzmq                     16.0.2           py35h4be1f71_2  
qt                        5.6.2               h974d657_12  
readline                  7.0                  ha6073c6_4  
scipy                     1.0.0            py35hcbbe4a2_0  
setuptools                36.5.0           py35ha8c1747_0  
simplegeneric             0.8.1            py35h2ec4104_0  
sip                       4.18.1           py35h9eaea60_2  
six                       1.11.0           py35h423b573_1  
sqlite                    3.20.1               hb898158_2  
tk                        8.6.7                hc745277_3  
tornado                   4.5.2            py35hf879e1d_0  
traitlets                 4.3.2            py35ha522a97_0  
wcwidth                   0.1.7            py35hcd08066_0  
wheel                     0.30.0           py35hd3883cf_1  
xz                        5.2.3                h55aa19d_2  
zeromq                    4.2.2                hbedb6e5_2  
zlib                      1.2.11               ha838bed_2 
msarahan commented 6 years ago

These are the new tools that @mingwandroid is referring to: https://www.anaconda.com/blog/developer-blog/utilizing-the-new-compilers-in-anaconda-distribution-5/

We have tried to put in compatibility shims so that older compilers still work, but it's a pretty big game of whack-a-mole. If you can adjust your recipes to use conda-build 3 and the new compilers, we think you'll have a much easier time. You might also benefit from increased performance.

amueller commented 6 years ago

what recipes? I'm not trying to build a conda package, I'm just trying to compile the library.

amueller commented 6 years ago

So I should install the new compiler packages in the environment?

amueller commented 6 years ago

that did not help. To clarify, I'm running python setup.py build_ext -i or pip install -e .

or more specifically

gcc -pthread -shared -B /home/andy/anaconda3/envs/clean_python36/compiler_compat -L/home/andy/anaconda3/envs/clean_python36/lib -Wl,-rpath=/home/andy/anaconda3/envs/clean_python36/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/sklearn/__check_build/_check_build.o -Lbuild/temp.linux-x86_64-3.6 -o sklearn/__check_build/_check_build.cpython-36m-x86_64-linux-gnu.so
jjhelmus commented 6 years ago

What OS is this occurring on? My best guess is that the sysroot is not set correctly in the shim config file.

msarahan commented 6 years ago

If you install our compilers, you need to also make sure that you are activating the root environment where the compilers are installed. These are pseudo-cross compilers, isolated from your system sysroot, and setting environment variables is key to them working. Activating the env is how you set these env vars. Check that CC and CFLAGS are set after activating the env, you'll see.

amueller commented 6 years ago

here's conda info

> conda info               
Current conda install:

               platform : linux-64
          conda version : 4.3.30
       conda is private : False
      conda-env version : 4.3.30
    conda-build version : 3.0.30
         python version : 3.6.3.final.0
       requests version : 2.18.4
       root environment : /home/andy/anaconda3  (writable)
    default environment : /home/andy/anaconda3/envs/clean_python36
       envs directories : /home/andy/anaconda3/envs
                          /home/andy/.conda/envs
          package cache : /home/andy/anaconda3/pkgs
                          /home/andy/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /home/andy/.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.3 Linux/4.10.0-38-generic debian/stretch/sid glibc/2.24    
                UID:GID : 1000:1000
amueller commented 6 years ago

ah, needed to deactivate the currently active environment and reactivate to get the environment variables.

jjhelmus commented 6 years ago

Odd, I'm not getting the -Wl,--sysroot=/ linker flags when I tried to replicate this:

building 'sklearn.__check_build._check_build' extension
compiling C sources
C compiler: gcc -pthread -B /home/jhelmus/anaconda3/envs/am/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC

creating build/temp.linux-x86_64-3.5/sklearn/__check_build
compile options: '-I/home/jhelmus/anaconda3/envs/am/lib/python3.5/site-packages/numpy/core/include -I/home/jhelmus/anaconda3/envs/am/lib/python3.5/site-packages/numpy/core/include -I/home/jhelmus/anaconda3/envs/am/include/python3.5m -c'
gcc: sklearn/__check_build/_check_build.c
gcc -pthread -shared -L/home/jhelmus/anaconda3/envs/am/lib -B /home/jhelmus/anaconda3/envs/am/compiler_compat -Wl,-rpath=/home/jhelmus/anaconda3/envs/am/lib,--no-as-needed build/temp.linux-x86_64-3.5/sklearn/__check_build/_check_build.o -Lbuild/temp.linux-x86_64-3.5 -o sklearn/__check_build/_check_build.cpython-35m-x86_64-linux-gnu.so
building 'sklearn.cluster._hierarchical' extension
amueller commented 6 years ago

(this is on Ubuntu 17.10, I have faith that it'll run through now with the correct environment variables)

amueller commented 6 years ago

works, thanks for your help :)

jjhelmus commented 6 years ago

If that doesn't work the output from python -c "import sysconfig; print(sysconfig.get_config_var('LDFLAGS'))" would be helpful.

amueller commented 6 years ago

It would be great if there was some way to point to the fact that you have to install these packages and activate your environment if you update conda. I'm pretty sure many people will run into this, because conda update conda will break their setup.

msarahan commented 6 years ago

conda update conda should definitely not break this. conda update --all has a higher chance of breaking things.

I think the general message is "if you're compiling against our libraries, you probably need to use our compilers." We'll talk about how to best publish that info. It's pretty hard to tell people this kind of detailed information when they're not looking for it.

amueller commented 6 years ago

Hmm possibly it was me trying to install matplotlib 2.1 that broke it. But I appreciate that it's really hard to provide this information in the right way. Not knowing that you just changed compilers I wasn't sure what to Google.

Sent from phone. Please excuse spelling and brevity.

On Nov 21, 2017 18:20, "Mike Sarahan" notifications@github.com wrote:

conda update conda should definitely not break this. conda update --all has a higher chance of breaking things.

I think the general message is "if you're compiling against our libraries, you probably need to use our compilers." We'll talk about how to best publish that info. It's pretty hard to tell people this kind of detailed information when they're not looking for it.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ContinuumIO/anaconda-issues/issues/7363#issuecomment-346193324, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbcFkmKzKo14IoBfF_2n26gB-x3e2Crks5s41q5gaJpZM4QibGH .

mingwandroid commented 6 years ago

Failure to link to libpthread indicates you do not have some system development libraries present. What OS are you running?

amueller commented 6 years ago

@mingwandroid well I didn't have the conda compilers installed at all when I ran into the failure. I'm running Ubuntu 17.10

zhfwyy commented 6 years ago

I have the same problem with you ,have you solve it? Than you very much /home/wyy/anaconda3/compiler_compat/ld: cannot find -lm /home/wyy/anaconda3/compiler_compat/ld: cannot find -lpthread /home/wyy/anaconda3/compiler_compat/ld: cannot find -lc collect2: error: ld returned 1 exit status Options: {'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False} Include directories: ['/usr/local/cuda/include'] Library directories: ['/usr/local/cuda/lib64'] Cannot build a stub file. Original error: command 'g++' failed with exit status 1

amueller commented 6 years ago

@zhfwyy you need to install the conda compilers as described in https://www.anaconda.com/blog/developer-blog/utilizing-the-new-compilers-in-anaconda-distribution-5/

YongyiTang92 commented 6 years ago

@amueller How can I actually install the conda compilers? I have a hard time to figure it out.

amueller commented 6 years ago

that post lists the packages...

robbymeals commented 6 years ago

@amueller maybe it makes sense to add this info to the scikit-learn contributing docs under how to build and install dev code under conda or something?

amueller commented 6 years ago

@robbymeals PR welcome but first https://github.com/scikit-learn/scikit-learn/pull/10698