Reputation: 899
I am trying to import librosa
, but I am thrown with this error:
/home/lakshya/anaconda3/envs/tff_env/lib/python3.9/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/lakshya/anaconda3/envs/tff_env/lib/python3.9/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-39-x86_64-linux-gnu.so)
I tried the following to fix it based on the other similar questions that I browsed through:
sudo apt-get install libstdc++6
It's output: libstdc++6 is already the newest version (10.2.1-6).
sudo apt-get dist-upgrade
It's output: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
It's output: GLIBCXX version up to GLIBCXX_3.4.28
conda install libgcc
in my virtual env "tff_env"
It's output: libgcc-7.2.0 installed in tff_env
Pip installed the libgcc package in the virtual environment as well. Didn't work.
What can I do?
My OS: Debian GNU/Linux 11 (bullseye)
Upvotes: 61
Views: 112800
Reputation: 41
conda list|grep libstdcxx-ng
# libstdcxx-ng 14.1.0 hc0a3c3a_0 conda-forge
pip list|grep scipy
# scipy 1.14.0
I found that my scipy was behind libstdcxx-ng by one small version, when I ran pip install scipy --upgrade
to upgrade to 1.14.1
, the error disappeared
Upvotes: 0
Reputation: 1
None of the other answers worked for me, but this solved the problem:
import torch
The line is to add in top of file.
Upvotes: 0
Reputation: 1
In some cases, there exist multiple installations of glibcxx and runtime your app wants to connect to it but finds the library in the wrong place. It can be solved by changing the imported libraries' order. The problem has been solved by importing librosa on top of the running script.
Upvotes: 0
Reputation: 321
None of the above answers worked for me, unfortunately. What I ended up doing was to manually inspect the libstdc++.so.6
file.
First, I checked the system file, and it returned nothing on my side:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.30
Then, I took a look the conda file, and it was there:
strings /path-to-your-conda/envs/your-env-name/lib/libstdc++.so.6 | grep GLIBCXX_3.4.30
This indicates that the simple solution is to append the path to the conda file to the LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=/path-to-your-conda/envs/your-env-name/lib:$LD_LIBRARY_PATH
Upvotes: 21
Reputation: 12992
I had the same conditions as the original poster and the accepted answer didn't work as conda
was taking forever. I tried down-versioning scipy
from 1.9.3
to 1.9.1
and it did work.
You can use the following command to do so:
conda install -c anaconda scipy==1.9.1
Upvotes: 15
Reputation: 35
None of the other answers worked for me. This did work though:
pip install scikit-build
Upvotes: 1
Reputation: 635
After my search on anaconda packages, I found only the package "libstdcxx" will substantially bring new "libstdc++.so.6" file to the conda environment (while "gcc", "gcc_linux-64", and "libgcc-ng" cannot). Thus, installing the following package can fix this problem for me.
conda install -c conda-forge libstdcxx-ng=12
PS: dfcorbin's answer conda install -c conda-forge gcc=12
not works for me.
Upvotes: 41
Reputation: 121
The soln given above doesn't work for me. I got it working by downgrading my scipy from 1.9.1 to 1.6.1.
Upvotes: 0
Reputation: 169
One solution that fixed this problem for while trying to run mujoco or mujoco-py was as follows
OSError: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not foundwhen starting ipython. For some reason this library isnt in the anaconda environments libstdc++.so.6. It is in the base ubuntu library. So link the anaconda version of this library back to the os version:
cd /home/ubuntu/anaconda3/envs/tensorflow_p36/lib
mv libstdc++.so.6 libstdc++.so.6.old
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
credits: https://bcourses.berkeley.edu/courses/1478831/pages/glibcxx-missing
Upvotes: 11
Reputation: 1086
Just been tackling a similar problem, it looks like you need to ensure you have the latest version of gcc. Running:
conda install -c conda-forge gcc=12.1.0
Fixed the error for me.
Upvotes: 97
Reputation: 899
So what worked for me was to manually remove Python3.10 which I had installed using make altinstall
and upgrade scipy to the latest version.
Upvotes: 2