Search code examples
pythonqtversion-controlrollback

Windows Anaconda Roll Back Qt version Qt5 to Qt4


Can Someone Please help me? I have tried almost all the suggestions online and can't seem to find a working solution.

I have two PCs. Awhile ago I installed Anaconda3 and was able to get PyQt4 working with little to no effort. Unfortunately I can't remember what it was that I did.

I now need to have the code I wrote on the first PC to run on the second. But for some reason I cannot rollback the Qt or PyQt versions from 5 to 4. It seems the Qt packages are pretty complicated and also no longer have simple binary installers for python 3.6. The first PCs details are seen below: 1st PC with working Qt4 the second PC details are as follows:2nd PC details. So if I understand I somehow need to change the Qt version to 4.8.7 and PyQt to 4.11.4? I do not need Qt5 at all so don't mind if it is removed or uninstalled.

The relevant code that indicates that it works would just be the import of PyQt4 which as it stands leaves an error message of: "ModuleNotFoundError: No module named 'PyQt4'"

I have tried the suggestions here: How to install PyQt4 in anaconda? but get "unsatisfiableerror: the following specifications were found to be in conflict: -pyqt 4*-> python 2.6* -python 3.6*"

I have also tried installing SIP but had issues there as I could not build it using the anaconda terminal prompt. Conda install sip works but installs an older version that cannot support PyQt4.11.4.

I do not mind completely uninstalling anaconda and everything python in order to fix this.

Not sure if it makes a difference but the first PC is windows 10 and the second PC is windows 8. Any help would be greatly appreciated as I have almost lost my cool.


Solution

  • Hi Guys so I found a solution that works for me. This will only really work if you do not need PyQt5. I basically completely removed all python and anaconda packages and reinstalled an older version that had the exact packages I needed. This is not ideal if you have a whole lot of other packages or plugins already installed(pyserial for example).

    I basically used: "conda info anaconda" and searched through all the versions that had both python 3(and above) as well as Qt4 and PyQt4. In my case anaconda 4.1.1 did the trick(specifically anaconda3 with python 3.5). Then you can either download the .tar that is given from the info(https://repo.continuum.io/pkgs/free/win-64/anaconda-4.1.1-np111py34_0.tar.bz2) OR you can download the installer from (https://repo.continuum.io/archive/).

    The code now works(a little buggy but I expect that is because I now use python 3.5 instead of python 3.6). So I will try upgrade the python version and see if that helps.

    In short, it seemed to be far easier to do it this way than trying to roll back the Qt versions or any of the other methods I tried above.

    I hope this helps someone in the Future.