-
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 with target doesn't work for optional sub-packages #4230
Comments
+1 got the same problem and was looking to open an issue and found this one. This is EXACTLY our situation. |
I'm not sure what we want to do here. Maybe other @pypa/pip-committers have inputs on this? |
Also have the exact problem. This kind of local install is only getting more popular with increasing use of such things as AWS lambda and GCP AppEngine. |
Could someone provide a reproduction case for this? |
Sounds like an issue similar to what I ran into. My issue was trying to install subpackages under a common package hierarchy that already exists at the time of installation. example package names: dog.german, dog.british. I added a temporary fix for my use case: using --root [location] instead of -t to install in a predetermined location. This creates the sites-package sub directories, but that location is static and I copy over the dir from final location for further use. |
I am currently trying to build a deployment package for AWS Lambda, with using amazonlinux image and python3-pip, having this issue as well. Has not find any workarounds yet. |
As @pradyunsg said, we'll need a reproduction case for this. I'd also add that I would want to see more context on what the logic is for doing this and why it's a reasonable behaviour to rely on (descriptions involving artificial packages like My inclination is to say that you shouldn't be trying to do this, as it's not how I'd expect |
@pfmoore one usecase for this is when you'd want to ship multiple python packages to your spark application. You'd pip install with -t option into a folder. Zip the folder and pass it to spark-submit using --py-files option. |
@mojganaz Thanks for the example, but I don't really see why you couldn't just pip install everything, submit the zipped folder, and then remove the folder. Next time you want to submit, do the same. What's the requirement for doing Sorry if the answer is something straightforward about how spark works, I'm not at all familiar with spark, so feel free to explain in idiot-level terms 🙂 |
Closing this because no one has provided a reproducer for this, and there has been no activity on this for two years now. |
Currently, when using the target option,
--target
, if a directory/file already exists and would be overwritten it errors out requesting the you use upgrade. However, that is impossible when trying to install an optional sub-package to a package that was also installed to a different location with--target
.Imagine you have the package
foo
installed and it has its__init__.py
and other modules. Now I would like to installfoo.bar
tofoo
(i.e. sub-packagebar
in thefoo
directory). When installing to site-packages, like normal, it works and pip doesn't care thatfoo
directory already exists (in fact it doesn't seem to care even iffoo.bar
exists as long as the*.dist_info
forfoo.bar
is removed). The point is that pip is happy to overwrite files.Now imagine
foo
was installed elsewhere with--target
. Now I'd like to installfoo.bar
also to the other location. But now pip errors out sayingTarget directory foo already exists. Specify --upgrade to force replacement
.--upgrade
would not work here is at would just delete the previous contents offoo
messing up the main package.This change happened in #2007, while I see that there were issues that required this, these changes made sub-packages impossible with
--target
.Would perhaps a
--overwrite
option be in order? And maybe the--overwrite
option should be automatically set to be in line with current pip behavior when installing tosite-packages
?The text was updated successfully, but these errors were encountered: