ccbogel / QualCoder

Qualitative data analysis for text, images, audio, video. Cross platform. Python 3.10 or newer and PyQt6.
https://qualcoder.wordpress.com/
GNU Lesser General Public License v3.0
381 stars 85 forks source link

Can't Install 2.8 on Debian #597

Closed ventolinmx closed 2 years ago

ventolinmx commented 2 years ago

Hi

First time trying QualCoder.

I'm on Debian 10 and i get this error when installing Qualcoder 2.8: No local packages or working download links found for PyQt5-Qt5>=5.15.2 error: Could not find suitable distribution for Requirement.parse('PyQt5-Qt5>=5.15.2')

Tried also installing qualcoder-2.4.deb but nothing happens when trying to open it.

It's great that there are libre QDAS! :D Thanks!

ccbogel commented 2 years ago

@ventolinmono hello, Check what python version you have, I am presuming is is 3.6 or newer. In terminal type: python3 this opens the python interpreter and shows the version at the top. Ctrl+z to exit.

Did you run this line of code from the terminal?

sudo apt install python3-pip python3-lxml python3-ply python3-six python3-pdfminer python3-chardet python3-pyqt5 python3-pillow

Did the above command work without errors ?

ventolinmx commented 2 years ago

python3 gives me Python 3.7.3 and that line of code gives no errors.

ccbogel commented 2 years ago

ok, thats good.

So then the following instructions, to Install additional modules:

sudo python3 -m pip install pdfminer.six openpyxl ebooklib pydub SpeechRecognition

Then, Building and install QualCoder, from the downloaded folder type the following:

sudo python3 setup.py install

Note: you need to cd, in to the directory of the folder that contains setup.py

To run type

qualcoder

After each step, let me know if each step works.

ccbogel commented 2 years ago

You can use the latest version too, if you Download and unzip the master Zip from the green Code button. pic1

ventolinmx commented 2 years ago

First command gives me this:

WARNING: You are using pip version 20.2.2; however, version 21.3.1 is available. You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

Tried upgrading pip gives me this:

Defaulting to user installation because normal site-packages is not writeable. Requirement already satisfied.

ccbogel commented 2 years ago

try: sudo pip install --upgrade pip

or sudo python3 -m pip install --upgrade pip

ventolinmx commented 2 years ago

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

:/

ccbogel commented 2 years ago

OK, well don't upgrade pip. It should be ok to use as is.

continue installing the extra modules as shown above.

ventolinmx commented 2 years ago

Tried installing the modules again and got the same:

The 'PyQt5-Qt5>=5.15.2' distribution was not found and is required by pyqt5

Maybe it has something to do with permissions? dist and build folders are locked:

You are not the owner, so you cannot change these permissions.

ccbogel commented 2 years ago

I am really stumped how to fix your problem. One possibility might be to use a newer version of python, e.g. 3.9 or 3.10 but I am only guessing here. Is there a Debian forum where you can present this problem , and ask other Debian users to help?

Dist and build are normally locked. pic1

ventolinmx commented 2 years ago

Don't worry, thanks anyway. I'll try to repair my python and pip installations. I did it with not enough care and probably messed something up.

stragu commented 2 years ago

I get something similar on Ubuntu 18.04, when following the instructions in the README, running the setup.py install command:

[...]
Processing dependencies for Qualcoder==2.9
Searching for PyQt5-Qt5>=5.15.2
Reading https://pypi.python.org/simple/PyQt5-Qt5/
No local packages or working download links found for PyQt5-Qt5>=5.15.2
error: Could not find suitable distribution for Requirement.parse('PyQt5-Qt5>=5.15.2')
ccbogel commented 2 years ago

@stragu OK two suggestions. One suggestion is use a newer version of python. e.g. python3.8 or newer - maybe this is what is needed. From terminal type python3 then press enter. this will show you what version you are running. To exit Press Ctrl Z

Also try:

Update pip to the latest and try installing that version of pyqt5 also: pip3 install --upgrade pip pip3 install pyqt5==5.15.2

