question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mobile-install is failing on a python import error

See original GitHub issue

Description of the problem / feature request:

I’m attempting to run bazel mobile-install for an android_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:

$ bazel mobile-install //app/src:app_binary --start_app --incremental

INFO: Analyzed target //app/src:app_binary (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/jeremymuhia/development/mono/android/app/src/BUILD:5:15: Installing //app/src:app_binary incrementally failed (Exit 1): incremental_install failed: error executing command bazel-out/darwin-py2-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/incremental_install --output_marker bazel-out/darwin-fastbuild/bin/app/src/app_binary_files/incremental_deploy_marker ... (remaining 10 argument(s) skipped)
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_jeremymuhia/f9dfbeb00953a93e3d2ab5498ee6f23d/execroot/__main__/bazel-out/darwin-py2-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/incremental_install.runfiles/bazel_tools/tools/android/incremental_install.py", line 25, in <module>
    from concurrent import futures
ImportError: No module named concurrent
Target //app/src:app_binary failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.270s, Critical Path: 0.11s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully

This seems peculiar because when I build an apk with bazel build //app/src:app_binary and install it manually with adb 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. The incremental_install.py file seems to depend on a concurrent module/file that can’t be pip 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 executing bazel 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 ?

https://github.com/veganafro/mono.git
cefc78574a063a945098b01b70f4de5c385717ea
cefc78574a063a945098b01b70f4de5c385717ea

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ahumeskycommented, May 12, 2021

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.

0reactions
sgowrojicommented, Jul 13, 2022

We are closing this issue as we can see it is resolved from the above workaround comments #1 #2 #3 #4. Please reach us back if the issue still persists or reopen a new issue by adding the above as reference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running Android app using Bazel fails due to python import
It looks like the failure is due to a bad import statement: from queue import Queue. I know that 'Queue' was switched to...
Read more >
Traps for the Unwary in Python's Import System
While Python 3.3+ is able to import the submodule without any problems: ... line 1, in <module> ImportError: No module named 'example.foo'.
Read more >
imp — Access the import internals — Python 3.11.1 ...
If the search is unsuccessful, ImportError is raised. Other exceptions indicate problems with the arguments or environment. If the module is a package, ......
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
Error when importing TensorFlow | Apple Developer Forums
_multiarray_umath failed to import ImportError: numpy.core.umath failed to ... line 37, in <module> from tensorflow.python.tools import module_util as ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found