简体   繁体   English

Anaconda ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found

[英]Anaconda ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found

I am getting the following import error when I am trying to run a Python script in a conda environment当我尝试在 conda 环境中运行 Python 脚本时出现以下导入错误

(squad) azada@scholar-fe00:~/Desktop/Toy-Problem-Team-2 $ python3 train.py 
Traceback (most recent call last):
  File "train.py", line 21, in <module>
    from tensorboardX import SummaryWriter
  File "/home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/tensorboardX/__init__.py", line 5, in <module>
    from .torchvis import TorchVis
  File "/home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/tensorboardX/torchvis.py", line 11, in <module>
    from .writer import SummaryWriter
  File "/home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/tensorboardX/writer.py", line 15, in <module>
    from .event_file_writer import EventFileWriter
  File "/home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/tensorboardX/event_file_writer.py", line 28, in <module>
    from .proto import event_pb2
  File "/home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/tensorboardX/proto/event_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/google/protobuf/descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/azada/miniconda3/envs/squad/lib/python3.6/site-packages/google/protobuf/pyext/_message.cpython-36m-x86_64-linux-gnu.so)

Writing the strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX编写strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX command has the following output strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX命令有以下 output

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH

As you can see the required libgcc version is not present.如您所见,所需的libgcc版本不存在。 But I am unable to understand why python is looking for GLIBCXX in the /usr directory?但我无法理解为什么 python 在/usr目录中寻找GLIBCXX

Running the same command on the libstdc++.so.6 of my anaconda environment shows that the required version is present in the file.在我的 anaconda 环境的libstdc++.so.6上运行相同的命令表明文件中存在所需的版本。

I am using my university's computing cluster so I don't have the admin rights.我正在使用我大学的计算集群,所以我没有管理员权限。

Is there any way that I can make Python use the libstdc++ of my conda environment instead of the one in the /usr directory?有什么方法可以让 Python 使用我的 conda 环境的libstdc++而不是/usr目录中的那个?

I spent a day working on this having encountered the same exact problem working on my research university's computing cluster with the same specs as you, and I finally found the right Stack Overflow thread .我花了一天的时间来解决这个问题,在我的研究型大学的计算集群上工作时遇到了与你相同的问题,我终于找到了正确的 Stack Overflow 线程 None of the above answers here work, unfortunately, but I can say with very high confidence that the details in the linked thread should solve your problem even though the source of the error traceback was different.不幸的是,上述答案都不起作用,但我可以非常自信地说,即使错误回溯的来源不同,链接线程中的细节也应该可以解决您的问题。

To summarize, you'll need to add the path to the lib folder in anaconda to LD_LIBRARY_PATH :总而言之,您需要将anacondalib文件夹的路径添加到LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/path/to/conda/env/lib

In my case, I just did:就我而言,我只是做了:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/anaconda3/lib

...and it worked like a charm! ......它就像一个魅力!

solve it by downgrading to libgcc==5.2.0通过降级到 libgcc==5.2.0 来解决它

Initially, try to install with pip but if you get the error: Could not download and compile the C core of igraph.. install it by conda最初,尝试使用 pip 安装,但如果出现错误:无法下载和编译 igraph 的 C 核心。通过conda安装

conda install -c conda-forge gcc conda install -c conda-forge gcc

This is because you have some old versions not cleaned up while upgrading gcc.这是因为您在升级 gcc 时没有清理一些旧版本。

  1. Find all your lib versions with find / -name "libstdc++.so*" .使用find / -name "libstdc++.so*"查找所有 lib 版本。 My latest version is 6.0.30.我的最新版本是 6.0.30。
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.29
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so
\/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so.6.0.29
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so.6.0
/opt/conda/lib/libstdc++.so.6
/opt/conda/envs/xxx/lib/libstdc++.so.6.0.30
/opt/conda/envs/xxx/lib/libstdc++.so.6
/opt/conda/pkgs/libgcc-7.2.0-h69d50b8_2/lib/libstdc++.so.6.0.21
/opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6.0.30
/opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6
/opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so
  1. Copy the file to the folder where you are working at and only have the old versions.将文件复制到您正在使用的文件夹中,并且只有旧版本。 /opt/conda/envs/xxx/lib/ or /opt/conda/lib /opt/conda/envs/xxx/lib//opt/conda/lib

For example, I'm working on /opt/conda/lib例如,我正在研究/opt/conda/lib

cp /opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6.0.30 /opt/conda/lib
  1. Remove the old files and link the latest lib.删除旧文件并链接最新的库。 Please repeat these steps for other folders.请对其他文件夹重复这些步骤。
cd /opt/conda/lib
rm libstdc++.so.6.0
ln -s libstdc++.so.6.0.30 libstdc++.so.6

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 /usr/lib/x86_64-linux-gnu/libstdc++.so.6: 找不到 TensorFlow 需要的版本“GLIBCXX_3.4.21” - /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found required by TensorFlow 导入错误:/usr/lib/aarch64-linux-gnu/libstdc++.so.6:找不到版本“GLIBCXX_3.4.30” - ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found 导入错误:/lib64/libstdc++.so.6:找不到版本“CXXABI_1.3.9” - ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found R 网状 libstdc++so GLIBCXX_3.4.21 未找到问题 - R reticulate libstdc++so GLIBCXX_3.4.21 not found issue ImportError:libstdc ++。so.6:找不到版本`GLIBCXX_3.4.20' - ImportError: libstdc++.so.6: version `GLIBCXX_3.4.20' not found 获取 ImportError /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version &#39;CXXABI_1.3.11&#39; not found - Getting ImportError /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version 'CXXABI_1.3.11' not found ImportError:/lib64/libc.so.6:导入张量流后找不到版本`GLIBC_2.15&#39; - ImportError: /lib64/libc.so.6: version `GLIBC_2.15' not found after importing tensorflow DLIB:导入错误:/usr/local/cuda/lib64/libcudnn.so.7:文件太短 - DLIB: ImportError: /usr/local/cuda/lib64/libcudnn.so.7: file too short 为什么找不到版本“GLIBCXX_3.4.28”(/usr/lib/libQt5Widgets.so.5 需要) - Why is version `GLIBCXX_3.4.28' not found (required by /usr/lib/libQt5Widgets.so.5) /lib64/libc.so.6:在 Aws Lambda 服务器中找不到版本“GLIBC_2.22” - /lib64/libc.so.6: version `GLIBC_2.22' not found in Aws Lambda Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM