简体   繁体   中英

Installing Orange3 in Anaconda: Mismatching g++ and libstdc++

I'm running Fedora 25, which comes with gcc/g++/libstdc++ version 6.3.1. I'm also running Anaconda version 4.3.1, which comes with libstdc++ 6.0.19 .

When I install Orange3 under Anaconda (by saying "pip install orange3"), some files are compiled with Fedoras g++, but linked against Anacondas libstdc++:

Note the third line of the output:

$ ldd ~/anaconda3/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffe9b5a2000)
libpython3.6m.so.1.0 => /home/marhoy/anaconda3/lib/libpython3.6m.so.1.0 (0x00007efc3a6ef000)
libstdc++.so.6 => /home/marhoy/anaconda3/lib/libstdc++.so.6 (0x00007efc3a3d9000)
libm.so.6 => /lib64/libm.so.6 (0x00007efc3a0ad000)
libgcc_s.so.1 => /home/marhoy/anaconda3/lib/libgcc_s.so.1 (0x00007efc39e97000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007efc39c79000)
libc.so.6 => /lib64/libc.so.6 (0x00007efc398b1000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007efc396ad000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007efc394aa000)
librt.so.1 => /lib64/librt.so.1 (0x00007efc392a2000)
/lib64/ld-linux-x86-64.so.2 (0x000055a3c43d1000)

This causes problems, as there are differences between 6.3.1 and 6.0.19. So when I try to use the scatter-plot widget, I get:

_grid_density.cpython-36m-x86_64-linux-gnu.so: undefined symbol: __cxa_throw_bad_array_new_length

If I LD_PRELOAD Fedoras libstdc++, everything seems to work fine. And if I install Orange3 outside of Anaconda (by using pip3 install --user orange3), it also works.

The reason I'm not installing Orange3 from the conda repository is because it is outdated.

So: How can I make the Orange-files link against my Fedora libstdc++ ?

Why is _grid_density.cpython-36m-x86_64-linux-gnu.so picking up the libstdc++.so from ~/anaconda3/lib ? Because of RPATH:

(root)# chrpath -l /conda/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so
/conda/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so: RPATH=/conda/lib

I am guessing, you probably had the conda package libgcc installed and you didn't have the conda package gcc installed while installing Orange3 using pip. Hence the conflict.

You have the following options:

  1. Remove libgcc: conda remove -y libgcc
  2. Remove RPATH from the .so file

     (root)# chrpath -d /conda/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so (root)# chrpath -l /conda/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so /conda/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so: no rpath or runpath tag found. 
  3. Convert RPATH to RUNPATH :

     (root)# chrpath -c /conda/lib/python3.6/site-packages/Orange/widgets/utils/_grid_density.cpython-36m-x86_64-linux-gnu.so 

    So that you can later override it by doing:

     LD_LIBRARY_PATH=/lib64 /path/to/python/program 
  4. Build your own package.

I would strongly oppose option 2 or 3. You can do 1 only if there is no dependency on that package from other packages. The best solution is to do 4, or use conda-forge (as of now, it has v3.4.0).

$ pip uninstall Orange3
$ conda install -c conda-forge orange3

You can take a look at the recipe for orange3 at https://github.com/conda-forge/orange3-feedstock/tree/master/recipe , modify it for the latest version you want (v3.4.1) and upload it to your own channel on anaconda.org too!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM