导入mxnet报Segmentation fault: 11

  1. 前几天的时候还可以正常导入,正常运行代码。

  2. 之前mxnet是1.1版本,卸载重装后1.3版本仍旧报错。

  3. 目前尝试过的方法有

    • 卸载重装。目前无法定位错误原因,google搜到的类似问题也比较少,不知如何解决。

    • pip install h5py==2.8.0rc1,来自问题Mac 安装完mxnet后,每次import的时候会出现这个问题

      只解决了报段错误前的from ._conv import register_converters as _register_converters的这个错误。

  4. 以下是我的报错信息

>>> import mxnet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mxnet'
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
[root@s3-aidc-dl-prod-01 ~]# pip install mxnet
Collecting mxnet
  Downloading https://files.pythonhosted.org/packages/f0/2e/b26eb7273aed1945f59993b3b306442eb41684f931b5380821c39cf50a31/mxnet-1.3.1-py2.py3-none-manylinux1_x86_64.whl (27.1MB)
    100% |████████████████████████████████| 27.1MB 1.7MB/s
Requirement already satisfied: numpy<1.15.0,>=1.8.2 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from mxnet) (1.14.6)
Requirement already satisfied: requests>=2.20.0 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from mxnet) (2.21.0)
Requirement already satisfied: graphviz<0.9.0,>=0.8.1 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from mxnet) (0.8.4)
Requirement already satisfied: certifi>=2017.4.17 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from requests>=2.20.0->mxnet) (2018.11.29)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from requests>=2.20.0->mxnet) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from requests>=2.20.0->mxnet) (1.22)
Requirement already satisfied: idna<2.9,>=2.5 in /data1/jupyterhub/anaconda3/lib/python3.6/site-packages (from requests>=2.20.0->mxnet) (2.6)
Installing collected packages: mxnet
Successfully installed mxnet-1.3.1
[root@s3-aidc-dl-prod-01 ~]# python3
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mxnet
/data1/jupyterhub/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

Segmentation fault: 11
1赞

尝试pip安装几个不用版本的mxnet,均报同样的错误。
改用conda安装,报了 anaconda3/bin/…/lib/libstdc++.so.6: version `GLIBCXX_3.4.22’ not found,相对之前的段错误,这个至少有些错误信息,方便解决。

关于libstdc++.so.6: version `GLIBCXX_3.4.20’ not found问题解决

按照上面的方法,但是本地没有找到找到4.22的版本,有4.19,4.24其他的,也是蛋疼。更新了centos的一些报,依旧报错。

以下似乎是官方的一些问题集锦,备用一下
gcc-gnu-Frequently Asked Questions

接上一个问题,按照下面这个博客的方法找到了3.4.22版本
解决libstdc++.so.6: version `GLIBCXX_3.4.22’ not found

在如下地方找到,各位可以参考一下

strings /data1/jupyterhub/anaconda3/envs/gluon/lib/lib* | egrep GLIBCXX_3.4.22

后面的解决方案是

# 跳到anaconda3库文件的地方
cd /data1/jupyterhub/anaconda3/bin/../lib/

# 查看原先的文件
ll libstdc++.so.6

# 删除该文件
rm libstdc++.so.6

# 找到另一个6.0.25的版本,建立软连接,搞定
ln /data1/jupyterhub/anaconda3/envs/gluon/lib/libstdc++.so.6.0.25 libstdc++.so.6

其实这边应该可以用4.24的来替代!

我用mxnet-cuda90 版本,就不再报错了