(遇到问题)安装timm的时候torch版本被改变导致无法使用(未解决)

1 想运行PVT但是需要timm包

No module named 'timm'

2 pip install timm

但是运行遇到第二个问题

ImportError: cannot import name 'container_abcs' from 'torch._six' (/home/nk/anaconda3/envs/SINet-pytorch/lib/python3.7/site-packages/torch/_six.py)

3 查看了下torch 的版本

torch.__version__
1.9.1+cu102

4 参考下面博客说法,尝试降低下版本
pip install torch==1.8.1 torchvision

  1.cannot import name ‘container_abcs‘ from ‘torch._six‘_aigonna-CSDN博客问题描述:在导入torch或torchvision 中,由于torchvision与torch版本不匹配,torchvision无法导入,出现ImportError: cannot import name 'container_abcs' from 'torch._six' (/usr/local/lib/python3.7/dist-packages/torch/_six.py)解决方案:查看自己的版本torch.__version__,torchvision.__version__, 如1.9https://blog.csdn.net/weixin_39754630/article/details/119854333?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163263137316780262531504%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=163263137316780262531504&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-119854333.pc_search_all_es&utm_term=ImportError%3A+cannot+import+name+%27container_abcs%27+from+%27torch._six%27+&spm=1018.2226.3001.4187

5 再次运行发现驱动太老了

RuntimeError: The NVIDIA driver on your system is too old (found version 10000). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.

6 查看当前版本

torch.__version__
1.8.1+cu102

7 尝试安装torch==1.0

pip install torch==1.0 torchvision

但是不知道timm支不支持这个版本

出现下面说明

 timm和pytorch-lightning都需要1.4以上的torch版本,而cuda需要10.1才能安装1.4的torch。
而我的cuda是10.0的,因此只能重新安装cuda
用此指令查看cuda版本
cat /usr/local/cuda/version.txt

 

Guess you like

Origin blog.csdn.net/zjc910997316/article/details/120486539
Recommended