Unable to build Cython components. Please make sure Cython is installed if the torch.hub

本文介绍了一种在使用torch.hub时遇到的错误及其解决办法。通过先安装h5py库,然后再安装Cython库,可以有效解决该问题。

在我使用torch.hub的时候报了如下一个错误:

 

解决方法:

参考:https://github.com/h5py/h5py/issues/535

先安装 h5py 再安装 Cython

pip install h5py
pip install Cython

 

遇到问题/home/lqx/anaconda3/envs/A/bin/python /home/lqx/桌面/OpenCastKit-master/OpenCastKit-master/train_graphcast.py /home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/hfai/nn/modules/fast_multihead_attention.py:64: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead. @torch.cuda.amp.custom_fwd(cast_inputs=torch.float32) /home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/hfai/nn/modules/fast_multihead_attention.py:488: FutureWarning: `torch.cuda.amp.custom_bwd(args...)` is deprecated. Please use `torch.amp.custom_bwd(args..., device_type='cuda')` instead. def backward(ctx, grad_output2, grad_weight): /home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/hfai/nn/modules/hf_norm.py:23: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead. @torch.cuda.amp.custom_fwd(cast_inputs=torch.float32) /home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/hfai/nn/modules/hf_norm.py:57: FutureWarning: `torch.cuda.amp.custom_bwd(args...)` is deprecated. Please use `torch.amp.custom_bwd(args..., device_type='cuda')` instead. def backward(ctx, dy): 非集群环境 Traceback (most recent call last): File "/home/lqx/桌面/OpenCastKit-master/OpenCastKit-master/train_graphcast.py", line 11, in <module> import hfai.nccl.distributed as dist File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/hfai/nccl/distributed/__init__.py", line 13, in <module> import zmq File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/zmq/__init__.py", line 52, in <module> from zmq import backend File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/zmq/backend/__init__.py", line 30, in <module> raise original_error from None File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/zmq/backend/__init__.py", line 25, in <module> _ns = select_backend(first) File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/zmq/backend/select.py", line 31, in select_backend mod = import_module(name) File "/home/lqx/anaconda3/envs/A/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/zmq/backend/cython/__init__.py", line 6, in <module> from . import _zmq File "/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages/zmq/backend/cython/_zmq.py", line 34, in <module> raise ImportError(msg) ImportError: Attempting to import zmq Cython backend, which has not been compiled. This probably means you are importing zmq from its source tree. if this is what you want, make sure to do an in-place build first: pip install -e '/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages' If it is not, then '/home/lqx/anaconda3/envs/A/lib/python3.8/site-packages' is probably on your sys.path, when it shouldn't be. Is that your current working directory? If neither of those is true and this file is actually installed, something seems to have gone wrong with the install! Please report at https://github.com/zeromq/pyzmq/issues 进程已结束,退出代码为 1
最新发布
12-08
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值