Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'poetry install' command fails; *.whl files are not found

I am managing dependencies in my Python project via Poetry.

Now I want to run this project in a machine which is different from my dev machine. To install dependecies, I simply run this command from the root directory:

$ poetry install

but then it raises the following errors:

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 70 installs, 0 updates, 0 removals

  • Installing colorama (0.4.4)
  • Installing tzdata (2021.1)

  ValueError

  File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifacts\9e\b3\11\7d87ac44fdb2d557301f1f4086a37c080d1482a98751abe7cdbabbad26\colorama-0.4.4-py2.py3-none-any.whl does not exist

  at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
       36│             except FileNotFoundError:
       37│                 raise ValueError("Directory {} does not exist".format(self._path))
       38│
       39│         if not self._full_path.exists():
    →  40│             raise ValueError("File {} does not exist".format(self._path))
       41│
       42│         if self._full_path.is_dir():
       43│             raise ValueError("{} is a directory, expected a file".format(self._path))
       44│


  ValueError

  File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifacts\45\2d\cb\6443e36999e7ab3926d5385dfac9ee9ea2a62f8111ff71abb6aff70674\tzdata-2021.1-py2.py3-none-any.whl does not exist

  at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
       36│             except FileNotFoundError:
       37│                 raise ValueError("Directory {} does not exist".format(self._path))
       38│
       39│         if not self._full_path.exists():
    →  40│             raise ValueError("File {} does not exist".format(self._path))
       41│
       42│         if self._full_path.is_dir():
       43│             raise ValueError("{} is a directory, expected a file".format(self._path))
       44│

It would be good to know what these *.whl are and how they are used by Poetry.

like image 976
tteguayco Avatar asked Sep 25 '21 13:09

tteguayco


2 Answers

Specifically I found that deleting the AppData\Local\pypoetry\Cache\artifacts folder (I'm on Windows 10) worked for me. virtualenvs for other projects may be in AppData\Local\pypoetry\Cache\virtualenvs so you might not want to delete the root cache folder at AppData\Local\pypoetry\Cache in its entirety.

like image 50
Dris101 Avatar answered Oct 19 '22 10:10

Dris101


According to https://github.com/python-poetry/poetry/issues/4163, it seems to be an issue still pending to be resolved.

As a workaround, dumping dependencies to a requirements.txt file via poetry:

$ poetry export -f requirements.txt --output requirements.txt --without-hashes

and then installing them via pip, worked for me:

$ pip install -r requirements.txt
like image 22
tteguayco Avatar answered Oct 19 '22 08:10

tteguayco