-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: libstdc++ issues / GLIBCXX
not found
#347
Comments
Thanks for the bug report! Some notes:
julia -e 'using Pkg; pkg"activate --temp"; pkg"add SymbolicRegression PyCall"; pkg"build PyCall"; pkg"precompile"' The result of this will help me debug further. There is a chance its some issue of PyCall.jl trying to talk to Python. |
Hey I am not sure if it's related but I am having problems installing Here's the logs where it seems to be failing
complete logs can be found here let me know if the issue is related or if I have gone wrong somewhere. Thank you! |
Okay I think this is related to a very nasty bug we have been working on for the past week at the intersection of conda-forge, PyCall.jl, and the new version of libstdcxx-ng in conda-forge. See, e.g., conda-forge/scipy-feedstock#238, conda-forge/pysr-feedstock#89, JuliaPy/PyCall.jl#1040, conda-forge/pysr-feedstock#90. Apologies for the delay in fixing this. Until the
conda create -n pysr pysr 'libstdcxx-ng<13' -c conda-forge |
@agbuckley @IamShubhamGupto it seems like the conda-forge build is working again (a temporary fix, but a fix nonetheless, until some upstream bugs are patched). Could you please re-install things and let me know how it goes? |
@MilesCranmer in the GitHub action, we just commented out the |
Hi @MilesCranmer , back to the original issue, I'm actually using Python 3.8 via the Software Collection: Py 3.6 is the system version of Py3 that we're specifically overriding, along with the compiler. Running again, here's the error message I get from the
This is the ABI version error I mentioned: it should be picking up the overloaded I'll try the manual Julia package installs now, to see if it is in the way |
It was looking positive: the manual Julia package installs worked fine using your line above. And all the PySR import and model setup (on the first example, copied in verbatim) works fine at the Python 3.8 REPL. But then failure again with the wrong library pickup when PySR's
So it does look like some mishandling of the environment via PyCall, picking up the system libs rather than the live environment's ones. Thanks. |
The part I don’t understand is that PyJulia/PyCall never try to load |
Ah, wait, I found this in the PyJulia docs: Error due to ``libstdc++`` version
When you use PyJulia with another Python extension, you may see an error
like :literal:`version `GLIBCXX_3.4.22' not found` (Linux) or
``The procedure entry point ... could not be located in the dynamic link library libstdc++6.dll``
(Windows). In this case, you might have observed that initializing
PyJulia first fixes the problem. This is because Julia (or likely its
dependencies like LLVM) requires a recent version of ``libstdc++``.
Possible fixes:
- Initialize PyJulia (e.g., by ``from julia import Main``) as early as
possible. Note that just importing PyJulia (``import julia``) does
not work.
- Load ``libstdc++.so.6`` first by setting environment variable
``LD_PRELOAD`` (Linux) to
``/PATH/TO/JULIA/DIR/lib/julia/libstdc++.so.6`` where
``/PATH/TO/JULIA/DIR/lib`` is the directory which has
``libjulia.so``. macOS and Windows likely to have similar mechanisms
(untested).
- Similarly, set environment variable ``LD_LIBRARY_PATH`` (Linux) to
``/PATH/TO/JULIA/DIR/lib/julia`` directory. Using
``DYLD_LIBRARY_PATH`` on macOS and ``PATH`` on Windows may work
(untested).
See: https://github.com/JuliaPy/pyjulia/issues/180,
https://github.com/JuliaPy/pyjulia/issues/223 Could you try those solutions? |
Unfortunately... $ python
Python 3.8.13 (default, Aug 16 2022, 12:16:29)
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysr
>>> pysr.julia_helpers.init_julia()
ERROR: Unable to load dependent library /home/ppe/a/abuckley/.julia/juliaup/julia-1.9.1+0.x64.linux.gnu/bin/../lib/julia/libjulia-internal.so.1
Message:/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/ppe/a/abuckley/.julia/juliaup/julia-1.9.1+0.x64.linux.gnu/bin/../lib/julia/libjulia-internal.so.1) I'm not quite sure what the issue is: the impression I got was that Julia commands standalone were correctly picking up the overloaded GCC8 libs (including |
Just noticed that that that import line appeared in the email version of your message, but not the one above. I guess you edited it. Importing |
The reason I edited it was because I realized the Can you try the from julia import Main at the same time as the |
If just setting It might just be that the Julia binary installed by
You mentioned you have gcc8 available so it might be okay. |
@agbuckley would it be possible for you to provide an update on this issue? The conda version should be fixed now but I'm not sure what else is left for your libstdc++ issue. I've actually ran into this issue recently on our cluster computer. It happened out-of-the-blue which makes me think it was some system-wide library that got updated and messed up the linking. My solution was to just delete Julia and reinstall it (with juliaup) which seemed to identify the right libstdc++. |
Hey @agbuckley, Today I ran into a problem on my system that seemed to be identical to the one you experienced. I was able to fix it by adding: export LD_LIBRARY_PATH="/mnt/home/mcranmer/.julia/juliaup/julia-1.9.2+0.x64.linux.gnu/lib/julia/":$LD_LIBRARY_PATH to my shell rc file. Could you see if that fixes it for you? Cheers, @mkitti it seems like loading libjulia will not look in the corresponding |
Was |
I think it is set on different systems to the system libraries which might contain libstdc++ (but not libjulia). And therein lies the issue in that PyJulia/PyCall.jl finds the correct libjulia but not the matching libstdc++. Explicitly setting |
For example:
So I think we need a way of overriding |
There is no good solution here. Once someone sets We do this for BinaryBuilder dependencies, but there we have full control of the system. |
I ran into this issue myself the other day and had to look up this thread. I think it would be nice if PySR or PyJulia could automatically catch such an error and try to print of the debug guide. In particular both the Why can't we force linking to the For posterity I also found that |
GLIBCXX
not found
Also, could we by any chance have a command like: import os
os.environ["LD_PRELOAD"] += "~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/lib/julia/libstdc++.so.6" at the very top of That way we can help ensure that the correct shared library is always loaded. Edit: nevermind, this wouldn't work. Edit 2: I started another discussion in JuliaPy/PythonCall.jl#437 |
What is loading |
It seems to be scitkit learn. I’ll have a look at what library specifically |
I did this in shell.
Anyways, the problem is that the whoever built sklearn, linked it against the system. I'm guessing it was the Linux distribution which did this, and the Linux distribution is using a rather old libstdc++. |
Just to clarify I’m using a python virtual env, using the pyenv-provided Python (so I can build it with a shared library). The conda environment one works just fine for me as well. |
This should be fixed now (c.ref #561). Ping me if not. |
What happened?
Hi Miles, this is the issue flagged to you on Twitter -- sorry it's taken time to report, as I was drowning in exam meetings today!
The issue we saw was on a Centos7/RHEL system, which by default has Python 2.7 (or python3 = 3.6) and GCC 4.8.5 -- too old for much development these days. So we source installed RH software collections from
/opt/rh
to overload these system defaults with Python 3.8 and GCC8. Usually works fine, at least for straightforward Python, C++, and compilation between them using the tools found in the environment.But we hit a problem when installing PySR.
juliaup
install worked fine, but thepython3 -m pysr install
command failed with aGCLIBCXX_*
version-symbol mismatch: usually the indication of a mismatch between the active compiler and the C++ stdlib being linked against. (I'm afraid I don't have the direct terminal printouts handy: this happened yesterday when installing for a student, and we closed the terminal and moved on with installation on his Windows laptop.) Above the error message we could see the compile/link command explicitly using the systemlibstdc++
rather than the override from/opt/rh
(e.g./opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so
) -- again, I can provide the full output later if useful.Seems to me that something in the
pysr
install code is not picking up the overloaded compiler/stdlib locations, maybe assuming that the system ones are valid. It'd be best to query the appropriate ones from the environment, but maybe there is a way around like exporting library-path variables while running the installer? Thanks!Version
Latest from pip
Operating System
Linux
Package Manager
pip
Interface
Script (i.e.,
python my_script.py
)Relevant log output
Extra Info
No response
The text was updated successfully, but these errors were encountered: