Install namespace package with --prefix does not install the actual package files
See original GitHub issue- Pip version: 18.0 (also tested in 10.0.1)
- Python version: 3.6.5
- Operating system: Windows 10
$ cd ~/Desktop
$ pip install --prefix test --ignore-installed hurry.filesize
$ ls test/Lib/site-packages/
__pycache__/ easy_install.py hurry.filesize-0.9-py3.6.egg-info/ pkg_resources/ setuptools/ setuptools-40.0.0.dist-info/
$ cat test/Lib/site-packages/hurry.filesize-0.9-py3.6.egg-info/installed-files.txt
..\hurry.filesize-0.9-py3.6-nspkg.pth
..\hurry\filesize\README.txt
..\hurry\filesize\__init__.py
..\hurry\filesize\__pycache__\__init__.cpython-36.pyc
..\hurry\filesize\__pycache__\filesize.cpython-36.pyc
..\hurry\filesize\__pycache__\tests.cpython-36.pyc
..\hurry\filesize\filesize.py
..\hurry\filesize\tests.py
PKG-INFO
SOURCES.txt
dependency_links.txt
namespace_packages.txt
not-zip-safe
requires.txt
top_level.txt
$ ls test/Lib/site-packages/hurry
ls: cannot access 'test/Lib/site-packages/hurry': No such file or directory
You can see that the hurry
directory doesn’t actually exist – even though the installed-files.txt
lists it with the package files as being installed.
Edit 1 fixed Python version
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Packaging namespace packages
However, namespace packages come with several caveats and are not appropriate in all cases. A simple alternative is to use a prefix on...
Read more >python - `pip install -t` doesn't work with namespace packages
When I install requests with either --target or --prefix and add it to the PYTHONPATH I can import it just fine. But with...
Read more >What happens to my namespace prefix when I install a ...
A namespace prefix is a globally unique identifier that you can request if you plan to create a managed package. All the components...
Read more >cmake-packages(7) — CMake 3.25.1 Documentation
Unlike a package configuration file, it is not shipped with upstream, but is ... This command constructs a set of installation prefixes and...
Read more >Python Namespace Packages - YouTube
python #setuptools # packaging #namespacing #django #papermergeIn this screencast we will learn about namespace packaging and few caveats ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is easy to reproduce with the latest pip and a non-namespace package.
The problem is that for the legacy code path (what we do for non-PEP 517 packages when wheel is not installed), we run the
setup.py
from the directory it is contained in, but the prefix we pass to setuptools is still relative.t.sh
Output
The easiest fix is just to make
--prefix
absolute. This could be handled in a callback for the--prefix
option, similar to what was done in #7467.We would also need a test for this, which would look like
test_install_package_with_prefix
. We should assert that an.egg-info
directory is created to make sure that we were using the legacy code path.Quick update: This issue will be obsolete when
setup.py install
gets deprecated, which is scheduled for April 2023 according to #8559.