chiemNZ
chiemNZ

Reputation: 21

An error occured while installing flair and pytorch with pipenv in windows with Pycharm

I am having problems installing the python packages flair and pytorch via pipenv and have not been able to resolve this issue yet. Since I am trying to version my python git repository with Pipfile + Pipfile.lock instead of requirements.txt this is currently not possible:

pipenv install flair

ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from flair->-r c:\users\user.name\appdata\local\temp\pipenv-plyx3uwp-requirements\pipenv-xh_afa_r-requirement.txt (line 1)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2) ERROR: No matching distribution found for torch>=1.1.0 (from flair->-r c:\users\user.name\appdata\local\temp\pipenv-plyx3uwp-requirements\pipenv-xh_afa_r-requirement.txt (line 1)) Installation Failed

I tried these variants of installing torchvision:

pipenv install torchvision

to install torchvision which should pick up the latest torch version

pipenv install torch==1.3

to install torch

pipenv install https://download.pytorch.org/whl/cu92/torch-0.4.1-cp37-cp37m-win_amd64.whl

alternative way to install torch (here is more binaries: https://pytorch.org/get-started/previous-versions/#windows-binaries)

pipenv install git+https://github.com/pytorch/vision#egg=torchvision

Another alternative way,

Error text: Collecting torchvision
  Downloading torchvision-0.5.0-cp37-cp37m-win_amd64.whl (1.2 MB)
Collecting numpy
  Using cached numpy-1.18.5-cp37-cp37m-win_amd64.whl (12.7 MB)
Collecting pillow>=4.1.1
  Downloading Pillow-7.1.2-cp37-cp37m-win_amd64.whl (2.0 MB)
Collecting six
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)

pipenv install torchvision

users\user.name\appdata\local\temp\pipenv-hf2be0xq-requirements\pipenv-57akhz4j-requirement.txt (line
1)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.4.0 (from torchvision->-r c:\users\user.name\appdat
a\local\temp\pipenv-hf2be0xq-requirements\pipenv-57akhz4j-requirement.txt (line 1))
Installation Failed

The only way it was possible to install torchvision was without its dependent packages:

pipenv run pip install --no-deps torchvision

But this did not resolve the problem of installing flair via pipenv since the dependencies are needed.

Upvotes: 2

Views: 2088

Answers (1)

throws_exceptions_at_you
throws_exceptions_at_you

Reputation: 1746

Try to cleanup the Pipfile and the virtual environment first. It looks like the transitive dependencies and the ones declared in the Pipfile clash.

Then try to install torchvision like this:

pipenv install torchvision 

This will install the latest torchvision version and the compatible torch version:

Source:

torch   torchvision     python
master / nightly    master / nightly    >=3.6
1.5.0   0.6.0   >=3.5
1.4.0   0.5.0   ==2.7, >=3.5, <=3.8
1.3.1   0.4.2   ==2.7, >=3.5, <=3.7
1.3.0   0.4.1   ==2.7, >=3.5, <=3.7
1.2.0   0.4.0   ==2.7, >=3.5, <=3.7
1.1.0   0.3.0   ==2.7, >=3.5, <=3.7
<=1.0.1     0.2.2   ==2.7, >=3.5, <=3.7

Flair works with Pytorch 1.1+ as stated here:

The project is based on PyTorch 1.1+ and Python 3.6+, because method signatures and type hints are beautiful.

After installing torchvision proceed to install flair:

pipenv install flair

Here you can find a working Pipfile and Pipfile.lock file, after the two operations were concluded:

Pipfile

name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
torchvision = "*" 
flair = "*"

[requires]
python_version = "3.6"

Pipfile.lock

Upvotes: 1

Related Questions