Erotemic / ibeis

image based ecological information system
Apache License 2.0
49 stars 17 forks source link

Import Error occured and aborted #73

Open Candysoda22 opened 3 years ago

Candysoda22 commented 3 years ago

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)

Erotemic commented 3 years ago

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.

bluemellophone commented 3 years ago

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.

shamoqianting commented 3 years ago

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.

Erotemic commented 3 years ago

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.

faqihbig commented 3 years ago

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

Erotemic commented 3 years ago

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 :(

oywiig commented 2 years ago

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!:)

Erotemic commented 2 years ago

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

oywiig commented 2 years ago

Thank you! Is it at all possible for you to suggest a solution??

From: Jon Crall @.> Sent: Saturday, March 5, 2022 6:14 PM To: Erotemic/ibeis @.> Cc: Øystein Wiig @.>; Mention @.> Subject: Re: [Erotemic/ibeis] Import Error occured and aborted (#73)

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

— Reply to this email directly, view it on GitHubhttps://github.com/Erotemic/ibeis/issues/73#issuecomment-1059799074, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYCTN6MJ2BCFUPENP7SS6KDU6OI5ZANCNFSM4TG6N7PA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

oywiig commented 2 years ago

Here is a screenshot of my Linux PC after "pip install ibeis". Does it help to explain what is wrong with the setup??

-----Original Message----- From: Jon Crall @.> Sent: Saturday, March 5, 2022 6:14 PM To: Erotemic/ibeis @.> Cc: Øystein Wiig @.>; Mention @.> Subject: Re: [Erotemic/ibeis] Import Error occured and aborted (#73)

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

— Reply to this email directly, view it on GitHub https://github.com/Erotemic/ibeis/issues/73#issuecomment-1059799074 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AYCTN6MJ2BCFUPENP7SS6KDU6OI5ZANCNFSM4TG6N7PA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AYCTN6LJJ6UU4MSNXF7SCOLU6OI5ZA5CNFSM4TG6N7PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOH4VUAIQ.gif Message ID: @.***>

Erotemic commented 2 years ago

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.

oywiig commented 2 years ago

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

Erotemic commented 1 year ago

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

themac1998 commented 1 year ago

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

Erotemic commented 1 year ago

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.

themac1998 commented 1 year ago

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

oywiig commented 1 year ago

Hi,

I had problems with installing and running IBEIS last year. It was solved by using Python 3.7 and not 3.8 or newer. 3.8 needed to be completely removed before reinstalling 3.7. However, I do not know if this solution solves your problem! 😊 Cheers Øystein

From: themac1998 @.> Sent: mandag 6. mars 2023 17:59 To: Erotemic/ibeis @.> Cc: Øystein Wiig @.>; Comment @.> Subject: Re: [Erotemic/ibeis] Import Error occured and aborted (#73)

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

— Reply to this email directly, view it on GitHubhttps://github.com/Erotemic/ibeis/issues/73#issuecomment-1456520205, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYCTN6LHPC2H267YXWJFA6TW2YJT7ANCNFSM4TG6N7PA. You are receiving this because you commented.Message ID: @.***>

Erotemic commented 1 year ago

@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.

oywiig commented 1 year ago

Probably not WSL! Need to check with the IT helpdesk at the University of Oslo, who helped me with this installation.

From: Jon Crall @.> Sent: tirsdag 7. mars 2023 17:13 To: Erotemic/ibeis @.> Cc: Øystein Wiig @.>; Mention @.> Subject: Re: [Erotemic/ibeis] Import Error occured and aborted (#73)

@oywiighttps://github.com/oywiig were you running on WSL?

@themac1998https://github.com/themac1998 Please go back and carefully read the instructionshttps://github.com/Erotemic/ibeis#installation-instructions-updated-2020-nov-01, especially regarding installing Pythonhttps://xdoctest.readthedocs.io/en/latest/installing_python.html. 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.

— Reply to this email directly, view it on GitHubhttps://github.com/Erotemic/ibeis/issues/73#issuecomment-1458440075, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYCTN6MK7NJ5HJSLRZ5Z3BDW25NCPANCNFSM4TG6N7PA. You are receiving this because you were mentioned.Message ID: @.***>

oywiig commented 1 year ago

I just confirm I am not running WSL!

From: Øystein Wiig Sent: tirsdag 7. mars 2023 17:34 To: 'Erotemic/ibeis' @.>; Erotemic/ibeis @.> Cc: Mention @.***> Subject: RE: [Erotemic/ibeis] Import Error occured and aborted (#73)

Probably not WSL! Need to check with the IT helpdesk at the University of Oslo, who helped me with this installation.

From: Jon Crall @.**@.>> Sent: tirsdag 7. mars 2023 17:13 To: Erotemic/ibeis @.**@.>> Cc: Øystein Wiig @.**@.>>; Mention @.**@.>> Subject: Re: [Erotemic/ibeis] Import Error occured and aborted (#73)

@oywiighttps://github.com/oywiig were you running on WSL?

@themac1998https://github.com/themac1998 Please go back and carefully read the instructionshttps://github.com/Erotemic/ibeis#installation-instructions-updated-2020-nov-01, especially regarding installing Pythonhttps://xdoctest.readthedocs.io/en/latest/installing_python.html. 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.

— Reply to this email directly, view it on GitHubhttps://github.com/Erotemic/ibeis/issues/73#issuecomment-1458440075, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYCTN6MK7NJ5HJSLRZ5Z3BDW25NCPANCNFSM4TG6N7PA. You are receiving this because you were mentioned.Message ID: @.**@.>>