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

Closed
vertix opened this issue Feb 28, 2018 · 20 comments
Closed

pip_import doesn't work with tensorflow #71

vertix opened this issue Feb 28, 2018 · 20 comments
Assignees

Comments

@vertix
Copy link

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 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

+1, is there any progress on this issue?

@malcolmwhite
Copy link

+1

1 similar comment
@kzadorozhny
Copy link

+1

@jkinkead
Copy link
Contributor

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

@lberki
Copy link
Collaborator

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

Any movement on this? :)

@brandjon
Copy link
Member

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

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

@therc
Copy link

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 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).

@jpvelez
Copy link

jpvelez commented Dec 4, 2018

+1

@jmhodges
Copy link

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

(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

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

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

@ali5h
Copy link

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

+1, any updates?

@thundergolfer
Copy link
Collaborator

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

@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
Projects
None yet
Development

No branches or pull requests