Skip to content

Poetry on Windows fails with File does not exists error #4479

@lululukas

Description

@lululukas
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions