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

py_library import path is wrong for certain pypi packages (like tensorflow) #189

Closed
WesleyYue opened this issue May 22, 2019 · 2 comments
Closed

Comments

@WesleyYue
Copy link

WesleyYue commented May 22, 2019

Inside where the py_library() is generated for each specified requirement, the import path is specified as "." (https://github.com/bazelbuild/rules_python/blob/master/rules_python/whl.py#L149). While this works for most packages, not all packages have the python module in the top level of the whl. For example, the tensorflow python module is inside tensorfow-<version_info>.whl/tensorfow-<version_info>.data/purelib/tensorflow. Because of this, import tensorflow will fail in a py_binary that has requirement("tensorflow"). What I believe rules_python/whl.py should be doing is to check whether the top-level folders have an __init__.py file inside of them, and if not, search the directory tree until it finds them.

@danieljanes
Copy link
Contributor

Thanks for opening this issue @WesleyYue. This is a huge blocker for us as well and I believe there is related info in #71 (and apt-itude/rules_pip#15).

@alexeagle
Copy link
Collaborator

rules_python 0.1.0 has been released which upstreams the rules_python_external repo. Please switch from pip_import to pip_install which doesn't have this issue.

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

3 participants