-
Notifications
You must be signed in to change notification settings - Fork 543
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
Running pip from python and versioning #119
Comments
I think I'm hitting this. I'm trying to depend the (Tangentially, if there's another way to do platform specific requirements.txt's, I love to hear it! |
@johnmarkwayve Could you upload the patch to get it working with python3-only dependencies? |
@ashwin153 I'm afraid that 6 months later we've moved on to a different way to manage pip dependencies (by calling pip in a genrule, for those interested). I don't have the patch to hand or the time to dig it out I'm afraid. I don't remember it being a difficult change though. |
Could you post a minimal example of getting pip3 working in a genrule? I can't seem to find a good example online. |
Sure, this isn't precisely what we use (which is wrapped in a custom repository rule that does a bunch of things I'm not comfortable sharing) and may not work out-of-the-box, but should be a start:
Where The idea is to install into a directory called Like I say, this is incomplete (and we're not entirely happy with it either), but it should be enough to get you going. I also very much doubt this works on Windows. |
I was about to make a PR for this, but I thought I'd first ask the question to see if there was a reason for this design decision.
--
In short: I suggest you make both the python version (at least python2 vs python3) used by this tool and the pip version (at least pip2 vs pip3) configurable. In doing so, move from using the
pip
module directly to invoking pip as a subprocess.In long:
I ran into a problem using this to manage pip dependencies that require python 3 (pytorch, in my example). The root of the issue is that these rules are hard-coded to use python2. So I cloned the repo and changed it to python3. This was mostly fine, but now it had an issue invoking pip, essentially because pip's internal APIs are not supported and should not be called from production code (see, for example, this issue). The solution, as suggested by pip documentation, is to call pip as a subprocess.
How do you feel about changes along these lines? What was the original reasoning behind 1) hard-coding python2 and 2) calling pip from internal unsupported APIs?
The text was updated successfully, but these errors were encountered: