Skip to content
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 import results in python3 incompatible libraries #220

Closed
sha1n opened this issue Aug 6, 2019 · 5 comments
Closed

pip import results in python3 incompatible libraries #220

sha1n opened this issue Aug 6, 2019 · 5 comments

Comments

@sha1n
Copy link
Contributor

sha1n commented Aug 6, 2019

pip_import is using 'python' hardcoded, which in many cases (urllib2, psutil and several others) results in Python 2 libraries that are not compatible with Python 3.

I replaced "python" with "python3" in the following line and everything works perfectly on my environment.

"python",

Since this is blocking my team, I created a local copy of pip.bzl and patched it just for now. I'm not sure what is the appropriate way to approach this. If there is a way to get the PY/3 interpreter path from Bazel, a fair solution can be to add a python_version parameter to the import rule.

Seems like an essential feature for Python 3 support and I will be happy to contribute a PR if we can decide on a solution. WDYT?

@aaliddell
Copy link
Contributor

There's a few open PRs about this issue, with varying solutions:

There's also rules_pip, which offers a python_interpreter attribute to solve this on its pip_repository rule. This is the solution I have had to use until there's support in rules_python, although rules_pip actually subjectively has a nicer interface for using the fetched packages.

@sha1n
Copy link
Contributor Author

sha1n commented Aug 7, 2019

Thanks @aaliddell! I was unaware of rules_pip and will definitely take a look.
Seems like #42 and #119 are also related to the same core issue, but I haven't seen any progress on either of them for a very long time.

I'll keep following.

@ali5h
Copy link

ali5h commented Sep 21, 2019

also check this https://github.com/ali5h/rules_pip_lock

@lshamis
Copy link

lshamis commented Oct 29, 2019

Python 2 will be officially past EOL come 2020: https://pythonclock.org/
This is an important issue to resolve before teams can start switching to Python 3.

@brandjon
Copy link
Member

This should be resolved imminently. Dedupping this issue to #249.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants