赞
踩
最近被坑死了,安装了CUDA10.1,安装了pytorch1.4版本,但是torch.cuda.is_available()返回false,
郁闷好久。。。。
zhenghan@zhenghan:~$ pip install torch==1.4.0+cu101 torchvision==0.5.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.4.0+cu101 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.4.1, 0.4.1.post2, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.2.0+cpu, 1.2.0+cu92, 1.3.0, 1.3.0+cpu, 1.3.0+cu100, 1.3.0+cu92, 1.3.1, 1.3.1+cpu, 1.3.1+cu100, 1.3.1+cu92, 1.4.0, 1.4.0+cpu, 1.4.0+cu100, 1.4.0+cu92, 1.5.0, 1.5.0+cpu, 1.5.0+cu101, 1.5.0+cu92)
ERROR: No matching distribution found for torch==1.4.0+cu101
最后重新安装CUDA10.0(安装过程看我之前的博客),注意的点是:
1 输入 accept 接受条款
2 输入n不安装nvidia图像驱动,之前已经安装过了 //此处一定要选择n!!!
3 输入y安装cuda 10.0工具
4 回车确认cuda默认安装路径:/usr/local/cuda-10.0
5 输入y用sudo权限运行安装,输入密码
6 输入y或者n安装或者不安装指向/usr/local/cuda的符号链接
7 输入y安装CUDA 10.0 Samples,以便后面测试
8 回车确认CUDA 10.0 Samples默认安装路径:
然后重新安装pytorch1.4版本,还是不行,大家不要试这个方法:
zhenghan@zhenghan:~/Software$ pip install torch==1.4.0+cu100 torchvision==0.5.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html Looking in links: https://download.pytorch.org/whl/torch_stable.html Collecting torch==1.4.0+cu100 Downloading https://download.pytorch.org/whl/cu100/torch-1.4.0%2Bcu100-cp37-cp37m-linux_x86_64.whl (723.9 MB) | | 860 kB 1.2 kB/s eta 7 days, 2:58:42ERROR: Exception: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 313, in recv_into return self.connection.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into self._raise_ssl_error(self._ssl, result) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 425, in _error_catcher yield File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 507, in read data = self._fp.read(amt) if not fp_closed else b"" File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read data = self.__fp.read(amt) File "/home/zhenghan/anaconda3/lib/python3.7/http/client.py", line 447, in read n = self.readinto(b) File "/home/zhenghan/anaconda3/lib/python3.7/http/client.py", line 491, in readinto n = self.fp.readinto(b) File "/home/zhenghan/anaconda3/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 328, in recv_into return self.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 328, in recv_into return self.recv_into(*args, **kwargs) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 328, in recv_into return self.recv_into(*args, **kwargs) [Previous line repeated 13 more times] File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 326, in recv_into raise timeout("The read operation timed out") socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in _main status = self.run(options, args) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper return func(self, options, args) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 333, in run reqs, check_supported_wheels=not options.target_dir File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve discovered_reqs.extend(self._resolve_one(requirement_set, req)) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement(req) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 469, in prepare_linked_requirement hashes=hashes, File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 259, in unpack_url hashes=hashes, File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url link, downloader, temp_dir.path, hashes File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 281, in _download_http_url for chunk in download.chunks: File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/progress_bars.py", line 166, in iter for x in it: File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_internal/network/utils.py", line 39, in response_chunks decode_content=False, File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream data = self.read(amt=amt, decode_content=decode_content) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 529, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/home/zhenghan/anaconda3/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/zhenghan/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 430, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='download.pytorch.org', port=443): Read timed out. zhenghan@zhenghan:~/Software$
我重新下载whl文件,https://download.pytorch.org/whl/torch_stable.html,下载好gpu版本之后(中间一路坎坷,注意得翻墙,有时候翻墙也下载到中途就断了。。。。。)
zhenghan@zhenghan:~/Software$ ls Anaconda3-5.0.1-Linux-x86_64.sh Anaconda3-5.3.1-Linux-x86_64.sh cuda cuda_10.0.130_410.48_linux.run cuda_10.1.105_418.39_linux.run cudnn-10.1-linux-x64-v7.6.5.32.tgz deepin.com.qq.im_9.1.8deepin0_i386.deb deepin.com.wechat_2.6.2.31deepin0_i386.deb deepin-wine-for-ubuntu google-chrome-stable_current_amd64.deb pycharm-2019.2.6 pytorch-1.4.0-cuda101py37h02f0884_0.tar.bz2 SunloginClient-10.0.2.24779_amd64.deb torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl torch-1.4.0-cp37-cp37m-manylinux1_x86_64.whl torch-1.4.0+cu100-cp37-cp37m-linux_x86_64.whl torch-1.4.0+cu100-cp37-cp37m-linux_x86_64.whl.1 torch-1.5.0-cp36-cp36m-manylinux1_x86_64.whl 永久激活 zhenghan@zhenghan:~/Software$ pip install torch-1.4.0+cu100-cp37-cp37m-linux_x86_64.whl -i https://mirrors.aliyun.com/pypi/simple Looking in indexes: https://mirrors.aliyun.com/pypi/simple Processing ./torch-1.4.0+cu100-cp37-cp37m-linux_x86_64.whl Installing collected packages: torch Attempting uninstall: torch Found existing installation: torch 1.4.0 Uninstalling torch-1.4.0: Successfully uninstalled torch-1.4.0 Successfully installed torch-1.4.0+cu100
zhenghan@zhenghan:~/Software$ pip install torchvision-0.5.0+cu100-cp37-cp37m-linux_x86_64.whl Processing ./torchvision-0.5.0+cu100-cp37-cp37m-linux_x86_64.whl Requirement already satisfied: torch==1.4.0 in /home/zhenghan/anaconda3/lib/python3.7/site-packages (from torchvision==0.5.0+cu100) (1.4.0+cu100) Requirement already satisfied: numpy in /home/zhenghan/anaconda3/lib/python3.7/site-packages (from torchvision==0.5.0+cu100) (1.15.1) Requirement already satisfied: six in /home/zhenghan/anaconda3/lib/python3.7/site-packages (from torchvision==0.5.0+cu100) (1.11.0) Requirement already satisfied: pillow>=4.1.1 in /home/zhenghan/anaconda3/lib/python3.7/site-packages (from torchvision==0.5.0+cu100) (5.2.0) Installing collected packages: torchvision Successfully installed torchvision-0.5.0+cu100 zhenghan@zhenghan:~/Software$ python Python 3.7.0 (default, Jun 28 2018, 13:15:42) [GCC 7.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> torch.cuda.is_available() False >>> import torchvision >>> exit(); zhenghan@zhenghan:~/Software$
但是仍然发现torch.cunda.is_available()仍然为false,这是为什么呢????
经过查找原因,还是驱动版本有些低
查了一下我的显卡驱动
zhenghan@zhenghan:~$ cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX x86_64 Kernel Module 390.132 Fri Nov 1 00:40:14 PDT 2019 GCC version: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) zhenghan@zhenghan:~$ ubuntu-drivers devices == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == modalias : pci:v000010DEd00001B06sv000010DEsd0000120Fbc03sc00i00 vendor : NVIDIA Corporation model : GP102 [GeForce GTX 1080 Ti] driver : nvidia-driver-390 - distro non-free driver : nvidia-driver-435 - distro non-free driver : nvidia-driver-440 - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin zhenghan@zhenghan:~$
确实,是自己的显卡驱动390不支持cuda10.0。。。。
好吧,更新驱动,万一害怕有风险。。。
还是默默的装cuda9.2,pytorch1.4 gpu版本吧。。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。