Or maybe also try this after upgrading pip. sudo python3 -m pip install pyqt5==5.15.2

you might need to use sudo also, so: sudo pip3 et cetera

I am getting ideas from this post: https://stackoverflow.com/questions/59711301/install-pyqt5-5-14-1-on-linux

stragu commented 2 years ago

@ccbogel : thank you for the suggestions!

ccbogel commented 2 years ago

Ok. Thank you for that information. I have added a warning to the install instructions. I am trying to get the python virtual envelope working, but not successful yet.

stragu commented 2 years ago

OK, I just realised that this issue is not limited to just QualCoder. Other QT applications are now failing to start on my computer, including BOINC, Cadence and QGIS, giving me a similar error. For example, when starting QGIS:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/__init__.py", line 74, in 
    from qgis.PyQt import QtCore
  File "/usr/lib/python3/dist-packages/qgis/PyQt/QtCore.py", line 24, in 
    from PyQt5.QtCore import *
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.6/dist-packages/PyQt5-5.15.6-py3.6-linux-x86_64.egg/PyQt5/QtCore.abi3.so)

I am not sure if this issue is unrelated to the install process of QualCoder, or if it was indeed the QualCoder script that messed things up. I will try a reinstall of my Python distribution and will report back!

ccbogel commented 2 years ago

I hope it is not related to the QC install - but this was for python 3.9. I noticed the last line of the above error was for python 3.6 - but you have been using python 3.9 for QC? "required by /usr/local/lib/python3.6/dist-pack"

Perhaps first try downloading QGIS etc and reinstalling them first. And let me know,

stragu commented 2 years ago

Good spotting about the different Python version! That put me onto the solution, and I can now use all the applications I couldn't use. It was indeed when I followed the README instructions that things broke, and the culprit was the use of sudo when installing modules.

Let me run you through it, just in case it proves useful to you and to others:

First, I reinstalled Anaconda, and that solved my issue with BOINC only. Not sure why that is, but also: I wasn't seeing the same error message when BOINC wouldn't start, so we can ignore that. Even after reinstalling Anaconda, I still couldn't use applications like Cadence, ReText and QGIS because of that PyQt5 issue:

ReText:

~$ retext
Traceback (most recent call last):
  File "/usr/bin/retext", line 26, in <module>
    from ReText import datadirs, settings, globalSettings, app_version
  File "/usr/share/retext/ReText/__init__.py", line 24, in <module>
    from PyQt5.QtCore import QByteArray, QLocale, QSettings, QStandardPaths
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.6/dist-packages/PyQt5-5.15.6-py3.6-linux-x86_64.egg/PyQt5/QtCore.abi3.so)

Cadence:

~$ cadence
Traceback (most recent call last):
  File "/usr/share/cadence/src/cadence.py", line 25, in <module>
    from PyQt5.QtCore import QFileSystemWatcher, QThread, QSemaphore
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.6/dist-packages/PyQt5-5.15.6-py3.6-linux-x86_64.egg/PyQt5/QtCore.abi3.so)

QGIS:

Couldn't load SIP module.
Python support will be disabled.
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/__init__.py", line 74, in 
    from qgis.PyQt import QtCore
  File "/usr/lib/python3/dist-packages/qgis/PyQt/QtCore.py", line 24, in 
    from PyQt5.QtCore import *
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.6/dist-packages/PyQt5-5.15.6-py3.6-linux-x86_64.egg/PyQt5/QtCore.abi3.so)

Pretty obvious culprit here. I had a similar issue a while back with QGIS, and ended up in the same Q&As and forums. As recommended on most of them, I tried to uninstall PyQt5 with pip, to then give priority to the system's python3-pyqt5 package: it did not work.

~$ pip3 uninstall PyQt5
WARNING: Skipping PyQt5 as it is not installed.

Very weird, because it's right there in the error message! Looking into the Python 3.6 modules:

