Skip to content

Installing packages fails when already cached on Windows (making 1.1.9+ unusable on Windows) #4535

@bparzella

Description

@bparzella
  • 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.1.9-1.1.11
  • Link of a Gist with the contents of your pyproject.toml file:
name = "poetry_test"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
lxml = "^4.6.3"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Issue

Installing a package that is already in the local pypoetry cache on windows fails since poetry 1.1.9.

$ poetry install -vvv --no-root
Using virtualenv: D:\user\src\temp\poetry_test\poetry_env
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 1 install, 0 updates, 0 removals

  • Installing lxml (4.6.3): Pending...
  • Installing lxml (4.6.3): Failed

  ValueError

  File \C:\Users\user\AppData\Local\pypoetry\Cache\artifacts\f7\90\e7\2d9752b05431b2ba90b4626b90f1674c505301a7cdbab89fd620aee824\lxml-4.6.3-cp36-cp36m-win_amd64.whl does not exist

  at D:\user\src\temp\poetry_test\poetry_env\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│

The problem does not occur, if the package is not cached.

Python version used is 3.6.8

Workaround

As a workaround we downgraded to 1.1.8 and poetry-core 1.0.4.

IMHO

It seems like this issue comes from the commit 8238cab

The call to "archive.path" in line 615 of 'poetry/installation/executor.py' seems to remove only two of the three slashes for Windows file URLs (file:///c:/.....). This results in an invalid path with a leading slash (visible in the command output File \C:\Users\user\AppData), which in the end leads to a missing file exception.

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