Using pip to install the torch module under windows, an error occurs:
ERROR: Command “python setup.py egg_info” failed with error code 1 in C:\Users\xxx\AppData\Local\Temp\pip-install-yqzlud5w\torch\
Method one
Try the reference article: https://mp.weixin.qq.com/s/u5uIjnABGXTJGo4Z3_dZQw
Specify the method of installing the package, and specify the installation package to install.
Method 2
Create an environment
Open the Anaconda prompt and enter:
conda create -n myroot python=3.5
myroot is the environment name defined by itself, corresponding to the python3.5 version.
Then enter:
activate myroot
Activate the environment.
pass:
python --version nvcc --version
Check out the python and cuda versions respectively.
Install pytorch
Choose to install GPU or CPU version according to the version of python and cuda:
#Install with conda 'conda,cuda8,python3.5': conda install pytorch -c pytorch 'conda,cuda9.0,python3.5': conda install pytorch cuda90 -c pytorch 'conda,cuda9.1,python3.5': conda install pytorch cuda91 'conda,cudanone,python3.5': conda install pytorch-cpu -c pytorch 'conda,cuda8,python3.6': conda install pytorch -c pytorch 'conda,cuda9.0,python3.6': conda install pytorch cuda90 -c pytorch 'conda,cuda9.1,python3.6': conda install pytorch cuda91 -c pytorch 'conda,cudanone,python3.6': conda install pytorch-cpu -c pytorch #install using pip 'pip,cudanone,python3.5': pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp35-cp35m-win_amd64.whl 'pip,cuda8,python3.5': pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.0-cp35-cp35m-win_amd64.whl 'pip,cuda9.0,python3.5': pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.0-cp35-cp35m-win_amd64.whl 'pip,cuda9.1,python3.5': pip3 install http://download.pytorch.org/whl/cu91/torch-0.4.0-cp35-cp35m-win_amd64.whl 'pip,cudanone,python3.6': pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-win_amd64.whl 'pip,cuda8,python3.6': pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.0-cp36-cp36m-win_amd64.whl 'pip,cuda9.0,python3.6': pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.0-cp36-cp36m-win_amd64.whl 'pip,cuda9.1,python3.6': pip3 install http://download.pytorch.org/whl/cu91/torch-0.4.0-cp36-cp36m-win_amd64.whl
Successful installation:
Learn more programming knowledge, please pay attention to my public number:
the way of code