-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
mobile-install is failing on a python import error #12741
Comments
I believe this will be fixed in the next bazel release. |
I worked around this using rules_nixpkgs and rules_python:
load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_cc_configure", "nixpkgs_git_repository", "nixpkgs_package")
nixpkgs_package(
name = "python37",
repositories = {"nixpkgs": "@nixpkgs//:default.nix"},
)
nixpkgs_package(
name = "python27",
nix_file = "//:python27.nix",
repositories = {"nixpkgs": "@nixpkgs//:default.nix"},
)
register_toolchains("//:my_py_toolchain")
{pkgs ? import <nixpkgs> {}}:
{
python27 = (pkgs.python2.withPackages (packages: [packages.futures]));
}
py_runtime(
name = "python2_runtime",
interpreter = "@python27//:bin/python",
python_version = "PY2",
visibility = ["//visibility:public"],
)
py_runtime(
name = "python3_runtime",
interpreter = "@python37//:bin/python",
python_version = "PY3",
visibility = ["//visibility:public"],
)
py_runtime_pair(
name = "my_py_runtime_pair",
py2_runtime = ":python2_runtime",
py3_runtime = ":python3_runtime",
)
toolchain(
name = "my_py_toolchain",
toolchain = ":my_py_runtime_pair",
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
) Since I was already using rules nix, this was also an easy way to lock down the python version, and provide whatever extra packages I need. |
@veganafro , that is because you might be using python3 and bazel uses python2, even I had the same problem, so this is how I figure it out,
|
Duplicate issue over at |
No longer a viable option moving forward with the latest version of pip dropping support for Python 2.7 🙈
Also, I believe Bazel currently has mixed support for python2 and python3, with a lot of work already done to support a python3 toolchain. It also looks like there's some work underway to complete the move to Python3 with the following PR #11201. |
@rockwotj is there a merged pull request/closed issue we can track to see if this has already been resolved or not? |
Has this issue been solved? The mobile-install is still throwing error for the concurrent module. How can I run my app? |
Has this issue been solved? I still face this issue |
The tool that's crashing has been migrated to python3, so first check if installing python3 solves the issue if you don't already have it installed. |
Thanks for the prompt response. The problem is solved |
@Monibsediqi sir, may I ask how you solved the issue? |
@KanzaSheikh, I don't remember well but I guess the problem was with python. I had installed python using anaconda. So I reinstalled it using pip. I guess that solved my problem at that moment. Then, I had to track down a series of other issues that I forgot how this one was solved. Hope it helps |
@Monibsediqi Thanks for answering! I'll try this out |
On macOS Big Sur I managed to fix the issue by running |
I also have this issue. I've tried various combinations of workarounds in this thread, but none of them have worked for me. Specifying a python toolchain (via my pyenv versions or via nix) seemed to get the closest, though I then started seeing some queue import issue. I did find a different workaround. I don't quite follow how/why toolchains are related to this issue, but this approach currently seems to be working for me.
|
Description of the problem / feature request:
I'm attempting to run
bazel mobile-install
for anandroid_binary
target. The app is the simple hello world app generated by the single activity app base in Android Studio.This is the incorrect output I'm seeing:
This seems peculiar because when I build an apk with
bazel build //app/src:app_binary
and install it manually withadb install bazel-bin/app/src/app_binary.apk
, I can see that the app is installed on the device and is without any runtime errors.Feature requests: what underlying problem are you trying to solve with this feature?
mobile-install
does not seem to be working correctly. Theincremental_install.py
file seems to depend on aconcurrent
module/file that can't bepip
installed and doesn't seem to be packaged with Bazel.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
This repo contains the source code for the template Android app. Cloning, navigating to the
android
directory, and executingbazel mobile-install //app/src:app_binary --start_app --incremental
should reproduce the error.What operating system are you running Bazel on?
macOS Catalina version 10.15.6
What's the output of
bazel info release
?release 3.7.2-homebrew
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?The text was updated successfully, but these errors were encountered: