使用MXNet出错:RuntimeError: implement_array_function method already has a docstring

踩坑:这是MXNet与 Numpy版本的兼容问题!

1、如果使用 pip install mxnet 命令直接安装,则默认安装的版本可能是mxnet:1.7.0.post2与numpy 1.16.6 (2024-6-20,Python3.8)

pip install mxnet

2、这时候可能弹出如下错误:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependenc
y conflicts.
matplotlib 3.5.2 requires numpy>=1.17, but you have numpy 1.16.1 which is incompatible.
opencv-python 4.7.0.72 requires numpy>=1.17.0; python_version >= "3.7", but you have numpy 1.16.1 which is incompatible.
opencv-python 4.7.0.72 requires numpy>=1.17.3; python_version >= "3.8", but you have numpy 1.16.1 which is incompatible.
scipy 1.10.1 requires numpy<1.27.0,>=1.19.5, but you have numpy 1.16.1 which is incompatible.
Successfully installed chardet-3.0.4 graphviz-0.8.4 idna-2.6 mxnet-1.6.0 numpy-1.16.1 requests-2.18.4 urllib3-1.22

这是告诉你,各个包对于numpy需求的版本不匹配了!搞半天...装不了一个匹配版本!

3、中间有一次安装提示如下:

ERROR: Could not find a version that satisfies the requirement mxnet==1.9.1 (from versions: 0.11.0, 0.12.0, 0.12.1, 1.0.0, 1.0.0.post1, 1.0.0.post3, 1.0.0.post4,
1.1.0.post0, 1.2.0, 1.2.1, 1.2.1.post1, 1.3.0, 1.3.1, 1.4.0, 1.4.0.post0, 1.4.1, 1.5.0, 1.6.0, 1.7.0.post1, 1.7.0.post2)
ERROR: No matching distribution found for mxnet==1.9.1

The conflict is caused by:
    The user requested numpy==1.22.3
    mxnet 1.7.0.post2 depends on numpy<1.17.0 and >=1.8.2

这是mxnet 1.7.0.post2 需要1.8.2 =< numpy<1.17.0,对比第2条,会发现根本就是冲突的!

4、最后,为了使用mxnet提取数据集图像,只能新建一个环境,新环境安装的包少,对numpy版本就没太多要求!安装完成后,随便用如下代码测试:

import mxnet as mx
a = mx.nd.ones((2, 3))
b = a * 2 + 1
print(b.asnumpy())

没问题就可以了。

但是,需要的其它包得珍重着安装了。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值