NICALab/SUPPORT

PyQt5 import issue when running the GUI

Closed this issue · 15 comments

Hi, after the installation I tried to launch the GUI, first the "no module" error popped up for PyQt5 so I pip installed PyQt5, and then there was the import error "symbol qt_version_tag version Qt_5.15 not defined in file libQt5Core.so.5 with link time reference" for PyQt5.QtWidgets.
Any hints?

Could you please tell us your PyQt5 version and your OS?

FYI, I briefly checked that

PyQt5=5.9.2
PyQt5-Qt5=5.15.2
PyQt5-sip=12.9.0

with Ubuntu 20.04.1 LTS

successfully worked well.

Also, are you running on the server without GUI/monitor, or on the local computer?

Could you please tell us your PyQt5 version and your OS?

FYI, I briefly checked that

PyQt5=5.9.2
PyQt5-Qt5=5.15.2
PyQt5-sip=12.9.0

with Ubuntu 20.04.1 LTS

successfully worked well.

Also, are you running on the server without GUI/monitor, or on the local computer?

Thanks for the reply, Steve. I was running it on GPU server with RHEL6.
pyqt5=5.15.7
pyqt5-qt5=5.15.2
pyqt5-sip=12.11.0
Do you reckon that maybe I should downgrade the version or is it more related to the OS?

Thanks!

But hmm...

I upgraded my environment to be

pyqt5=5.15.7
pyqt5-qt5=5.15.2
pyqt5-sip=12.11.0

and still work well on my side.

To make it clear,

python -m src.GUI.train_GUI
python -m src.GUI.test_GUI

both train & test GUI scripts worked well.

And also, I uninstalled above three packages, and re-installed with pip install PyQt5 and again, it worked well on my side.

I'm not the expert on PyQt, and I am also googling about the issue... but from your error message,
"symbol qt_version_tag version Qt_5.15 not defined in file libQt5Core.so.5 with link time reference",
it seems that Qt 5.15 version is not defined in that file so I think you may try downgrading and test with some other PyQt5 version (e.g., 5.9.2).

Please let me know if something changes..

Thanks!

But hmm...

I upgraded my environment to be

pyqt5=5.15.7
pyqt5-qt5=5.15.2
pyqt5-sip=12.11.0

and still work well on my side.

To make it clear,

python -m src.GUI.train_GUI
python -m src.GUI.test_GUI

both train & test GUI scripts worked well.

And also, I uninstalled above three packages, and re-installed with pip install PyQt5 and again, it worked well on my side.

I'm not the expert on PyQt, and I am also googling about the issue... but from your error message, "symbol qt_version_tag version Qt_5.15 not defined in file libQt5Core.so.5 with link time reference", it seems that Qt 5.15 version is not defined in that file so I think you may try downgrading and test with some other PyQt5 version (e.g., 5.9.2).

Please let me know if something changes..

Thank you! So... I failed to downgrade pyqt5 and always got the error "No matching distribution found for sip<4.20,>=4.19.3" when I tried to install any lower version of pyqt5, even in a newly created env. I also tried on a different server with Ubuntu 18.04.6 LTS and it didn't work either.

