Skip to content

Modify import path of pip package imported via "requirement()" #356

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

Closed
carlosgalvezp opened this issue Sep 7, 2020 · 2 comments
Closed

Comments

@carlosgalvezp
Copy link

carlosgalvezp commented Sep 7, 2020

Hi,

I'm using rules_python to import pip packages required for my py_binary application.

So far so good, but I run into an issue when importing tensorflow - my py_binary cannot import it.
The reason is that the tensorflow.whl file contains this folder structure:

/folder1/folder2/tensorflow/__init__.py
Instead of what rules_python expects/assumes:

/tensorflow/__init__.py

I would like to be able to append folder1/folder2 to the tensorflow path that is added to PYTHONPATH, in order to be able to import it. Similar to the imports option in py_library.

Is this supported?

The only alternative solution is to import the TensorFlow Bazel workspace and build from source, but it is unnecessary and will take long time to build.

Related issue: tensorflow/tensorflow#21461

Thanks!

@thundergolfer
Copy link

@carlosgalvezp I think this is a duplicate of #71, and I see you've commented already in that issue. I've given an update there, which is hopefully sufficient.

Closing as duplicate.

@carlosgalvezp
Copy link
Author

Thanks, indeed it's a duplicate, sorry about that! Will try your suggestion on the other 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

2 participants