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 doesn't work with tensorflow #71

Open
vertix opened this issue Feb 28, 2018 · 19 comments
Open

pip_import doesn't work with tensorflow #71

vertix opened this issue Feb 28, 2018 · 19 comments
Assignees
Labels

Comments

@vertix
Copy link

@vertix vertix commented Feb 28, 2018

WORKSPACE

http_archive(
    name = "io_bazel_rules_python",
    sha256 = "0d1810fecc1bf2b6979d2af60e157d93d3004805bd8b7fda6eb52dda13480dca",
    strip_prefix = "rules_python-115e3a0dab4291184fdcb0d4e564a0328364571a",
    urls = ["https://github.com/bazelbuild/rules_python/archive/115e3a0.tar.gz"],
)

load("@io_bazel_rules_python//python:pip.bzl", "pip_import")

pip_import(
    name = "pip",
    requirements = "//:requirements.txt",
)

load("@pip//:requirements.bzl", "pip_install")

pip_install()

requirements.txt

tensorflow

BUILD

load("@io_bazel_rules_python//python:python.bzl", "py_binary")
load("@pip//:requirements.bzl", "requirement")

py_binary(
    name = "test",
    srcs = ["test.py"],
    deps = [
        requirement("tensorflow"),
    ],
)

test.py

import tensorflow as tf

if __name__ == "__main__":
  pass

Raises:
ImportError: 'No module named tensorflow'

@jkinkead
Copy link
Contributor

@jkinkead jkinkead commented Apr 9, 2018

I can confirm. The tensorflow module is completely missing a tensorflow directory after being installed as an external repo:

$ ls /private/var/tmp/_bazel_username/c896bd8ffa3b209834c1217c9406dcf0/external/pypi__tensorflow_1_7_0/
BUILD                      WORKSPACE                  tensorflow-1.7.0.data      tensorflow-1.7.0.dist-info
@driveraid
Copy link

@driveraid driveraid commented May 7, 2018

+1, is there any progress on this issue?

@malcolmwhite
Copy link

@malcolmwhite malcolmwhite commented Jul 5, 2018

+1

1 similar comment
@kzadorozhny
Copy link

@kzadorozhny kzadorozhny commented Jul 27, 2018

+1

@jkinkead
Copy link
Contributor

@jkinkead jkinkead commented Jul 27, 2018

Note that this is due to issue #92 . There's a workaround posted there for TensorFlow.

@lberki
Copy link
Collaborator

@lberki lberki commented Jul 30, 2018

See https://groups.google.com/d/msg/bazel-sig-python/iQjV9sfSufw/qRtG3toDBAAJ -- short version: expect improvements to our Python rules in August.

@jpoehnelt
Copy link

@jpoehnelt jpoehnelt commented Aug 23, 2018

Any movement on this? :)

@brandjon
Copy link
Member

@brandjon brandjon commented Aug 23, 2018

Hi Justin, the movement is that I've taken over maintenance on Python-related issues, including rules_python, though I'm still getting a handle on priorities. Is this issue a regression or was it always broken?

@jkinkead
Copy link
Contributor

@jkinkead jkinkead commented Aug 23, 2018

I'm pretty sure the root cause (#92) has always existed.

@therc
Copy link

@therc therc commented Aug 23, 2018

It doesn't seem to have ever worked and it's kinda ironic that what is probably the most popular Bazel project can't be imported from another one through pip. Kinda steers you toward building it through Bazel. Not bad to increase adoption. (That's a silly joke, to be clear.)

@therc
Copy link

@therc therc commented Aug 23, 2018

To add more detail: we use TF both by using pip and compiling sources through a nested workspace, so we get to enjoy the worst of both worlds, when it comes to bugs. This issue is our worst pip headache, along with #96 (packages are fetched eagerly when first starting Bazel, rather than lazily when first using them).

@brandjon brandjon added the untriaged label Nov 9, 2018
@jpvelez
Copy link

@jpvelez jpvelez commented Dec 4, 2018

+1

@jmhodges
Copy link

@jmhodges jmhodges commented Jan 22, 2019

Yeah, I've just now run into this, too. Running a fork of rules_python to fix this doesn't seem like a great workaround

@jmhodges
Copy link

@jmhodges jmhodges commented Jan 22, 2019

(I came to this after giving up on depending on tensorflow as a normal bazel extension, of course. They have that wild user-interaction-required ./configure script you seem to have to run that does a bunch of heuristics on your local filesystem to generate its own bazelrc file. Not great!)

@machinelearner452
Copy link

@machinelearner452 machinelearner452 commented Feb 12, 2019

I tried to get tensorflow to load with anaconda and conda. No success with Windows 10, using python 3.6 and 3.5. Any workaround for Windows without using Linux or Microsoft VS 20XX would be appreciated. https://anaconda.org was not of any use I could find.
C:\Users\Joe\Anaconda3\envs\tensorflow>conda install -c conda-forge tensorflow
Collecting package metadata: done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • tensorflow

Current channels:

To search for alternate channels that may provide the conda package you're
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

@codecakes
Copy link

@codecakes codecakes commented Aug 1, 2019

Just wanted a heads up on whether the No module issue here similar to my issue here: #214

@ali5h
Copy link

@ali5h ali5h commented Oct 22, 2019

try our implementation here https://github.com/ali5h/rules_pip

ChrisCummins added a commit to ChrisCummins/phd that referenced this issue Jan 13, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/gh-archiver that referenced this issue Jan 13, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>

[Exported from 6e9120c2a18494ae23099965a1a882da046d2c59]
ChrisCummins added a commit to ChrisCummins/gh-archiver that referenced this issue Jan 17, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>

[Exported from 6e9120c2a18494ae23099965a1a882da046d2c59]
ChrisCummins added a commit to ChrisCummins/format that referenced this issue Jan 21, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>

[Exported from 6e9120c2a18494ae23099965a1a882da046d2c59]
ChrisCummins added a commit to ChrisCummins/clgen that referenced this issue Feb 14, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>

[Exported from 6e9120c2a18494ae23099965a1a882da046d2c59]
ChrisCummins added a commit to ChrisCummins/clgen that referenced this issue Feb 14, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>

[Exported from 6e9120c2a18494ae23099965a1a882da046d2c59]
ChrisCummins added a commit to ChrisCummins/clgen that referenced this issue May 6, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/ProGraML that referenced this issue Jun 3, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/clgen that referenced this issue Jun 3, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/clgen that referenced this issue Jun 4, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/ProGraML that referenced this issue Jun 4, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/labm8 that referenced this issue Jun 17, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
ChrisCummins added a commit to ChrisCummins/ProGraML that referenced this issue Jun 18, 2020
This is to workaround a known issue with packaging Tensorflow
as a pip dependency in bazel. See:

github.com/bazelbuild/rules_python/issues/71

Signed-off-by: format 2020.01.12 <github.com/ChrisCummins/format>
@carlosgalvezp
Copy link

@carlosgalvezp carlosgalvezp commented Sep 7, 2020

+1, any updates?

@thundergolfer
Copy link
Collaborator

@thundergolfer thundergolfer commented Sep 7, 2020

We're working on incorporating the packaging code from rules_python_external into rules_python. rules_python_external supports importing Tensorflow.

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

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.