After searching, broken pyqt5 installation across various environments (often Linux and anaconda) seems to be a very common issue. Not sure if I can directly file another issue to pyqt5, may I ask how did you install pyqt5? Would it be possible to include it in the env.yml file? (Sorry I also don't know if this would make things different..)

I followed our installation guide at the clean server without PyQt5, and added

  - pip:
    - pyqt5==5.15.7
    - pyqt5-qt5==5.15.2
    - pyqt5-sip==12.11.0

This one to the env.yml file as you mentioned.

Also, I found that

channels:
  - conda-forge

this part makes conda env creation stuck.
Without that two lines, and plus entering this script conda config --remove channels conda-forge to the terminal, env creation took very fast, almost 1min.

Also PyQt installation was automatically done, there was no error about pyqt5. (Actually, I did not installed Pytorch, which is time-consuming, and ModuleNotFoundError: No module named 'torch' error occured which means importing PyQt5 was successful.

One thing is, maybe your failure of downgrading pyqt5 could be solved with pip uninstall pyqt5, and pyqt5-qt5 and pyqt5-sip. I think that lower version of pyqt5 is not compatible of your newest version pyqt5-sip package.

Anyway, I suggest to find "clean" server, or uninstalling all things, and follow again our installation guide (+ I recommend to remove channels: - conda-forge from env.yml and conda config --remove channels conda-forge first and do step 3. I also updated README file.

still the same for me. Regarding the downgrading issue, yes I also tried with a clean env without any sip or qt package installed, and it failed in the same way.
It may be some specific issue due to server settings (?), I will ask my coworkers after the holidays to see if they have more experience dealing with it. Anyways, many thanks, and will keep updating once I get a further diagnosis!

Ah, I forgot to write this. You can try our test code without GUI which is free from PyQt error. I can help you if you have any trouble running the test code on CLI.

Cool thanks! Are there any pre-trained models that I can directly run the test code? I didn't find the results folder and it seems pytorch doesn't support CUDA 11.4 that is equipped with our GPU server

Cool thanks! Are there any pre-trained models that I can directly run the test code? I didn't find the results folder and it seems pytorch doesn't support CUDA 11.4 that is equipped with our GPU server

Ah no, sorry my bad.. Found the old version of torch and i was misled by some google info. But still, if it would be possible to use some pre-trained models that would be nice

Nice! Of course there are pretrained models in the src/GUI/trained_models folder, which were originally for GUI.
While they may be not that good pretrained models, and training on your data will make denoising better, but anyway you can try them.

In the test code, modify the followings

model_file = "./src/GUI/trained_models/bs1.pth"
bs_size = 1

and if you want to try bs3.pth model, change bs_size as 3.

If there are some artifacts at denoised data with bs1.pth, which could originated from the structural noise in your data, try bs3.pth.

Also, if you got CUDA OOM error, reduce the batch_size as 16, or something smaller than 128.

Thank you very much! it works with the code.
P.S. I tried to install everything in another GPU server with Win10, and everything works there (including GUI). So it must be our Linux servers' issue regarding the GUI usage, you can close this issue if you want. Thanks again!

P.P.S. after a quick run of the training model with my own data, I found there was some metadata wrong in the denoised data. My input is a tiff file with 180 (w) x 256 (h) pixels x 10000 (t), but the output file size becomes 180 (w) x 256 (h) pixels x 1, and depth becomes 10000 instead of 1 pixel. Is there anything I might do wrong causing this error? If you prefer, I can open another issue in terms of this. Many thanks!

Nice for the GUI issue! I'll close it.

For the temporal dimension of denoised data issue, please open a new issue.

Before that, #4 please check this one!

@starquakes Hi, did you solved it??
If not, how about sending a "demo" data to reproduce the problem in my side? I'd also like to know what is the reason of this temporal dimension issue. FYI, my email is jay0118 at kaist dot ac dot kr.

I'm currently on business trip, and I think I can play around it at least next week.

@starquakes Hi, did you solved it?? If not, how about sending a "demo" data to reproduce the problem in my side? I'd also like to know what is the reason of this temporal dimension issue. FYI, my email is jay0118 at kaist dot ac dot kr.

I'm currently on business trip, and I think I can play around it at least next week.

Hi! Not really, I only found an alternative way to work it out but it's weird:
So if you directly drag the denoised file into ImageJ and check the metadata, the dimensions would be wrong as I indicated before. The same applies if you import it into python with multiple image tools that employ bioformats (I tried skimage, ASCImage).
The only way it can work out is: First use the bioformats importer plugin in ImageJ and save it again, the dimensions would be corrected which can be successfully opened in python with ASCImage. I don't understand the logic behind since both of them use bioformats...
For quick testing purpose, I already "curated" my output files with this funny method, but I would be happy to send an example to you to reproduce the error and figure it out. Do you prefer a raw file to reproduce from the training step or just the output file with wrong dimensions that python could not properly import? Thanks.

Hi, sorry for the late reply..

It would be great if you send me both raw file to reproduce the problem and output file! I'll check it after I finish a business trip (about 2-3days left)!