adareau / HAL

HAL Atom Locator
GNU General Public License v3.0
2 stars 1 forks source link

Package bug at startup #31

Closed quentinmarolleau closed 3 years ago

quentinmarolleau commented 3 years ago

Ubuntu 20.04.2 LTS

After creating a HAL virtualenv, and locally installing the required packages, the terminal returns this at startup:

(HAL) ***@*******:/*************/HAL$ python start
QObject::moveToThread: Current thread (0x2088bd0) is not the object's thread (0x2eded90).
Cannot move to target thread (0x2088bd0)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/*******/.virtualenvs/HAL/lib/python3.8/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.

Abandon (core dumped)

It seems to be related to a wrong openCV loading

adareau commented 3 years ago

The cv2 package is only used in the Xenics class, in order to load the 16bit png images: see the code here.

I used it because matplotlib/scipy did not manage to load it directly as a 16bit array, which then requires to do some clumsy rescaling... Here is where I found my solution: https://stackoverflow.com/questions/32622658/read-16-bit-png-image-file-using-python

I think that @QuantumVictor and @charlieleprince have been experiencing the same issue. Feel free to find another package to load the 16bit data and to patch the Xenics class accordingly. This should not have any impact on the rest of the code

charlieleprince commented 3 years ago

I had the same issue indeed. Solved it by uninstalling opencv and then installing instead: opencv-python-headless (using pip3)

adareau commented 3 years ago

OK. So far I've been installing packages on my local virtual environment without really checking what's really needed. At some point, we should try to come up with an 'official' requirement list, in the form of a pip-compatible requirements.txt

quentinmarolleau commented 3 years ago

I agree.

The fix proposed by @charlieleprince worked indeed for me. opencv-python-headless is intended for server use and do not embed GUI dependencies (loaded already in matplotlib)...

Btw this kind of issue seems fairly common on the web (in various contexts) and is apparently due to a compatibility clash between matplotlib and opencv during the package loading process. I think that we should create a dedicated issue to investigate a proper way to manage this problem => https://github.com/adareau/HAL/issues/33#issue-896823735