instructions
Many articles require that files under usr be changed, but I don’t have permission to do so through root. The article is divided into four parts, you can directly read the solution part.
The environment
Ubuntu16.04 + Anaconda3-2020.11 – Linux – x86_64. Sh (python3.8.5) + torch1.8.0 + torchvision0.9
conclusion
The scipy version is not compatible with the older version of GCC in Ubuntu. This is done by lowering the SCIPY version and setting the GCC version in anaconda.
An error
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so6.: version 'GLIBCXX_3. 4.22' not found (required by /data1/zhx/anaconda3/envs/ship/lib/python38./site-packages/scipy/fft/
_pocketfft/pypocketfft.cpython-38-x86_64-linux-gnu.so)
Copy the code
Have the process
I used the skimage.measure. Label function in my code, which indirectly calls the SCIpy package and therefore reports the error at the beginning of this article.
As mentioned in article [1], the sciPY version is too high, so the version is lowered. Just run the following command in anaconda’s environment.
conda install scipy==1.31.
Copy the code
However, after I run it, I will report a new error, as shown below:
scipy/special/_ufuncs.cpython-38-x86_64-linux-gnu.so: undefined symbol: _gfortran_stop_numeric_f08
Copy the code
I thought it was still wrong, so I re-installed the environment, but it was still wrong. I don’t know if it was a compiler problem, but it seems that SCIpy relies on the local compiler. Gcc5.4.0 (Ubuntu16.04, ubuntu server), gCC9.3.0 (Ubuntu20.04, localhost), localhost can run the server, so it is considered to be a local compiler problem. So I found the second reference [2] and changed GCC in my current environment. Then it’s ready to use.
To solve
- Generally, the sciPY version is high, which can be executed first
Conda install scipy = = 1.3.1
Conda will install and uninstall the original package itself. - If the error is reported later, the GCC version may be faulty. Change the GCC version in the current environment as described in [2].
I think just go to the current environment$conda create -n ship python=3.7 $conda activate shipInstall the latest GCC
(ship)yjys:~$ conda install -c conda-forge gcc_impl_linux-64
# to check the GCC
(ship)yjys:~$ gcc -v
GCC is still 4.8.5!!
Copy the code
Don’t worry, I need a link below. Check anconda3/envs/ship for the directory of GCC you just installed. It’s not in bin. Find it in libexec/ GCC /x86_64-conda-linux-gnu/11.2.0/ GCC
(the ship) yjys: ~ $ln -s/data1 / ZHX/anaconda3 envs/ship/libexec/GCC/x86_64 - conda - - the gnu/Linux 11.2.0 / GCC /data1/zhx/anaconda3/envs/ship/bin/gcc (ship)yjys:~$ conda install gcc_linux-64 (ship)yjys:~$ conda deactivate (ship)yjys:~$ conda activate mmdetection (ship)yjys:~$ gcc -vGCC 11.2.0!!
Copy the code
The effect
reference
[1] libstdc++ so.6: version ‘glibcxx_3.4.22’
[2] How to change anaconda GCC version? (Zhihu article entitled “Life is Short and Carpe dieu”)