Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry warning about duplicate *.dist-info directories which always contain one file named "REQUESTED" #6815

Closed
3 tasks done
hwmq opened this issue Oct 16, 2022 · 3 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@hwmq
Copy link

hwmq commented Oct 16, 2022

  • Poetry version: Version: 1.2.2

  • Python version: Python: 3.10.6

  • OS version and name: Ubuntu 22.04

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

Issue

I have become quite used to seeing messages like these when running poetry install, and I am curious if other people experience the problem I will describe.

Project environment contains an invalid distribution (...myenvpath.../lib/python3.10/site-packages/protobuf-3.19.5.dist-info). Consider removing it manually or recreate the environment.
Project environment contains an invalid distribution (...myenvpath.../lib/python3.10/site-packages/typing_extensions-4.3.0.dist-info). Consider removing it manually or recreate the environment.
Installing dependencies from lock file

I usually go to the site-packages directory and manually remove the duplicate *.dist-info directories as suggested. I noticed that all these "leftover" dist-info directories share a common feature. They only contain one file, REQUESTED. I searched issues for something similar, the closest I found was #2918, but I found nothing mentioning this REQUESTED file.

site-packages$ ls protobuf-3.19.*.dist-info
protobuf-3.19.5.dist-info:
REQUESTED

protobuf-3.19.6.dist-info:
INSTALLER  METADATA  namespace_packages.txt  RECORD  REQUESTED  top_level.txt  WHEEL
site-packages$ ls typing_extensions*.dist-info
typing_extensions-4.3.0.dist-info:
REQUESTED

typing_extensions-4.4.0.dist-info:
INSTALLER  LICENSE  METADATA  RECORD  REQUESTED  WHEEL

The version numbers suggest this old file is not being cleaned up when the rest of the old dist-info directory is removed when poetry installs a newer version of the package with one of its operations. Unfortunately I don't have a good sense if it only occurs from poetry install (the command I run most often, usually after poetry lock --no-update), or if it can occur from other poetry commands. The REQUESTED files are empty. Apparently this file existing means the package "was installed by user request", based on the following from ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/distlib/database.py line 336.

    requested = False
    """A boolean that indicates whether the ``REQUESTED`` metadata file is
    present (in other words, whether the package was installed by user
    request or it was installed as a dependency)."""

This didn't make sense to me at first, because neither protobuf nor typing-extensions are directly specified in my pyproject.toml (sorry, I did not include a link to my pyproject.toml because I do not know how to "sanitize" it).

$ poetry show --why --tree typing-extensions
tensorflow 2.9.2 TensorFlow is an open source machine learning framework for everyone.
└── typing-extensions >=3.6.6
$ poetry show --why --tree protobuf
google-api-core 2.10.2 Google API client core library
└── protobuf >=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<5.0.0dev
googleapis-common-protos 1.56.4 Common protobufs used in Google APIs
└── protobuf >=3.15.0,<5.0.0dev
tensorboard 2.9.1 TensorBoard lets you watch Tensors Flow
└── protobuf >=3.9.2,<3.20
tensorflow 2.9.2 TensorFlow is an open source machine learning framework for everyone.
└── protobuf >=3.9.2,<3.20

But it essentially appears every package poetry installs is considered "installed by user request" (there are a couple remaining discrepancies, why the numbers don't match)

site-packages$ ls -ld *.dist-info | wc -l
177
site-packages$ find . -name REQUESTED | wc -l
175

If other people experience this same issue, hopefully this is enough to point someone curious in the right direction. I found this problem was difficult to reliably reproduce, but it has happened pretty frequently since I began using poetry around a month ago.

@hwmq hwmq added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 16, 2022
@radoering
Copy link
Member

I've experienced leftover *.dist-info folders from time to time, too. I have to admit it happens too rarely for me to have bothered to check which files are left before removing the folder.

I assume the REQUESTED file is created by pip for each package that is installed explicitly and not as a dependency of another package. Since we install each of the locked packages explicitly, this file should be created for all of them. One exception is the root package itself. Maybe, there are more exceptions.

@Secrus
Copy link
Member

Secrus commented May 9, 2024

Pretty sure that this is no longer an issue.

@Secrus Secrus closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Copy link

github-actions bot commented Jun 9, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants