记录:ubuntu18.04 cuda11.7 +torch1.13.1安装apex时报错解决办法

git clone https://github.com/NVIDIA/apex
cd apex
# if pip >= 23.1 (ref: https://pip.pypa.io/en/stable/news/#v23-1) which supports multiple `--config-settings` with the same key... 
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
# otherwise
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./

NVIDIA/apex: A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch (github.com)按照官方安装步骤报错如下:

ModuleNotFoundError: No module named 'packaging'
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/huiwei/miniconda3/envs/earthformer/bin/python3 /home/huiwei/miniconda3/envs/earthformer/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpuel1iqe5
  cwd: /tmp/pip-req-build-7az4lcr7
  Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

解决办法:

https://github.com/NVIDIA/apex/issues/1737#issuecomment-1762662648

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是安装步骤: 1. 安装CUDA 8.0 首先,你需要下载CUDA 8.0安装包,可以在官网上下载或者使用以下命令: ``` wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run ``` 下载完成后,运行以下命令进行安装: ``` sudo sh cuda_8.0.61_375.26_linux-run ``` 安装过程中需要你进行一些选择,可以按照默认选项进行。 安装完成后,在`~/.bashrc`文件中添加以下环境变量: ``` export PATH=/usr/local/cuda-8.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH ``` 然后运行以下命令使配置生效: ``` source ~/.bashrc ``` 2. 安装cuDNN cuDNN是NVIDIA提供的深度学习库,可以加速深度学习的训练和推理过程。你需要先在官网上注册一个账号,然后才能下载cuDNN。 下载完成后,解压文件并将文件复制到CUDA安装路径下: ``` tar -xzvf cudnn-8.0-linux-x64-v6.0.tgz sudo cp -P cuda/include/cudnn.h /usr/local/cuda-8.0/include sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64/ sudo chmod a+r /usr/local/cuda-8.0/include/cudnn.h /usr/local/cuda-8.0/lib64/libcudnn* ``` 3. 安装TensorFlow 最后,你可以使用pip安装TensorFlow: ``` pip install tensorflow-gpu==1.3 ``` 如果你想使用CPU版本的TensorFlow,可以使用以下命令: ``` pip install tensorflow==1.3 ``` 安装完成后,你可以测试一下TensorFlow是否正常工作: ``` python import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello)) ``` 如果输出了`Hello, TensorFlow!`,那么TensorFlow就安装成功了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值