Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qt complaining 2 sets of binaries

Tags:

opencv

conda

qt

I am trying to setup a environment using conda. My environemnt.yml looks like:

name: name
channels:
  - defaults
  - conda-forge
  - pytorch
  # - fastai
dependencies:
  - python = 3.7.5
  - numpy
  - pillow
  - matplotlib
  - pytorch
  - torchvision
  # - json
  # - zipfile
  # - csv
  - pandas
  # - pickle
  # - glob
  - scikit-learn
  - pip # needed to install pip dependencies below
  - pip:
    # - opencv-contrib-python
    -  opencv-python
  - pyarrow
  # - qt

I have been trying to add and remove the qt package. If I remove qt, I got [qt.qpa.plugin] Could not find the Qt platform plugin "cocoa" in ""

Then I tried to add qt, hoping I can get the cocoa plugin

When I run application, I get

objc[4831]: Class RunLoopModeTracker is implemented in both /opt/miniconda3/envs/grapheme/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x11e1e87f0) and /opt/miniconda3/envs/grapheme/lib/libQt5Core.5.9.7.dylib (0x1a33234a80). One of the two will be used. Which one is undefined.
loaded library "/opt/miniconda3/envs/grapheme/plugins/platforms/libqcocoa.dylib"
QObject::moveToThread: Current thread (0x7fb18afea390) is not the object's thread (0x7fb18f900090).
Cannot move to target thread (0x7fb18afea390)

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
QObject::moveToThread: Current thread (0x7fb18afea390) is not the object's thread (0x7fb18f900090).
Cannot move to target thread (0x7fb18afea390)

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "/opt/miniconda3/envs/grapheme/plugins/platforms/" 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: cocoa (from /opt/miniconda3/envs/grapheme/plugins/platforms/), minimal (from /opt/miniconda3/envs/grapheme/plugins/platforms/), offscreen (from /opt/miniconda3/envs/grapheme/plugins/platforms/), cocoa, minimal, offscreen.
like image 538
BersaKAIN Avatar asked Feb 17 '20 23:02

BersaKAIN


1 Answers

This fixed my problem. You can try it.

pip install opencv-python-headless

These packages do not contain any GUI functionality. They are smaller and suitable for more restricted environments. run pip install opencv-python-headless if you need only main modules source: https://pypi.org/project/opencv-python/

like image 170
Burak Oral Avatar answered Sep 30 '22 12:09

Burak Oral