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.

Poetry on Windows fails with File does not exists error

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10
  • Poetry version: 1.2.0a2
  • Link of a Gist with the contents of your pyproject.toml file: Will publish if necessary for this issue, don’t think it is.

Issue

When trying to poetry add a dependency or do poetry install or poetry update, the command fails with an error saying that the file does not exist. The file refers to the weel of any dependencies that need to be installed. However, the file actually does exist at the correct location, but is somehow not found by poetry. I think this is due to a leading \ in the path. I haven’t looked at the code, but I use bash bundled with git-for-windows in Windows Terminal. I assume that has something to do with the problem.

This is the error message, you can see the leading backslash in the path which I think is the culprit:

  ValueError

  File \C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts\ac\59\ac\9fc6b3c55594c6a7395665b20538ee05fb2ade328e723d2761b44c70ca\typed_ast-1.4.3-cp37-cp37m-win_amd64.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│

However, the file does exist:

❯ file "C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts\ac\59\ac\9fc6b3c55594c6a7395665b20538ee05fb2ade328e723d2761b44c70ca\typed_ast-1.4.3-cp37-cp37m-win_amd64.whl"
C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts\ac\59\ac\9fc6b3c55594c6a7395665b20538ee05fb2ade328e723d2761b44c70ca\typed_ast-1.4.3-cp37-cp37m-win_amd64.whl: Zip archive data, at least v2.0 to extract, compression method=deflate

Edit:

I get the same error using powershell, so it seems like the issue is not related to using bash.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:15
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
jonapichcommented, Oct 6, 2021

For anyone who ran into this and bricked their installation, here’s how to fix it:

  1. downgrade poetry to 1.1.9
  2. delete the cache folder MANUALLY (using poetry cache clear did not work, the leading \ still appeared afterwards.)

You can locate your cache folder by calling poetry config --list.

1reaction
serverwentdowncommented, Dec 2, 2021

@lululukas You can adjust the command accordingly, replace 1.1 with master

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 >
Dependency Management With Python Poetry
Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.
Read more >
Announcing Poetry 1.2.0 | Blog
The Poetry team is pleased to announce the immediate availability of Poetry 1.2.0. Poetry 1.2 boasts a massive list of changes, new features ......
Read more >
Configure a Poetry environment | PyCharm Documentation
Poetry is a tool that facilitates creating a Python virtual environment based on the ... Project dependencies are recorded in the pyproject.toml file...
Read more >
poetry - PyPI
Poetry helps you declare, manage and install dependencies of Python projects, ... "https://python-poetry.org" # README file(s) are used as the package ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found