python - tensorflow-gpu 安装在 ubuntu 18 上失败“InvalidArchiveError('存档错误 /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0.tar.bz2。”
问题描述
我正在尝试在启用 GPU 的 ubuntu 18 机器上安装 tensorflow GPU。我安装了 Nvidia 驱动程序并为 python 和 tensorflow 使用 anaconda 环境。当我尝试安装 tansorflow-gpu 时,
conda install -c anaconda tensorflow-gpu
安装失败并出现以下错误
InvalidArchiveError('Error with archive /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0.tar.bz2. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nCou
ld not unlink')
较大的堆栈跟踪如下
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/recipe/build.py. Please remove this file manually (you
may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/recipe/.gitignore. Please remove this file manually (y
ou may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/recipe/LICENSE. Please remove this file manually (you
may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/recipe/meta.yaml.template. Please remove this file man
ually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/recipe/run_test.py. Please remove this file manually (
you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/git. Please remove this file manually (you may need to
reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/hash_input.json. Please remove this file manually (you
may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/index.json. Please remove this file manually (you may
need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/about.json. Please remove this file manually (you may
need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/paths.json. Please remove this file manually (you may
need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/files. Please remove this file manually (you may need
to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(139): Could not remove or rename /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0/info/repodata_record.json. Please remove this file manually
(you may need to reboot to free file handles)
cudatoolkit-10.1.243 | 513.2 MB | ############################################################################################################################################################## | 100%
InvalidArchiveError('Error with archive /anaconda/pkgs/cudatoolkit-10.1.243-h6bb024c_0.tar.bz2. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nCou
ld not unlink')
(base) azure@sibi-ds-gpu-vm:~$ cudatoolkit-10.1.243 | 513.2 MB | #######################################################################################################################################
####################### | 100%
知道这意味着什么以及如何解决这个问题吗?
解决方案
使用 Anaconda 安装 TensorFlow-GPU
$ conda create -n tf_gpu python=3.6 # create new env, with name "tf"
$ pip install -U pip # ensure new version available
$ conda activate tf_gpu
$ pip install -U tensorflow
$ conda install -c anaconda cudatoolkit=10.1.243 cudnn=7.6.5 # install compatible CUDAtoolkit for your driver
$ pip install ipython
推荐阅读
- machine-learning - 用于图像分类的 Keras 模型做出相同的预测
- facebook - 如何在以编程方式发布到我的 Facebook 页面时克服新出现的 #200 错误?
- hyperledger-fabric - 为什么 channel.getPeers() 不返回所有对等点,而只返回其中一些?
- go - 如何在我的 golang 程序中运行二进制文件并通过发送一些输入并等待输出来保持与它的交互?
- http - 过于复杂或难以计算的请求的 HTTP 响应代码
- javascript - 使用 Javascript 使“无序列表”的行为类似于“有序列表”
- opengl - 如何使正字法文本始终显示/TopMost?
- javascript - 如何正确实现指针事件跟踪
- javascript - 创建具有不同文本的 DOM 元素
- nginx - 在 kubernetes Centos7 机器上设置 nginx 入口控制器