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

Python 3 support? #1406

Closed
joshburkart opened this issue Jun 14, 2016 · 5 comments
Closed

Python 3 support? #1406

joshburkart opened this issue Jun 14, 2016 · 5 comments

Comments

@joshburkart
Copy link

Here's my BUILD file:

py_library(
    name="basis",
    srcs=["basis.py"],
    srcs_version="PY3ONLY",
)

py_test(
    name="basis_test",
    srcs=["basis_test.py"],
    deps=[
        ":basis",
    ],
    srcs_version="PY3ONLY",
)

Unfortunately, when I execute bazel test basis_test, I get

ERROR: /blah/BUILD:7:1: in py_test rule //blah:basis_test: Rule '//blah:basis_test' can only be used with Python 3, and cannot be converted to Python 2.
ERROR: Analysis of target '//blah:basis_test' failed; build aborted.
INFO: Elapsed time: 1.560s
ERROR: Couldn't start the build. Unable to run tests.

Is there an easy workaround? I have Python 3 installed and all. Thanks!

@hermione521
Copy link
Contributor

Sorry, we don't have Python 3 support yet. @lberki do we have any workaround?

@lberki
Copy link
Contributor

lberki commented Jun 15, 2016

Does adding --force_python=PY3 to the command line of Bazel work?

@bsilver8192
Copy link
Contributor

I've been having success with default_python_version = "PY3", on each rule too (in addition to srcs_version).

I think --force_python=PY3 --host_force_python=PY3 should work without needing to set two attributes on each rule, but I haven't actually gotten around to trying it.

@joshburkart
Copy link
Author

Thanks for the responses! Working great now. Just needed to set srcs_version = "PY3" on everything, and default_python_version = "PY3" only on tests and binaries.

@lc0
Copy link

lc0 commented Apr 27, 2018

Seems like force_python=py2 was removed tensorflow/serving@5369880#diff-4c3a4e61471476647ad1c0987a744414L4

Does it mean you officially support python 3?

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

5 participants