question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError, whl in cache does not exist when running poetry install again

See original GitHub issue

Issue

Hey everyone, I’m having issues when trying to run poetry install via jenkins. poetry config virtualenvs.in-project is true. The install fails on the second installation attempt (always). It seems that there is an issue with the way caching works. Here is the trace: Thanks in advance!

de\user@PC C:\workspace>poetry install -vvv 
Loading configuration file C:\Users\user\AppData\Roaming\pypoetry\config.toml
Adding repository private (https://artifactory-url.de)
Creating virtualenv envname in C:\workspace\.venv
Using virtualenv: C:\workspace\.venv
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 20 installs, 0 updates, 0 removals, 3 skipped

  • Removing importlib-metadata (4.5.0): Skipped for the following reason: Not currently installed
  • Removing typing-extensions (3.10.0.0): Skipped for the following reason: Not currently installed
  • Removing zipp (3.4.1): Skipped for the following reason: Not currently installed
  • Installing pyparsing (2.4.7)

  Stack trace:

  6  c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\installation\executor.py:244 in _execute_operation
      242| 
      243|             try:
    > 244|                 result = self._do_execute_operation(operation)
      245|             except EnvCommandError as e:
      246|                 if e.e.returncode == -2:

  5  c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\installation\executor.py:321 in _do_execute_operation
      319|             return 0
      320| 
    > 321|         result = getattr(self, f"_execute_{method}")(operation)
      322| 
      323|         if result != 0:

  4  c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\installation\executor.py:462 in _execute_install
      460| 
      461|     def _execute_install(self, operation: Union[Install, Update]) -> int:
    > 462|         status_code = self._install(operation)
      463| 
      464|         self._save_url_reference(operation)

  3  c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\installation\executor.py:498 in _install
      496|             archive = self._download_link(operation, Link(package.source_url))
      497|         else:
    > 498|             archive = self._download(operation)
      499| 
      500|         operation_message = self.get_operation_message(operation)

  2  c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\installation\executor.py:648 in _download
      646|         link = self._chooser.choose_for(operation.package)
      647| 
    > 648|         return self._download_link(operation, link)
      649| 
      650|     def _download_link(self, operation: Union[Install, Update], link: Link) -> Link:

  1  c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\installation\executor.py:676 in _download_link
      674|             archive_hash = (
      675|                 "sha256:"
    > 676|                 + FileDependency(
      677|                     package.name,
      678|                     Path(archive.path) if isinstance(archive, Link) else archive,

  ValueError

  File \C:\Users\user\AppData\Local\pypoetry\Cache\artifacts\92\0f\cf\effdcd5d76a6186df0969f85b3b030284ff8058936d5016540b5258ea3\pyparsing-2.4.7-py2.py3-none-any.whl does not exist

  at c:\users\user\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\core\packages\file_dependency.py:41 in __init__
       37|             except FileNotFoundError:
       38|                 raise ValueError("Directory {} does not exist".format(self._path))
       39| 
       40|         if not self._full_path.exists():
    >  41|             raise ValueError("File {} does not exist".format(self._path))
       42| 
       43|         if self._full_path.is_dir():
       44|             raise ValueError("{} is a directory, expected a file".format(self._path))
       45| 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:24
  • Comments:17

github_iconTop GitHub Comments

11reactions
MadJlzzcommented, Sep 29, 2021

Also have this issue with 1.1.8 on Windows 10. My workaround is to go to the path specified, delete the cache and run poetry install again.

e.g.

PS C:\GithubTech\ngx\ngx-cli> poetry install
Installing dependencies from lock file

Package operations: 32 installs, 0 updates, 0 removals

  • Installing pyparsing (2.4.7)

  ValueError

  File \C:\Users\julie\AppData\Local\pypoetry\Cache\artifacts\92\0f\cf\effdcd5d76a6186df0969f85b3b030284ff8058936d5016540b5258ea3\pyparsing-2.4.7-py2.py3-none-any.whl does not exist

  at c:\users\julie\.pyenv\pyenv-win\versions\3.9.6\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│

Go to C:\Users\julie\AppData\Local\pypoetry\Cache, delete everything.

Run poetry install again and:

PS C:\GithubTech\ngx\ngx-cli> poetry install
Installing dependencies from lock file

Package operations: 32 installs, 0 updates, 0 removals

  • Installing pyparsing (2.4.7)
  • Installing atomicwrites (1.4.0)
  • Installing attrs (21.2.0)
  • Installing backports.entry-points-selectable (1.1.0)
  • Installing filelock (3.0.12)
  • Installing iniconfig (1.1.1)
  • Installing lazy-object-proxy (1.6.0)
  • Installing packaging (21.0)
  • Installing platformdirs (2.3.0)
  • Installing pluggy (0.13.1)
  • Installing py (1.10.0)
  • Installing six (1.16.0)
  • Installing toml (0.10.2)
  • Installing wrapt (1.12.1)
  • Installing astroid (2.7.3)
  • Installing identify (2.2.14)
  • Installing mccabe (0.6.1)
  • Installing mypy-extensions (0.4.3)
  • Installing pytest (6.2.4)
  • Installing typing-extensions (3.10.0.2)
  • Installing cfgv (3.3.1)
  • Installing nodeenv (1.6.0)
  • Installing isort (5.9.3)
  • Installing pyyaml (5.4.1)
  • Installing virtualenv (20.7.2)
  • Installing mypy (0.910)
  • Installing pylint (2.10.2)
  • Installing pre-commit (2.14.0)
  • Installing yapf (0.31.0)
  • Installing pytest-mock (3.6.1)

Installing the current project: ngx-cli (0.1.0)

Hope it helps other people in the meantime!

7reactions
f0ff886fcommented, Oct 18, 2021

I found some much better PRs that already had some eyes, not sure what the path to get the PRs merged is.

1.1: #4549 1.2+: #4531

Read more comments on GitHub >

github_iconTop Results From Across the Web

'poetry install' command fails; *.whl files are not found
Specifically I found that deleting the AppData\Local\pypoetry\Cache\artifacts folder (I'm on Windows 10) worked for me. virtualenvs for ...
Read more >
Local clone + Poetry - hydrolib-core documentation
This may occur when a conda environment was activated. Delete the AppData\Local\pypoetry\Cache directory. Then run conda deactivate to return to the base ...
Read more >
Configuration | Documentation | Poetry - Python dependency ...
Configuration Poetry can be configured via the config command (see more about its usage here) or directly in the config.toml file that will...
Read more >
Dependency Management With Python Poetry
toml file, it's not installed yet. As long as there's no poetry.lock file present in your project, you can run poetry install after...
Read more >
Python projects documentation | k8saas documentation
If the vscode container is not running, the existing whl package will be used without the possibility of re-building it because building the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found