~$ ls /usr/local/lib/python3.6/dist-packages
dns                               __pycache__
dnspython-1.15.0.dist-info        pydub
easy-install.pth                  pydub-0.25.1.dist-info
ecdsa                             PyQt5-5.15.6-py3.6-linux-x86_64.egg
ecdsa-0.13.dist-info              PyQt5_sip-12.9.1-py3.6-linux-x86_64.egg
electrum                          PySocks-1.6.8.egg-info
Electrum-3.2.2.egg-info           qdarkstyle
electrum_gui                      QDarkStyle-2.5.4.dist-info
electrum_plugins                  qrcode
jsonrpclib                        qrcode-6.0.dist-info
jsonrpclib_pelix-0.3.1.dist-info  Qualcoder-2.9-py3.6.egg
pbkdf2-1.3.egg-info               sip-4.19.8.dist-info
pbkdf2.py                         sip.so
pdfminer                          sockshandler.py
pdfminer.six-20211012.dist-info   socks.py
pyaes                             speech_recognition
pyaes-1.6.1.egg-info              SpeechRecognition-3.8.1.dist-info

Looks like this is where the modules QualCoder asked for ended up being installed when following the README.

As you mentioned, there is a Python version mismatch. My default version of Python is 3.9:

~$ python3 --version
Python 3.9.7

BUT! The python version when being root is..... 3.6!

~$ sudo python3 --version
[sudo] password for xxx: 
Python 3.6.9

I just learned today that the user's Python version might be different to root's Python version! I had no idea.

So, because the README says to install some modules with sudo python3 -m pip install, I then tried:

~$ sudo python3 -m pip uninstall PyQt5
The directory '/home/stragu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling PyQt5-5.15.6:
  /usr/local/lib/python3.6/dist-packages/PyQt5-5.15.6-py3.6-linux-x86_64.egg
Proceed (y/n)? y
  Successfully uninstalled PyQt5-5.15.6

And voilà, everything works again.

I have seen quite a few times people strongly recommending not installing python modules with sudo. Maybe that's the issue here? Should the README only use sudo for the system packages that absolutely require it (i.e. apt install), and not use it for the python modules installed with pip?

stragu commented 2 years ago

And to follow up: because I am an Anaconda user, I tried the following slightly modified instructions, removing the use of sudo for installing python modules:

  1. Download the source code archive
  2. Extract
  3. Install the necessary system packages: sudo apt install python3-pip python3-lxml python3-ply python3-six python3-pdfminer python3-chardet python3-pyqt5 python3-pillow (note that python3-pillow gets replaced by python3-pil, and python3-pdfminer is not found)
  4. Install the extra modules: conda install pdfminer.six openpyxl ebooklib pydub SpeechRecognition (note that the only module found is openpyxl, and its installation warns of an "inconsistent environment")
  5. In the extracted directory, build and install QualCoder: python3 setup.py install
  6. Run it: qualcoder

I was able to run QualCoder, but I assume a few features wouldn't work because of the missing modules. In any case, I can use QualCoder, and my other programs still work!

I'll let you know if I end up trying the same with pip on top of Anaconda.

ccbogel commented 2 years ago

Thats geat work, thank you. I was worried my instructions had affected things. So in my read me I should remove the sudo word. And also add how to install for Anaconda. Yes pdf text import wont work withoutb pdfminer, but check u can open Manage Files in QualCoder too. As it might crash trying to load the missing pdfminer module.

I have started working on installation in a virtual environment, but am having a bit of difficulty getting it to work. This is a way that would have avoided all the problems.

stragu commented 2 years ago

I agree you should remove sudo from the module installs (but keep it with the apt command) because otherwise, they might be installed for a Python version different to the user's version.

I did try to open the Manage Files dialog and add a PDF, and it seems to work without crashing:

image

I was then able to code the PDF's text. Is pdfminer supposed to make it look different?

ccbogel commented 2 years ago

No, pdfminer is just used for the text extract from the pdf. It might already be installed in the background. I have to double check my python coding, been a while since i looked at pdf import.

ccbogel commented 2 years ago

OK Closing issue. As I have updated the install instructions to use a virtual environment