no classification
no tag
no datas
posted on 2023-05-07 20:38 read(647) comment(0) like(29) collect(4)
In the past few days, due to some learning needs, it is necessary to install the pytorch environment. Although the detailed installation instructions on the blog are very detailed, after some actual measurements, I still stepped on a lot of pits, adhering to the idea that pits cannot be stepped on in vain , so there is this article. Below I will introduce some of my journey when installing pytorch.
The specific checking method is the win+R key combination, open the cmd command window, and enter the following command
nvidia-smi
As shown in the figure above, then we can see the highest supported version of CUDA supported by our current computer, and go to the pytorch official website ( https://pytorch.org/ ) to download it.
After opening, you will see the following screen:
It can be seen that because our computer can support up to CUDA version 12.0, both of these can be downloaded. If there is no suitable one, it is recommended to update your own driver (I just started using the driver that came with the computer when I bought it home, and the installation of the CPU version also failed). You can also find some installation tutorials in the blog, which contains Some installation commands of lower versions are also available.
At the beginning, I also followed the detailed installation instructions and used Tsinghua source to install pytorch. As a result, the error shown in the following figure appeared:
There is also this:
Such:
After trying a lot of solutions, none of them succeeded, so I tried to give up the Tsinghua source for installation and use the complete installation command on the official website. As shown below:
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
But a new problem arises, which is the third point.
When I don’t use the Tsinghua source, but use the complete installation command on the official website (the previous Tsinghua source can be deleted or not, which has no effect on the use of the complete installation command), although it is very slow, I finally successfully installed pytorch, using a lot The test methods have all passed, just after I thought the ordeal was finally over, but when running pycharm, I tried to call this pytorch, and found that it disappeared magically. . .
Go to anaconda to check the installation of pytorch, and then it fails again. . . I thought about trying again through the installation method that I just succeeded, but I was stuck in the Solving environment, and my ordeal began again.
I naively thought it was because my network was not good, and it would be fine after a while, so an hour passed. . .
Solution:
Open the .condarc file in "C:\Users\Your Username" (even if your anaconda is on the d drive, it is still automatically generated on the c drive) The command shown below, delete the Tsinghua source directly in it)
conda config --remove-key channels
Then open it with Notepad and delete the -default in it! ! ! (The Tsinghua source inside can be deleted or not)
Then directly use the complete installation command on the official website to re-install and it will be successful! ! !
Author:Sweethess
link:http://www.pythonblackhole.com/blog/article/380/e0e3d5de3e90b07f9a5f/
source:python black hole net
Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.
name:
Comment content: (supports up to 255 characters)
Copyright © 2018-2021 python black hole network All Rights Reserved All rights reserved, and all rights reserved.京ICP备18063182号-7
For complaints and reports, and advertising cooperation, please contact vgs_info@163.com or QQ3083709327
Disclaimer: All articles on the website are uploaded by users and are only for readers' learning and communication use, and commercial use is prohibited. If the article involves pornography, reactionary, infringement and other illegal information, please report it to us and we will delete it immediately after verification!