40

From the PyQt4 website their instructions for installing the package are to download the tarball and use the config file. I have two versions of Python, one is my normal system and the other is within anaconda. I'm not sure how I get this to install within anaconda. Is there a conda command to install PyQt4?

3
  • What operating system are you on?
    – asmeurer
    Feb 10, 2014 at 16:23
  • 1
    Unfortunately, I don't have a good answer for you, other than to wait. We (Continuum) are working on building PyQT, but unfortunately, it's very difficult, especially on OS X.
    – asmeurer
    Feb 10, 2014 at 17:16
  • I tried to do this today building from source and ran into this error install SIP: Error: SIP requires Python to be built as a framework. I'm using miniconda, not the full Anaconda, but I assume it's going to have the same issue. At least at the moment things look pretty hopeless for installing PyQt4 with Anaconda.
    – jiffyclub
    Mar 11, 2014 at 18:43

6 Answers 6

53

Updated version of @Alaaedeen's answer. You can specify any part of the version of any package you want to install. This may cause other package versions to change. For example, if you don't care about which specific version of PyQt4 you want, do:

conda install pyqt=4

This would install the latest minor version and release of PyQt 4. You can specify any portion of the version that you want, not just the major number. So, for example

conda install pyqt=4.11

would install the latest (or last) release of version 4.11.

Keep in mind that installing a different version of a package may cause the other packages that depend on it to be rolled forward or back to where they support the version you want.

6
  • is this equal to conda install pyqt=4.11.4 ? Dec 4, 2016 at 4:17
  • @VibhuthaKumarage Not exactly. pyqt=4.11.4 would install exactly version 4.11.4. pyqt=4 would install whatever minor version of version 4 was latest, which would not necessarily be 4.11.1. Similarly, you could do pyqt=4.11 to fix the major and minor versions but get whatever release of 4.11 was latest. Dec 5, 2016 at 2:36
  • 2
    Can't do this with Python 3.6.1 :(
    – O.rka
    Jul 7, 2017 at 21:05
  • @O.rka. I'm sure it will become available soon Jul 8, 2017 at 1:59
  • 1
    @user1556435 You can just do conda create -n py35 python=3.5 pyqt=4. You can list all packages on the initial command line. May 4, 2018 at 12:57
51

FYI

PyQt is now available on all platforms via conda!
Use conda install pyqt to get these #Python bindings for the Qt framework. @ 1:02 PM - 1 May 2014

https://twitter.com/ContinuumIO/status/461958764451880960

1
  • 18
    The issue is that nowadays, conda installs version 5 instead of version 4 unless you specifically ask it to. Dec 13, 2016 at 16:25
27

It looks like the latest version of anaconda forces install of pyqt5.6 over any pyqt build, which will be fatal for your applications. In a terminal, Try:

conda install -c anaconda pyqt=4.11.4

It will prompt to downgrade conda client. After that, it should be good.

UPDATE: If you want to know what pyqt versions are available for install, try:

conda search pyqt

UPDATE: The most recent version of conda installs anaconda-navigator. This depends on qt5, and should first be removed:

conda uninstall anaconda-navigator

Then install "newest" qt4:

conda install qt=4
3
  • What platform are you on? Here on osx capitan conda install pyqt is installing 4.11 at this moment. Perhaps osx is a bit behind ;0
    – drevicko
    Apr 5, 2017 at 22:24
  • I'm on Windows/Linux.. If you want to know what pyqt versions are available for install, try: conda search pyqt
    – Alaaedeen
    Apr 7, 2017 at 18:49
  • In my system, conda search pyqt lists only the latest versions of PyQt5 (5.6.0 and up). I have to find older versions by going to another channel: conda search -c anaconda pyqt
    – dbouz
    Oct 2, 2019 at 13:48
1

For windows users, there is an easy fix. Download whl files from:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4

run from anaconda prompt pip install PyQt4‑4.11.4‑cp37‑cp37m‑win_amd64.whl

0

Successfully installed it on OSX using homebrew:

brew install sip
brew install pyqt     

which (currently) installs PyQt4. Anaconda is the main python on the machine (OSX 10.8.5).

