News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

no datas

通过anaconda安装pytorch环境(避坑,经验向)

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.

1. Before choosing the CUDA version, you must know the highest version supported by your driver (you can skip it for non-Nvidia graphics cards)

The specific checking method is the win+R key combination, open the cmd command window, and enter the following command

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.

2. If the installation using Tsinghua source is unsuccessful, you can give up using Tsinghua source

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:

But a new problem arises, which is the third point.

3. Encountered Solving environment during the installation process: there is no way to do it all the time, and you can delete the -default in the .condarc file when you have been turning around!

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)

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! ! !



Category of website: technical article > Blog

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.

29 0
collect article
collected

Comment content: (supports up to 255 characters)