-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip install --editable and pip install clash for namespace packages #3
Comments
Same issue here :( |
I've posted a code to test this bug : http://public.hg.stephane-klein.info/hgwebdir.cgi/test_pip_namespace_bug_3/ |
The root of the problem here is that setuptools includes two methods for making namespace packages work: the After some discussion with mitsuhiko and others on IRC, it seems the best (partial) solution for pip is to have "pip install -e" add a modified version of the standard setuptools ...nspkg.pth file for each develop-installed package. (The necessary modifications are to use the develop egg-link path instead of sitedir, and to skip the check for init.py entirely, since a develop-installed namespace package will have an init.py). This means pip will at least be compatible with itself (pip-installed and pip-editable-installed namespace packages will work together). Pip-installed and setuptools/distribute-installed namespace packages will not be compatible. |
I recently got bitten by this too. Another problem caused by it is that since an I think pip should somehow just kill the nspkg.pth thing altogether and install the |
+1 for switching away from '--single-version-externally-managed': that option is not intended for pip's use cases at all. If pip can't do at least as good a job installing stuff as easy_install, what is its purpose? |
Switching away from Saying that The breakage here is an inherent bug in the technique setuptools uses for namespace packages with that flag, and the bug is just as present when the flag is used by its originally intended audience, system packagers (I first saw the bug in interaction between a "setup.py develop" installed package and a system-package-installed namespace package). |
I'm experiencing this bug as well. I guess this is one of those unresolvable bugs that's here to stay. Oh well. |
I would accept a patch to avoid |
Why not an option that we can pass to |
I don't see a problem with a |
Can someone comment if I'm moving into the right direction ? This is my first time hacking on pip code so this is based on my few minutes glimpse into part of it, just to get |
Looks good to me, just needs a test. Tests are mostly high-level Thanks! |
Pull requests - #541 I'm also thinking of making it possible to set this flag in pip.conf. What you think about that ? |
Let's discuss on the pull request. |
Notice: the |
Here is a script to actually reproduce this issue |
i'm not a huge fan of the --egg solution, but there needs to be a less cumbersome workaround for this. without a workaround, while developing, I can't use --editable once and then just edit and test. every time I save my code I've got to run part of the problem with the way this entire issue manifests is that it is silent. you just can't import a module even though it is installed and pip tells you it is there. it would be a positive step just to make pip complain if trying to install editable packages as part of a namespace where a non editable package in that namespace is already installed. or alternately to complain if trying to install a non editable package that is part of a namespace where an editable package in that namespace is already installed. another option, if we actually want to make namespace packages and editable installs always work, could be that if a namespace package is installed as editable, pip could reorganize all the other packages in that namespace as editable along side the desired package. |
I submitted 2 proposals to fix this issue in setuptools https://bitbucket.org/pypa/setuptools/issue/250/develop-and-install-single-version. FYI. |
Just yet another bump here! |
I'll just mention that every single marrow package utilizes namespaces (some packages populating up to four or five) and that this particular issue has been a bit of a bane of my existence when it comes to helping new users get set up with development tools. I've got just shy of 60 packages using this. The The We also seem to be able to get into strange situations where a single namespace-contributing package can be installed three different ways, sometimes all simultaneously. (Repeated calls to Frustration with namespace issues reaches a peak after the fourth time a virtual environment is nuked to start over from scratch. ;) |
Not solution but I just put some notes. When mixing between 'editable' packages, namespaced packages and normal packages, I have more luck with buildout + mr.developer. |
- Also, the dev versions have all command modules installed by default - If the user really wants to install another module, from some unknown location, they can use pip directly - * pip doesn’t support mixing editable packages with regular packages * pip install --editable and pip install clash for namespace packages #3 pypa/pip#3 And, Fix nightly build version patching as well
- Also, the dev versions have all command modules installed by default - If the user really wants to install another module, from some unknown location, they can use pip directly - * pip doesn’t support mixing editable packages with regular packages * pip install --editable and pip install clash for namespace packages #3 pypa/pip#3 And, Fix nightly build version patching as well
While the fixup hack @lelit mentioned seems to work for some packages, it also breaks some packages/builds for us. After some playing around with pip install and editable mode, I came up with the same idea as @carljm (adding a -nspkg.pth file for every editable package), but nobody seems to have implemented that (or was this the now deprecated --egg option?). Is this still an issue on newer versions of python with PEP420 implemented? (read: would it help to switch to a newer version of python?) |
Using PEP420 style effectively helped me several times now wrt the editable mode. Unfortunately it comes with its own glitches: for example, setuptools' - packages=find_packages('src'),
+ packages=['toplevel.child.' + package
+ for package in find_packages('src/toplevel/child/')], |
Check out Setuptools 31 which adds support for this feature, and also co-exists with PEP-420 packages on Python 3.5+. |
For anyone curious, here's an exhaustive list how namespace packages work across https://github.com/jonparrott/namespace-pkg-tests/blob/master/table.md tl;dr: You can use |
I'm going to close this issue. It appears that setuptools 31 has fixed this for our reproduction scripts, and beyond that there isn't anything pip can do here. |
@jonparrott |
@dstufft While I appreciate that it's supposedly fixed, I'd like to see @jonparrott 's compatibility table re-run as proof. I hope for the best, plan for the worst on tickets that are nearly 7 years old and have such widely scoped failure scenarios. Confidence is not high given this problem's extensive history, and re-running the nox suite myself, the failures would indicate a lack of actual resolution. |
In @jonparrott's examples, the failing cases could be distilled down to "using This ticket was for combinations of The graph already posted by @jonparrott bears this out that this ticket is resolved and any remaining issues here is an issue with |
I just re-ran my tests and everything is the same as I initially ran it. I agree with @dstufft's assessment - pip has done everything it can do to resolve this. @piotr-dobrogost the test uses the latest versions of both. As of this writing, pip 9.0.1 and setuptools 34.3.2. |
Revert "minor cleanup"
A namespace package installed editable and another one installed regularly don't work well together.
The text was updated successfully, but these errors were encountered: