.dist-info folder not installed by pip => cannot run importlib_resources
Hi,
I have great difficulties in installing importlib_resources.
First of all, I did not found any .dist-info folder after installation, while the importib_resources package requires this folder. It seems to be normal behavior for stash-pip since I did not found this folder either in another module (mido).
Then, I could not uninstall the package. So I manually removed it.
And now pip refuses to install it again because it is still in its list of installed packages.
So my question is twofold:
-
how do I reset pip’s memory without uninstalling Stash? I did not found any cache folder and the
--no-cache-dir installdoes not seem to be implemented. -
is the .dist-folder behavior normal?
Thanks.
Ok, I found the .pypi_packages file in site-packages and was able to remove pip history.
I manually imported the dist-info folders in site-packages-3 and importlib_resources now works.
I am not an expert but it seems to be that a package should not rely on its .dist-info folder being installed. In any case, it would be cool if stash-pip could install these folders (as an option?), as pip does it by default...
In any case, it would be cool if stash-pip could install these folders (as an option?), as pip does it by default...
The problem is that .dist-info would need to be generated by pip when using a setup-style install. It may be possible using a wheel-style installation, but in this case not every package may have this.
The Python packaging ecosystem is working toward being able to rely on package metadata being present, hence why importlib_resources and importlib_metadata are unconditionally relying on that metadata being present. To that end, specifications like PEP 517 were created to help build tools standardize the creation of such metadata.
The problem is that
.dist-infowould need to be generated bypipwhen using a setup-style install. It may be possible using a wheel-style installation, but in this case not every package may have this.
Can you provide an example of a package that is installed by pip but doesn't support wheel-style installation? The setuptools project is working to actively deprecate distutils and setup.py-based installation, so if there's a use-case that's not supported, I'd like to know more. In other words, there should be a way using best-practices for a tool like stash to produce environments with package metadata.
With pep517 0.6, it's possible to produce metadata for any package including legacy versions this way:
draft $ ls
draft $ cat > setup.py
from distutils.core import setup
setup(name='foo', version='1.0')
draft $ pip-run pep517 -- -c "print('building metadata'); from pep517 import meta; meta.build('.', system=meta.compat_system('.'))"
Collecting pep517
Using cached pep517-0.8.2-py2.py3-none-any.whl (18 kB)
Collecting toml
Using cached toml-0.10.1-py2.py3-none-any.whl (19 kB)
Installing collected packages: toml, pep517
Successfully installed pep517-0.8.2 toml-0.10.1
building metadata
draft $ ls dist
foo.dist-info
draft $ tree
.
├── dist
│ └── foo.dist-info
│ ├── METADATA
│ └── top_level.txt
├── foo.egg-info
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ ├── dependency_links.txt
│ └── top_level.txt
└── setup.py
draft $ cat dist/foo.dist-info/METADATA
Metadata-Version: 2.1
Name: foo
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Platform: UNKNOWN
UNKNOWN