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.

On Virtual Machine, this error arises when openCV is filled in the requirement in the spec file

See original GitHub issue
[INFO]:    python2 already patched, skipping
[INFO]:    Prebuilding numpy for armeabi-v7a
[INFO]:    numpy has no prebuild_armeabi_v7a, skipping
[WARNING]: Numpy is built assuming the archiver name is arm-linux-androideabi-ar, which may not always be true!
[INFO]:    Applying patches for numpy[armeabi-v7a]
[INFO]:    numpy already patched, skipping
[INFO]:    Prebuilding sdl2 for armeabi-v7a
[INFO]:    sdl2 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for sdl2[armeabi-v7a]
[INFO]:    sdl2 already patched, skipping
[INFO]:    Prebuilding six for armeabi-v7a
[INFO]:    six has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding opencv for armeabi-v7a
[INFO]:    Applying patches for opencv[armeabi-v7a]
[INFO]:    Applying patch patches/p4a_build-2.4.10.1.patch
[INFO]:    -> running patch -t -d /home/kivy/Desktop/Cam/.buildozer/android/platform/build/build/other_builds/opencv/armeabi-v7a/opencv -p1 -i /home/kivy/Desktop/Ca...(and 127 more)
           working: 2 out of 2 hunks ignored                                                                                                 Exception in thread background thread for pid 28277:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /usr/bin/patch -t -d /home/kivy/Desktop/Cam/.buildozer/android/platform/build/build/other_builds/opencv/armeabi-v7a/opencv -p1 -i /home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipes/opencv/patches/p4a_build-2.4.10.1.patch

  STDOUT:
patching file cmake/OpenCVDetectPython.cmake
Hunk #1 FAILED at 36.
Hunk #2 FAILED at 51.
Hunk #3 FAILED at 117.
3 out of 3 hunks FAILED -- saving rejects to file cmake/OpenCVDetectPython.cmake.rej
patching file modules/python/CMakeLists.txt
Hunk #1 FAILED at 5.
1 out of 1 hunk FAILED -- saving rejects to file modules/python/CMakeLists.txt.rej
can't find file to patch at input line 49
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/modules/androidcamera/src/camera_activity.cpp b/modules/androidcamera/src/camera_activity.cpp
|index 84db3e1..4222526 100644
|--- a/modules/androidcamera/src/camera_activity.cpp
|+++ b/modules/androidcamera/src/camera_activity.cpp
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored


  STDERR:


[INFO]:    STDOUT (last 10 lines of 19):
	Perhaps you used the wrong -p or --strip option?	
The text leading up to this was:	
--------------------------	
|diff --git a/modules/androidcamera/src/camera_activity.cpp b/modules/androidcamera/src/camera_activity.cpp	
|index 84db3e1..4222526 100644	
|--- a/modules/androidcamera/src/camera_activity.cpp	
|+++ b/modules/androidcamera/src/camera_activity.cpp	
--------------------------	
No file to patch.  Skipping patch.	
2 out of 2 hunks ignored
[INFO]:    STDERR:
	
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 565, in build_recipes
    recipe.prebuild_arch(arch)
  File "/home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipes/opencv/__init__.py", line 22, in prebuild_arch
    self.apply_patches(arch)
  File "pythonforandroid/recipe.py", line 486, in apply_patches
    arch.arch)
  File "pythonforandroid/recipe.py", line 194, in apply_patch
    "-i", filename, _tail=10)
  File "pythonforandroid/logger.py", line 175, in shprint
    for line in output:
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 720, in next
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/bin/patch -t -d /home/kivy/Desktop/Cam/.buildozer/android/platform/build/build/other_builds/opencv/armeabi-v7a/opencv -p1 -i /home/kivy/Desktop/Cam/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipes/opencv/patches/p4a_build-2.4.10.1.patch

  STDOUT:
patching file cmake/OpenCVDetectPython.cmake
Hunk #1 FAILED at 36.
Hunk #2 FAILED at 51.
Hunk #3 FAILED at 117.
3 out of 3 hunks FAILED -- saving rejects to file cmake/OpenCVDetectPython.cmake.rej
patching file modules/python/CMakeLists.txt
Hunk #1 FAILED at 5.
1 out of 1 hunk FAILED -- saving rejects to file modules/python/CMakeLists.txt.rej
can't find file to patch at input line 49
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/modules/androidcamera/src/camera_activity.cpp b/modules/androidcamera/src/camera_activity.cpp
|index 84db3e1..4222526 100644
|--- a/modules/androidcamera/src/camera_activity.cpp
|+++ b/modules/androidcamera/src/camera_activity.cpp
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored


  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy,opencv --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/Desktop/Cam/.buildozer/android/platform/build

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AndreMirascommented, Jul 24, 2018

Yes I think I saw the numpy error when I tried to reproduce your issue with opencv. I could compile opencv without issue, however yes if I recall correctly I think I saw numpy crashed. The funny thing is numpy is part of the integration testing https://github.com/kivy/python-for-android/pull/1304/files So it would be interesting to see how it differs from your local installation. Edit: Also I saw a lot of numpy related tickets already, can you check if you find one that matches your issue? I think there’s a branch that fix some numpy issues, but broke it for crystax so it the pull request was reverted, but the branch is still here.

0reactions
prerna-khannacommented, Jul 24, 2018

I cloned the p4abranch: git clone git://github.com/kivy/python-for-android and changed the p4a source directory in spec file to this, it resolved the numpy error for me, but an error still persists with openCV regarding CMake ( I have raised another issue for that.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'cv2' in Python
The Python "ModuleNotFoundError: No module named 'cv2'" occurs when we forget to install the opencv-python module before importing it or install ...
Read more >
Could not find a version that satisfies the requirement opencv ...
I faced same issue while using Python 3.9. 0. Upgrading python to latest version (currently 3.9. 1) and reinstalling opencv-python solved this ...
Read more >
How to Handle the UnsatisfiedLinkError Runtime Error in Java
The Java java.lang.UnsatisfiedLinkError is thrown when a program uses a native libaray but is unable to find it at runtime for some reason....
Read more >
VirtualMachine (Attach API ) - Oracle Help Center
In this example we attach to a Java virtual machine that is identified by the process ... function returns an error: IOException -...
Read more >
Cisco Expressway on Virtual Machine Installation Guide (X14.0)
Virtual Machine Requirements 7. Specifications-Based System – Minimum Specification 8. How to Modify Expressway VM Capacity 9.
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