-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Installing opencv-python #1992
Comments
I'm working on adding a short build tutorial to https://wiki.termux.com/wiki/Instructions_for_installing_python_packages. It isn't entirely trivial though, some patching is needed, so it might be worth to package it properly in the long run. |
I have cross compiled it in the past but cross compiling and getting python module i have not done. |
@its-pointless I guess that could be problematic. It seems to use python during the build, and also requires numpy, which is in your repo and not the main repo. The package would probably have to reside in your repository then. I'll continue looking at instructions for compilation on device in any case. |
Thanks a lot! |
@AvielNiego Please try the instructions at https://wiki.termux.com/wiki/Instructions_for_installing_python_packages#opencv. |
Thanks!
Most of the errors are:
|
I believe this is fixed by commit 4130315, try updating all packages and see if it is resolved (you might have to remove the opencv/build folder and start over). |
The warnings can be removed with by running "Cannot locate symbol"-issues are most often solved by first making sure the library providing the symbol is installed, and then running the installation with LDFLAGS set to point to the library containing the symbol that wasn't found. From https://bugs.kde.org/show_bug.cgi?id=335965 it looks like the symbol should be in libboost_python.so. It should be possible to add python supported to boost, it is discussed in the pull request and it is also needed by at least one other package, dlib. When python support for boost exists, you might need to rebuild opencv with |
k iv made a pull request #2004 to add libbost.python if you wait a few momemnts i will get binaries available. |
@its-pointless I tried building opencv again, with But ran into quite a lot of undefined references
Could/should this be dealt with when compiling boost or should/do I need to link against the corresponding libs on device? |
I think adding -lpython3 to ldflags should work. But its probably best make sure boost-python links before hand. |
@its-pointless neither |
i made a big update for boost. fornwall accepted pull request of mine which actually breaks stuff .... oops sorry my fault. |
@its-pointless thanks for your work. Aarch64 would be preferred. |
Already in official repo |
@its-pointless Which PR are you talking about? |
I think i upped to my repo with properly linked libs. try that |
@its-pointless Yepp, your latest version there fixes it, no more errors on import cv2. Are you planning to open a new pull request for the termux repo? |
I suppose i should ... again |
Hi! I've been trying to reproduce the OpenCV compiling in my Termux (Android 8, aarch64) and I'm repeteadly failing at this point:
Using as Cmake flags Thank you, Isma |
@isman7 see the (possibly outdated) instructions at https://wiki.termux.com/wiki/Instructions_for_installing_python_packages#opencv. |
Yes yes, I followed the insturctions. I used them with Searching I found similar issues here: https://stackoverflow.com/questions/4455941/undefined-reference-to-android-log-print However this is talking about compiling some Android SDK stuff, and I don't know how to adapt the line of Android.mk to Makefile. |
I don't think -lpython is necessary, can't remember that I used it at least. Install libboost-python and try this exact command:
From a subdirectory ("build") in the opencv folder, note that everything is on one line. |
Sorry, pre-pended! The only thing i haven't tried it's libboost-python. I'll try again with lboost, and I'll report about in an hour. Thanks for the support! |
It's normal for you to get that error because there was a bug in those two versions: They use It's obviously not a linking problem (coz it's For the error(s) you get on other version(s), we will need to know what they are exactly in order to help. |
That's right, it was the opencv version. The last one from github releases
it's working perfectly.
Maybe, a disclosure about versions has to be added to the wiki.
Thanks for the support.
Ismael
|
Hi! I've successfully compiled OpenCV in my Termux(Android 5.0.2, aarch64), but when I tried to import it in Python3.6(import cv2), I got such an error: Traceback (most recent call last): I am wondering if I should add some compiling options of CMake to compile OpenCV into a 64-bit library but I don't know what should I add. Sincerely hope someone could offer me some help. Thanks! |
With pip3 install opencv-python i got following Pip error log
Output log
|
However i managed to compile and make install but importing gave me below error:
Please someone help in resolving it Solved above error with
|
in build directory go to modules folder and python3 setup.py develop |
Hi, import cv2 I tried setting up protobuf 3.12.2 but that didn't do anything. Do I have to build it from source again? |
I succesfully compiled build and installed opencv from source without any error. But import opencv works only in $HOME and not anywhere else. Also it seems that opencv actually not installed, because no modules whether imread, imageio nothing works it keeps saying no attribute. Also
Above command show
No init.py there and hence complete installation is non functional. While compiling i added python3 support but fails to work But after cmake make and make install steps i goto opencv/modules/python folder and ran python3 setup.py install and it finally installed but then below error occured
Also tried recompiling with -DOPENCV_SKIP_PYTHON_LIADER=ON but same error Also tried python setup.py develop but no success Please help needed |
Thank you @its-pointless and @xeffyr perfectly working on my Xiomi Mibox S Android 9. |
I used this command in termux but not working curl -LO https://its-pointless.github.io/setup-pointless-repo.sh Error |
Must be upgraded to python 3.10 |
Hi, I am also getting the same message like @ABIRHOSSAIN10
as a regular user (not a root) edit: now i get it, the its-pointless repo contains opencv for python 3.9, but the lastest is 3.10 and this one is present in temrux repo |
This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
may I ask how you downgrade python version from 3.10 to 3.9? because I also python 3.10 and want to try. By the way actually starting I install python 3.9.7 but when I bash setup-pointless-repo.sh then it automatic upgrade my python to 3.10... |
Sorry for asking, I would like to ask that actually how to install opencv in termux which can python import and use? because I follow the step which curl the its-pointless repo and bash then pkg install but only in pkg list and haven't in pip list. I also try other method which had found from previous comment but still not working. But I use same way to install numpy and scipy no problem, both of these can found in pip list, just except opencv. Anyone can help me? Im using Android 7.1.1, Termux 0.115, Python 3.9.7 |
Hi, I did not manage to install opencv. The building it from sources was failing and I couldn't solve that. Since then I haven't looked if sth changed. |
oh I see, never my its ok, now I also face the problem, but for your problem I think you can try with Python 3.9 except from 3.10 since for what I know this repo the latest is Python 3.9 and haven't yet prepare for Python 3.10. |
Please let me know if you manage to run python and opencv to use device camera (preferably without root) |
does your #9369 commit suppose to fix the issue? i still can't getting following error:
(error is at very end of above code, |
@gety9 linked commit adds it as a termux package, so install through pkg: |
@Grimler91 thanks for quick reply, it worked, and opencv-python is seems to be installed:
however when i try to install (that's the package i need opencv-python for) it starts to build opencv-python again:
could you please help me understand what i am doing wrong? how to make it accept already installed opencv-python? |
$ dpkg -c ./opencv-python_4.5.5-1_aarch64.deb | awk '{print $6}' | tree --fromfile
data
└── data
└── com.termux
└── files
└── usr
└── lib
└── python3.10
└── site-packages
└── cv2
├── __init__.py
├── config-3.10.py
├── config.py
├── gapi
│ └── __init__.py
├── load_config_py2.py
├── load_config_py3.py
├── mat_wrapper
│ └── __init__.py
├── misc
│ ├── __init__.py
│ └── version.py
├── python-3.10
│ └── cv2.cpython-310.so
└── utils
└── __init__.py
15 directories, 11 files I think something like |
Hey,
Is there a way to install opencv-python?
The standard
pip3 install opencv-python
returns
The text was updated successfully, but these errors were encountered: