Error: "The typed_ast package is not installed"
Closed this issue · 2 comments
Trying to integrate bazel-mypy-integration
on a project using Python 3.8.6, I get the error "The typed_ast package is not installed". As this is a transitive dependency, I considered that I may have a Python binary mismatch of some kind, but I can't find any indication of that.
This is using bazel-mypy-integration-0.1.0
and rules-python-0.1.0
.
I'm excited to try bazel-mypy-integration
out - thank you for all the effort! Here's the build error:
INFO: Invocation ID: a0d1c3a2-24ca-4731-aaeb-d0fe41c60b45
DEBUG: /private/var/tmp/_bazel_dan/cebcfff554bef27d2846af867a1d4809/external/rules_python/python/legacy_pip_import/pip.bzl:143:10: DEPRECATED: the pip_import rule has been replaced with pip_install, please see rules_python 0.1 release notes
INFO: Analyzed target //processors/context/cli:cli (1 packages loaded, 2 targets configured).
INFO: Found 1 target...
ERROR: /Users/dan/src/10x/data-fixer/datafixer/processors/context/cli/BUILD.bazel:4:10: Type-checking //processors/context/cli:cli failed (Exit 1): cli_mypy_exe failed: error executing command bazel-out/darwin-fastbuild/bin/processors/context/cli/cli_mypy_exe
Use --sandbox_debug to see verbose messages from the sandbox cli_mypy_exe failed: error executing command bazel-out/darwin-fastbuild/bin/processors/context/cli/cli_mypy_exe
Use --sandbox_debug to see verbose messages from the sandbox
The typed_ast package is not installed.
You can install it with `python3 -m pip install typed-ast`.
Aspect @mypy_integration//:mypy.bzl%mypy_aspect of //processors/context/cli:cli failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.823s, Critical Path: 0.69s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
I tracked this down to bazel-mypy-integration
using a system version of Python 3.7, rather than the expected pyenv-managed 3.8.6. I was able to fix by creating a Python toolchain with the appropriate Python 3 version.
To anyone who finds this in the future - there are many examples of how to do this: https://github.com/search?l=Starlark&q=toolchain+py_runtime+py_runtime_pair&type=Code
@danielnaab thanks for posting this issue. Your issue also related to #22 I think.
There's a code and/or documentation problem around which particular Python interpreter is used by the integration when its repository rule executes. It's a rough/sharp edge.