16

I have tried to install PyQt5 using

pip install PyQt5

and

sudo -H pip install PyQt5

both of them give me the errors

ERROR: Could not find a version that satisfies the requirement PyQt5 (from versions: none)
ERROR: No matching distribution found for PyQt5

I use Ubuntu 18.04.

My python version is: Python 2.7.15rc1


I have already installed python3-pip and tried to install PyQt5 using

pip3 install PyQt5

I get the error

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application

My python3 version is: Python3.6.7.

rsaavedra
  • 378
  • 1
  • 4
  • 12
  • what is your OS? – eyllanesc Jun 02 '19 at 20:54
  • 1
    In a few months Python2 will be deprecated so many libraries have already decided not to support Python2, and one of those libraries is PyQt5 as indicated by the [docs](https://www.riverbankcomputing.com/software/pyqt/download5/): *Wheels are provided for Python v3.5 and later for 64-bit Linux, macOS and 32-bit and 64-bit Windows.* So it is advisable that you use Python3 if you are learning or if you are going to develop an application: `pip3 install PyQt5` – eyllanesc Jun 02 '19 at 21:09
  • find it strange that pip3 use python2: `File "/usr/local/lib/python2.7/dist-packages` – eyllanesc Jun 02 '19 at 21:19
  • I thought that too. I was thinking of uninstalling Python2 but found in another post that is not a good idea? – rsaavedra Jun 02 '19 at 21:20

4 Answers4

23

You need to upgrade your pip

pip install --user --upgrade pip

Then do a fresh install

pip install PyQt5

or

pip3 install PyQt5
Muhammad
  • 381
  • 3
  • 10
20

Try this:

python3 -m pip install PyQt5
Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
Mwangi Kabiru
  • 423
  • 2
  • 10
6

I know it is a bit late to answer. In PyCharm, even upgraded pip gives error in this package. Downgraded the PyQt5 version to 5.12.2 works fine. Use,

pip install PyQt5==5.12.2 
pip install PyQtWebEngine==5.12

Or,

pip3 install PyQt5==5.12.2
pip3 install PyQtWebEngine==5.12

Works fine for me.

0

You can run command

   pip3 install PyQt5

or for Python 2 you can manually install from https://www.riverbankcomputing.com/software/pyqt/download5

Mihai8
  • 3,113
  • 1
  • 21
  • 31