1
  • fyi: conda install pyqt and conda install qt install qt4 on osx at this moment. I guess it's not caught up with linux on that... (:
    – drevicko
    Apr 5, 2017 at 22:23
0

How to install PyQt4 on anaconda python 2 on Windows:

At first I have tried to isntall pyqt4 via pip install:

C:\Users\myuser\Anaconda2\Scripts\pip.exe search pyqt4 > pyqt4.txt

It shows:

PyQt4 (4.11.4) - Python bindings for the Qt cross platform GUI toolkit

But when I tried to install, it gives an error:

C:\Users\myuser\Anaconda2\Scripts\pip.exe install PyQt4
Collecting PyQt4
  Could not find a version that satisfies the requirement PyQt4 (from versions:
)
No matching distribution found for PyQt4

Seems this answer is realated to this problem: https://superuser.com/a/725869/213959

Then I have tried to install it via conda install ( How to install PyQt4 in anaconda? ) :

C:\Users\myuser\Anaconda2\Scripts\conda.exe search pyqt

It shows:

pyqt                         4.10.4                   py26_0  defaults        
                             4.10.4                   py27_0  defaults        
                             4.10.4                   py33_0  defaults        
                             4.10.4                   py34_0  defaults        
                             4.10.4                   py26_1  defaults        
                             4.10.4                   py27_1  defaults        
                             4.10.4                   py33_1  defaults        
                             4.10.4                   py34_1  defaults        
                             4.11.4                   py27_0  defaults        
                             4.11.4                   py35_0  defaults        
                             4.11.4                   py27_2  defaults        
                             4.11.4                   py34_2  defaults        
                             4.11.4                   py35_2  defaults        
                             4.11.4                   py27_3  defaults        
                             4.11.4                   py34_3  defaults        
                             4.11.4                   py35_3  defaults        
                             4.11.4                   py27_4  defaults        
                             4.11.4                   py34_4  defaults        
                             4.11.4                   py35_4  defaults        
                             4.11.4                   py27_5  defaults        
                             4.11.4                   py34_5  defaults        
                             4.11.4                   py35_5  defaults        
                             4.11.4                   py27_6  defaults        
                             4.11.4                   py34_6  defaults        
                             4.11.4                   py35_6  defaults        
                             4.11.4                   py27_7  defaults        
                             4.11.4                   py34_7  defaults        
                             4.11.4                   py35_7  defaults        
                             5.6.0                    py27_0  defaults        
                             5.6.0                    py34_0  defaults        
                             5.6.0                    py35_0  defaults        
                             5.6.0                    py27_1  defaults        
                             5.6.0                    py34_1  defaults        
                             5.6.0                    py35_1  defaults        
                             5.6.0                    py27_2  defaults        
                             5.6.0                    py34_2  defaults        
                             5.6.0                    py35_2  defaults        
                             5.6.0                    py36_2  defaults        
                             5.6.0            py27h224ed30_5  defaults        
                             5.6.0            py35hd46907b_5  defaults        
                             5.6.0            py36hb5ed885_5  defaults  

But it gives error:

C:\Users\myuser\Anaconda2\Scripts\conda.exe install pyqt=4.11.4
Fetching package metadata .............
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
  - navigator-updater -> pyqt >=5.6 -> qt 5.6.*
  - pyqt 4.11.4* -> qt >=4.8.6,<5.0
  - pyqt 4.11.4* -> sip >=4.16.4,<4.18
Use "conda info <package>" to see the dependencies for each package.

Same with -c parameter:

C:\Users\myuser\Anaconda2\Scripts\conda.exe install -c anaconda pyqt=4.11.4
Fetching package metadata ...............
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
  - navigator-updater -> pyqt >=5.6 -> qt 5.6.*
  - pyqt 4.11.4* -> qt >=4.8.6,<5.0
  - pyqt 4.11.4* -> sip >=4.16.4,<4.18
Use "conda info <package>" to see the dependencies for each package.

Then I tried to uninstall pyqt:

C:\Users\myuser\Anaconda2\Scripts\conda.exe uninstall pyqt

And installed it again:

C:\Users\myuser\Anaconda2\Scripts\conda.exe install -c anaconda pyqt=4.11.4

And finnaly it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.