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

importlib_metadata-6.0.0.dist-info directory is almost empty. Is it normal? #431

Closed
HubTou opened this issue Mar 2, 2023 · 4 comments
Closed
Labels
question Further information is requested

Comments

@HubTou
Copy link

HubTou commented Mar 2, 2023

Hello,

This is more a question than an issue.

Out of the 170 packages on my system, importlib-metada is the only one with an almost empty site-package/*/dist-info directory and (ironically!) no METADATA file inside. There's however an egg-info directory with similar information.

I don't see any side effect for this, but is it normal?

# cd /usr/local/lib/python3.9/site-packages

# ls -lR  importlib_metadata-6.0.0*
importlib_metadata-6.0.0-py3.9.egg-info:
total 20
-rw-r--r--  1 root  wheel     1  8 févr. 19:19 dependency_links.txt
-rw-r--r--  1 root  wheel  3679  8 févr. 19:19 PKG-INFO
-rw-r--r--  1 root  wheel   505  8 févr. 19:19 requires.txt
-rw-r--r--  1 root  wheel  1340  8 févr. 19:19 SOURCES.txt
-rw-r--r--  1 root  wheel    19  8 févr. 19:19 top_level.txt

importlib_metadata-6.0.0.dist-info:
total 4
-rw-r--r--  1 root  wheel  4  5 janv. 13:17 INSTALLER
-rw-r--r--  1 root  wheel  0  5 janv. 13:17 REQUESTED

# cat importlib_metadata-6.0.0.dist-info/INSTALLER
pip

# pip list | grep importlib
importlib-metadata            6.0.0

# pip show importlib-metadata
Name: importlib-metadata
Version: 6.0.0
Summary: Read metadata from Python packages
Home-page: https://github.com/python/importlib_metadata
Author: Jason R. Coombs
Author-email: jaraco@jaraco.com
License:
Location: /usr/local/lib/python3.9/site-packages
Requires: zipp
Required-by: keyring, Sphinx, twine
@jaraco jaraco added the question Further information is requested label Apr 11, 2023
@jaraco
Copy link
Member

jaraco commented Apr 11, 2023

I don't know if it's normal or not. I suspect it has something to do with how you installed the package. When I install it, only the .dist-info is installed:

 draft $ py -3.9 -m venv .venv
 draft $ py -m pip install -q -U pip
 draft $ py -m pip install importlib_metadata
Collecting importlib_metadata
  Using cached importlib_metadata-6.3.0-py3-none-any.whl (22 kB)
Collecting zipp>=0.5
  Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB)
Installing collected packages: zipp, importlib_metadata
Successfully installed importlib_metadata-6.3.0 zipp-3.15.0
 draft $ ls -d1 .venv/lib/python3.9/site-packages/importlib*
.venv/lib/python3.9/site-packages/importlib_metadata
.venv/lib/python3.9/site-packages/importlib_metadata-6.3.0.dist-info

How the metadata is generated is mainly a function of the package installer (e.g. pip). This package doesn't do anything special for declaring metadata.

Can you investigate and provide more detail about how your system became configured as it was?

@HubTou
Copy link
Author

HubTou commented Apr 12, 2023 via email

@jaraco
Copy link
Member

jaraco commented Apr 14, 2023

Almost certainly, the issue is some corruption or artifact specific to the environment. The question is answered (it's not normal).

One side effect you'll get from this situation is that there will be multiple Distribution objects for a given name and some calls like importlib_metadata.distribution will return the first of those.

The fact that you're getting meaningful metadata seems to indicate that the precedence behavior (in here or in pip) may be doing a good job of resolving the ambiguity (or maybe you just got lucky).

Feel free to revive the conversation with more details, especially if you believe there's a behavior in this project that can be improved.

@jaraco jaraco closed this as completed Apr 14, 2023
@HubTou
Copy link
Author

HubTou commented Apr 18, 2023

Hello,
I was not able to reproduce the issue.
However I noticed on fresh installs that the egg-info comes from the package install and the dist-info comes from pip upgrades (which removes the egg-info directory on upgrade).
As said by pip, "Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager". That's probably the origin of the issue, may be with previous versions of pip.

root# pkg install py39-importlib-metadata
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	py39-importlib-metadata: 6.0.0_1
	py39-setuptools: 63.1.0
	py39-zipp: 3.4.0

Number of packages to be installed: 3

The process will require 9 MiB more space.
1 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/3] Fetching py39-setuptools-63.1.0.pkg: 100%    1 MiB   1.1MB/s    00:01    
[2/3] Fetching py39-zipp-3.4.0.pkg: 100%    8 KiB   8.1kB/s    00:01    
[3/3]  Fetching py39-importlib-metadata-6.0.0_1.pkg: 100%   31 KiB  31.4kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/3] Installing py39-setuptools-63.1.0...
[1/3] Extracting py39-setuptools-63.1.0: 100%
[2/3] Installing py39-zipp-3.4.0...
[2/3] Extracting py39-zipp-3.4.0: 100%
[3/3] Installing py39-importlib-metadata-6.0.0_1...
[3/3] Extracting py39-importlib-metadata-6.0.0_1: 100%

root# ls -l /usr/local/lib/python3.9/site-packages/
total 72
drwxr-xr-x  2 root  wheel   512 18 avr.  08:12 __pycache__
drwxr-xr-x  3 root  wheel   512 18 avr.  08:12 _distutils_hack
-rw-r--r--  1 root  wheel   151  2 avr.  03:15 distutils-precedence.pth
-rw-r--r--  1 root  wheel   151 18 avr.  07:54 distutils-precedence.pth.pkgsave
-rw-r--r--  1 root  wheel   185  2 avr.  03:15 easy-install.pth
-rw-r--r--  1 root  wheel   185  2 avr.  03:15 easy-install.pth.dist
drwxr-xr-x  3 root  wheel   512 18 avr.  08:12 importlib_metadata
drwxr-xr-x  2 root  wheel   512 18 avr.  08:12 importlib_metadata-6.0.0-py3.9.egg-info          # <= here
drwxr-xr-x  5 root  wheel   512 18 avr.  07:54 pip
drwxr-xr-x  2 root  wheel   512 18 avr.  07:54 pip-23.1.dist-info
drwxr-xr-x  5 root  wheel   512 18 avr.  08:12 pkg_resources
-rw-r--r--  1 root  wheel   119  2 avr.  03:13 README.txt
drwxr-xr-x  8 root  wheel  3072 18 avr.  08:12 setuptools
drwxr-xr-x  2 root  wheel   512 18 avr.  08:11 setuptools-63.1.0-py3.9.egg-info
drwxr-xr-x  2 root  wheel   512 18 avr.  07:54 setuptools-67.6.1.dist-info
drwxr-xr-x  2 root  wheel   512 18 avr.  08:12 zipp-3.4.0-py3.9.egg-info
-rw-r--r--  1 root  wheel  8089 25 oct.   2020 zipp.py

root# ls -l /usr/local/lib/python3.9/site-packages/importlib_metadata-6.0.0-py3.9.egg-info/
total 20
-rw-r--r--  1 root  wheel     1  2 avr.  03:17 dependency_links.txt
-rw-r--r--  1 root  wheel  3679  2 avr.  03:17 PKG-INFO
-rw-r--r--  1 root  wheel   505  2 avr.  03:17 requires.txt
-rw-r--r--  1 root  wheel  1340  2 avr.  03:17 SOURCES.txt

root# pip list
Package            Version
------------------ -------
importlib-metadata 6.0.0
pip                23.1
setuptools         63.1.0
zipp               3.4.0

root# pip list --outdated
Package            Version Latest Type
------------------ ------- ------ -----
importlib-metadata 6.0.0   6.4.1  wheel
setuptools         63.1.0  67.6.1 wheel
zipp               3.4.0   3.15.0 wheel

root# pip install -U importlib-metadata
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.9/site-packages (6.0.0)
Collecting importlib-metadata
  Downloading importlib_metadata-6.4.1-py3-none-any.whl (22 kB)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/site-packages (from importlib-metadata) (3.4.0)
Installing collected packages: importlib-metadata
  Attempting uninstall: importlib-metadata
    Found existing installation: importlib-metadata 6.0.0
    Uninstalling importlib-metadata-6.0.0:
      Successfully uninstalled importlib-metadata-6.0.0
Successfully installed importlib-metadata-6.4.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

root# ls -ll /usr/local/lib/python3.9/site-packages/
total 72
drwxr-xr-x  2 root  wheel   512 18 avr.  08:12 __pycache__
drwxr-xr-x  3 root  wheel   512 18 avr.  08:12 _distutils_hack
-rw-r--r--  1 root  wheel   151  2 avr.  03:15 distutils-precedence.pth
-rw-r--r--  1 root  wheel   151 18 avr.  07:54 distutils-precedence.pth.pkgsave
-rw-r--r--  1 root  wheel   185  2 avr.  03:15 easy-install.pth
-rw-r--r--  1 root  wheel   185  2 avr.  03:15 easy-install.pth.dist
drwxr-xr-x  3 root  wheel   512 18 avr.  08:14 importlib_metadata
drwxr-xr-x  2 root  wheel   512 18 avr.  08:14 importlib_metadata-6.4.1.dist-info          # <= here
drwxr-xr-x  5 root  wheel   512 18 avr.  07:54 pip
drwxr-xr-x  2 root  wheel   512 18 avr.  07:54 pip-23.1.dist-info
drwxr-xr-x  5 root  wheel   512 18 avr.  08:12 pkg_resources
-rw-r--r--  1 root  wheel   119  2 avr.  03:13 README.txt
drwxr-xr-x  8 root  wheel  3072 18 avr.  08:12 setuptools
drwxr-xr-x  2 root  wheel   512 18 avr.  08:11 setuptools-63.1.0-py3.9.egg-info
drwxr-xr-x  2 root  wheel   512 18 avr.  07:54 setuptools-67.6.1.dist-info
drwxr-xr-x  2 root  wheel   512 18 avr.  08:12 zipp-3.4.0-py3.9.egg-info
-rw-r--r--  1 root  wheel  8089 25 oct.   2020 zipp.py

root# ls -l /usr/local/lib/python3.9/site-packages/importlib_metadata-6.4.1.dist-info/
total 36
-rw-r--r--  1 root  wheel      4 18 avr.  08:14 INSTALLER
-rw-r--r--  1 root  wheel  11358 18 avr.  08:14 LICENSE
-rw-r--r--  1 root  wheel   4958 18 avr.  08:14 METADATA
-rw-r--r--  1 root  wheel   2051 18 avr.  08:14 RECORD
-rw-r--r--  1 root  wheel      0 18 avr.  08:14 REQUESTED
-rw-r--r--  1 root  wheel     19 18 avr.  08:14 top_level.txt
-rw-r--r--  1 root  wheel     92 18 avr.  08:14 WHEEL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants