Erotemic/ibeis

Import Error occured and aborted

Candysoda22 opened this issue · 20 comments

After I installed the IBEIS, I put the command "ibeis" in terminal.
However, following messages/codes occured.
How can I fix this problem?

My Developmenal environment ; Ubuntu 18.04 / Python 3.6.12

tester@tester-HP-Z6-G4-Workstation:~/ibeis_cnn-master$ ibeis
VTOOL_IBEIS BACKEND FOR pyflann = <module 'pyflann_ibeis' from '/home/tester/.local/lib/python3.6/site-packages/pyflann_ibeis/init.py'>
VTOOL_IBEIS BACKEND FOR FLANN_CLS = <class 'pyflann_ibeis.index.FLANN'>
/home/tester/.local/lib/python3.6/site-packages/ibeis/control/IBEISControl.py:128: UserWarning: Unable to load plugin: 'ibeis_cnn'
warnings.warn('Unable to load plugin: {!r}'.format(modname))
/home/tester/.local/lib/python3.6/site-packages/ibeis/control/IBEISControl.py:128: UserWarning: Unable to load plugin: 'ibeis_cnn._plugin'
warnings.warn('Unable to load plugin: {!r}'.format(modname))
Warning: Import Error: No module named 'sip'
/home/tester/.local/lib/python3.6/site-packages/plottool_ibeis/MPL_INIT.py:142: MatplotlibDeprecationWarning:
The keymap.all_axes rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
mpl.rcParams[key] = ''

_____ ______  _______ _____ _______
  |   |_____] |______   |   |______
__|__ |_____] |______ __|__ ______|

[main] ibeis.main_module.main()
[main] MAIN DIAGNOSTICS
[main] * username = 'tester'
[main] * ibeis.version = '2.2.4'
[main] * computername = 'tester-HP-Z6-G4-Workstation'
[main] * cwd = '/home/tester/ibeis_cnn-master'
[main] * sys.argv = ['/home/tester/.local/bin/ibeis']
[main!] WARNING: args.dbdir is None
[main] _init_gui()
[guitool_ibeis] Init new QApplication
QObject::moveToThread: Current thread (0x55c123744640) is not the object's thread (0x55c124b6bcf0).
Cannot move to target thread (0x55c123744640)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/tester/.local/lib/python3.6/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

Aborted (core dumped)

I recently updated the README with a fix for this: https://github.com/Erotemic/ibeis#installation-instructions-updated-2020-nov-01

Run:

pip uninstall opencv-python
pip install opencv-python-headless

I'm curious are you on a VM or is this on regular Ubuntu? I'm wondering if I should change the requirements in requirements/runtime.txt from opencv-python to opencv-python-headless, but I've never had an issue with the former on my Ubuntu machine. If this is a VM thing, I'll likely leave it alone, but if this is a new issue on recent Ubuntu versions, I'll want to change it. (Might also be nice to see if we can test for this error before the core dump happens. I've encountered a similar issue in other libraries, so having a check/test for this would be nice)

@bluemellophone : Giving you a heads up on the solution to this error. Don't think you are using PyQt5, but just in case you are using it in the backend / ever run into this error.

Yes, we have stumbled on this as well. We have the challenge of PyPI dependencies we install rely on opencv-python so there is a dance of either uninstalling them and installing opencv-python-headless or uninstalling all opencv-python* packages so that we can default to using the cv2.so that was built from source.

For what it's worth, we have a full DevOps build path with Docker on GitHub: https://github.com/WildbookOrg/wildbook-ia/tree/master/devops. This builds dependencies from source (e.g. OpenCV) and installs all of the packages from their respective repositories for the latest development branches.

I recently updated the README with a fix for this: https://github.com/Erotemic/ibeis#installation-instructions-updated-2020-nov-01

Run:

pip uninstall opencv-python
pip install opencv-python-headless

I'm curious are you on a VM or is this on regular Ubuntu? I'm wondering if I should change the requirements in requirements/runtime.txt from opencv-python to opencv-python-headless, but I've never had an issue with the former on my Ubuntu machine. If this is a VM thing, I'll likely leave it alone, but if this is a new issue on recent Ubuntu versions, I'll want to change it. (Might also be nice to see if we can test for this error before the core dump happens. I've encountered a similar issue in other libraries, so having a check/test for this would be nice)

@bluemellophone : Giving you a heads up on the solution to this error. Don't think you are using PyQt5, but just in case you are using it in the backend / ever run into this error.

I have met the same problem, followed the instructions: uninstall opencv-python, install opencv-python-headless, but still not working.

I found that sometimes the qt libraries still existed even after uninstalling opencv-python. I'm going to try to look for a solution that doesn't require hacky fixes after installation. Its my goal to have a user be able to pip install ibeis and have it "just work".

In the meantime try this:

Run this to figure out where opencv lives:

python -c "import cv2; print(cv2.__file__)"

For me this was

/home/joncrall/.local/conda/envs/py38/lib/python3.8/site-packages/cv2/cv2.cpython-38-x86_64-linux-gnu.so

The important bit is to figure out where site-packages is, a more direct way to get it is:

python -c 'import site; print(site.getsitepackages()[0])'

which gives: /home/joncrall/.local/conda/envs/py38/lib/python3.8/site-packages.

In this folder there are two folders "cv2" and "opencv_python.libs" (and mabye "opencv_python_headless.libs") folder, which I think are part of the problem.

To be absolutely sure pip removed everything it can run:

pip uninstall opencv-python-headless -y
pip uninstall opencv-python -y
pip uninstall opencv-python-headless -y
pip uninstall opencv-python -y

Then check that all the above folders are gone. Just to be sure try to remove them:

SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
rm -rf $SITE_PACKAGES/cv2
rm -rf $SITE_PACKAGES/cv2/qt
rm -rf $SITE_PACKAGES/cv2/opencv_python.libs
rm -rf $SITE_PACKAGES/cv2/opencv_python_headless.libs

Then hopefully we can get a clean install:

pip install opencv-python-headless

Check that the qt libs are gone with:

SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
ls $SITE_PACKAGES/cv2
ls $SITE_PACKAGES/cv2/qt/plugins

Now when I'm running ibeis I get:

pkg_resources.DistributionNotFound: The 'opencv-python' distribution was not found and is required by vtool-ibeis

(really annoying that it won't let you even run).

I had to checkout the master branch of vtool, remove opencv-python from the requirements and then run ./run_manylinux_build.sh and then pip install wheelhouse/vtool_ibeis-2.1.1-cp38-cp38-manylinux2010_x86_64.whl the resulting wheel.

At that point I was able to run ibeis and it worked. I'll work on trying to fix this so workarounds are not needed.

Is there a solution to this problem as of now? I ran into the same problem

I think I need to release a new version of vtool that does not depend on opencv. The above workaround does work, but I'm unaware of any way to make it just work out of the box anymore :(

Any news on this?
I am a beginner in linux and python! I am running on a pc virtual environment.
Ibeis is installed. When giving instruction "ibeis" the result is "Command not found"!
I hope for a solution!:)

@oywiig What you are describing is a different error. It sounds like you don't have the right virtual environment enabled.

The latest version of IBEIS on pypi, no longer has either opencv or opencv-python as a requirement. This is the best work around to this issue that I think is possible. The software should work if you have either opencv-python or opencv-python-headless installed. So you can (1) install one or the other manually yourself.

The other option is when you install ibeis tell it it needs the extra requirement: headless or graphics via:

pip install ibeis[headless] or pip install ibeis[graphics] (the headless one should be preferred). If you install ibeis and try to run it without one of these now it will give you an error message saying you have to choose one or the other.

Thank you very much for help!! I will try it out!
Cheers
Øystein

I'm reopening this because it seems that people are still running into it.

Hello,
I've tried to install the ibeis on wsl, but have encountered numerous problems. However, i am still stuck on this one, even after doing the uninstall the headless python and reinstalled it. I have tried using the command lines to find out if there are the packages installed (python -c "import cv2; print(cv2.file)"), but these are just not working at all and i'm getting this error (Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3)
Can you please help
~$ ibeis

_____ ______  _______ _____ _______
  |   |_____] |______   |   |______
__|__ |_____] |______ __|__ ______|

[main] ibeis.main_module.main()
[main] MAIN DIAGNOSTICS
[main] * username = 'sarvesh'
[main] * ibeis.version = '2.3.1'
[main] * computername = 'Ecosud-tbk1'
[main] * cwd = '/home/sarvesh'
[main] * sys.argv = ['/home/sarvesh/.local/bin/ibeis']
[main!] WARNING: args.dbdir is None
[main] _init_gui()
[guitool_ibeis] Init new QApplication
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted

I have tried using the command lines to find out if there are the packages installed

The errors you are getting are indicating to me that you are not in a virtual environment and you are using your system python. In this instance you likely need to run with python3 instead of python.

I'll also not I've never gotten IBEIS to work on WSL, but I've only tried on a low-powered windows10 laptop which doesn't have WSL2. WSL1 definately doesn't work. WSL2 might, but I've never been able to try it.

I have tried but to no avail. My wsl is on version 2 but it's still not working

@oywiig were you running on WSL?

@themac1998 Please go back and carefully read the instructions, especially regarding installing Python. This program has been primarily tested in a Python virtual enviornment, so I strongly recommend you mirror that in your setup. On windows you can use miniconda: https://docs.conda.io/en/latest/miniconda.html to create a conda virtual environment.

FWIW I don't think the 3.7 vs 3.8 matters. I think it's an issue of getting the Qt and OpenCV dependencies setup in a way such that they aren't conflicting with each other - which has proven to be tricky, especially for people who aren't full time Python experts.