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

Build broken with Bazel 2.0.0 #1217

Closed
laszlocsomor opened this issue Jan 22, 2020 · 4 comments · Fixed by #1224
Closed

Build broken with Bazel 2.0.0 #1217

laszlocsomor opened this issue Jan 22, 2020 · 4 comments · Fixed by #1224

Comments

@laszlocsomor
Copy link

Describe the bug

Build is broken on Bazel CI.
Last green: https://buildkite.com/bazel/rules-haskell-haskell/builds/231
First red: https://buildkite.com/bazel/rules-haskell-haskell/builds/232

To Reproduce

Not sure. Build broke on Bazel CI, see log links above.
I couldn't set up the build locally.

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS name + version: Debian testing
  • Bazel version: 2.0.0
  • Version of the rules: see above

Additional context
Add any other context about the problem here.

@aherrmann
Copy link
Member

The error looks like it's caused by a Python version issue.

Use --sandbox_debug to see verbose messages from the sandbox
  | Traceback (most recent call last):
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/sandbox/linux-sandbox/392/execroot/rules_haskell/bazel-out/host/bin/haskell/cabal_wrapper.runfiles/rules_haskell/haskell/cabal_wrapper.py", line 110, in <module>
  | recache_db()
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/sandbox/linux-sandbox/392/execroot/rules_haskell/bazel-out/host/bin/haskell/cabal_wrapper.runfiles/rules_haskell/haskell/cabal_wrapper.py", line 108, in recache_db
  | run([ghc_pkg, "recache", "--package-db=" + package_database])
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/sandbox/linux-sandbox/392/execroot/rules_haskell/bazel-out/host/bin/haskell/cabal_wrapper.runfiles/rules_haskell/haskell/cabal_wrapper.py", line 39, in run
  | subprocess.run(cmd, check=True, *args, **kwargs)
  | AttributeError: 'module' object has no attribute 'run'

cabal_wrapper.py is a Python script that requires Python version 3 due to the use of subprocess.run (added in Python 3.5). The py_binary target specifies python_version = "PY3". With Nix we use nixpkgs_python_configure to configure a Python 3 toolchain. Without Nix we rely on the autodetected Python toolchain. Could this be an instance of bazelbuild/bazel#4815?

@laszlocsomor
Copy link
Author

Could this be an instance of bazelbuild/bazel#4815?

I don't know. @brandjon?

@brandjon
Copy link

brandjon commented Jan 28, 2020

bazelbuild/bazel#4815 is fixed except for on Windows. However, note that if you register a Python toolchain having python_version = "PY3", but it points to a Python interpreter path that is really Python 2, then you'll end up running Python 2 for PY3 targets.

I'd double check that nixpkgs_python_configure's python3_bin_path is actually referring to a Python 3 interpreter in your environment. And if it is, verify that the Python 3 interpreter it's getting is specifically >= 3.5.

@aherrmann
Copy link
Member

@brandjon Thanks for clarifying. I tried to reproduce the issue on our own CI and noticed that the Bazel CI config still disables the python toolchains. Sorry, I overlooked that before. Removing that flag should fix the issue. I've opened #1224 and confirmed on Bazel CI.

@mergify mergify bot closed this as completed in #1224 Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants