I am trying to install pytorch version 1.6.0 using the conda environment in Pycharm.
I went through the official documentation for the installation of the same. I want to use the CPU version of Pytorch. Hence, I used the below-pasted command.
conda install pytorch==1.6.0 torchvision==0.7.0 cpuonly -c pytorch
Using this command, I got the below pasted response
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort. failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- pytorch==1.6.0 -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0|>=3.11,<3.12.0a0|3.9.16|3.8.16|3.9.10|3.8.12|3.7.12|3.7.10|3.7.10|3.6.12|3.7.9|3.6.12|3.6.9|3.6.9|3.6.9|3.6.9|3.4.*',build='2_73_pypy|4_73_pypy|5_73_pypy|1_73_pypy|0_73_pypy|0_73_pypy|5_73_pypy|3_73_pypy|1_73_pypy|0_73_pypy']
- pytorch==1.6.0 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']
- torchvision==0.7.0 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']
Your python: python=3.9
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package zlib conflicts for:
torchvision==0.7.0 -> pillow[version='>=4.1.1'] -> zlib[version='1.2.*|1.2.11|1.2.11.*|>=1.2.11,<1.3.0a0|>=1.2.12,<1.3.0a0|1.2.8|>=1.2.13,<1.3.0a0']
python=3.9 -> pypy3.9=7.3.11 -> zlib[version='>=1.2.11,<1.3.0a0|>=1.2.12,<1.3.0a0']
Since this did not work out I used pip to install torch 1.6.0. (Using the below command)
pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
This too did not work out and I got the below response from my terminal
ERROR: Could not find a version that satisfies the requirement torch==1.6.0+cpu (from versions: 1.7.1, 1.7.1+cpu, 1.7.1+cu101, 1.7.1+cu110, 1.8.0, 1.8.0+cpu, 1.8.0+cu101, 1.8.0+cu111, 1.8
.1, 1.8.1+cpu, 1.8.1+cu101, 1.8.1+cu102, 1.8.1+cu111, 1.9.0, 1.9.0+cpu, 1.9.0+cu102, 1.9.0+cu111, 1.9.1, 1.9.1+cpu, 1.9.1+cu102, 1.9.1+cu111, 1.10.0, 1.10.0+cpu, 1.10.0+cu102, 1.10.0+cu11, 1.10.0+cu113, 1.10.1, 1.10.1+cpu, 1.10.1+cu102, 1.10.1+cu111, 1.10.1+cu113, 1.10.2, 1.10.2+cpu, 1.10.2+cu102, 1.10.2+cu111, 1.10.2+cu113, 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117, 2.0.0, 2.0.0+cpu, 2.0.0+cu117, 2.0.0+cu118, 2.0.1, 2.0.1+cpu, 2.0.1+cu117, 2.0.1+cu118)
ERROR: No matching distribution found for torch==1.6.0+cpu
I specifically want to use torch 1.6.0 and torchvision 0.7.0 since the deep learning model I want to train on was built on top of the specified versions of these two packages.
How can I resolve this error?
This is a Python version problem, lets try to downgrade, we will create a new environment with Python 3.8 then install PyTorch
and torchvision
inside.
First we create our environment
conda create -n envname python=3.8
then we activate it
conda activate envname
then we install
conda install pytorch==1.6.0 torchvision==0.7.0 cpuonly -c pytorch
Remember to restart Pycharm IDE after.