[PyQt] Unable to install PyQt 5.14

Kyle Altendorf sda at fstab.net
Mon Apr 6 14:15:10 BST 2020


On 2020-04-05 22:02, ashwin .D wrote:

> Hello,
> I am trying to install PyQt 5.14 and I am getting the following errors 
> when I type this command on Ubuntu 18.04 LTS
> 
> pip3 install PyQt
> 
> Collecting PyQt5
> Using cached 
> https://files.pythonhosted.org/packages/4d/81/b9a66a28fb9a7bbeb60e266f06ebc4703e7e42b99e3609bf1b58ddd232b9/PyQt5-5.14.2.tar.gz
> Complete output from command python setup.py egg_info:
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/usr/lib/python3.6/tokenize.py", line 452, in open
> buffer = _builtin_open(filename, 'rb')
> FileNotFoundError: [Errno 2] No such file or directory: 
> '/tmp/pip-build-io2s31yp/PyQt5/setup.py'
> 
> ----------------------------------------
> Command "python setup.py egg_info" failed with error code 1 in 
> /tmp/pip-build-io2s31yp/PyQt5/
> 
> Alternatively I typed
> 
> python3.6 -m pip install.
> 
> and  I get a message saying that setup.py is not found.

I would strongly suggest you stop running your system pip.  pip should 
be run from an isolated environment such as a virtualenv or venv.  
https://bit.ly/py-env provides an intro.  A tl;dr is below.  The point 
is that when you install into your system Python's environment you are 
mixing with the apt provided packages.  This mixing of package managers 
leaves neither in complete control and yields potentially incompatible 
versions of packages.  --user only hazards this for the current user.  
Running pip with sudo or otherwise as root hazards breaking your whole 
OS.

sudo apt install virtualenv
virtualenv -p python3 myvenv
myvenv/bin/pip install --upgrade pip setuptools wheel
myvenv/bin/pip install pyqt5
myvenv/bin/python myfile.py

If there are aspects of this that you find problematic, let us know.  
There are lots of options but envs are a very useful thing to use.

Some people will push for venv rather than virtualenv.  No matter, I use 
them more or less interchangeably.  Due to how Ubuntu has things 
packaged (inherited from Debian if I remember correctly) you have to 
install multiple system packages to get the 'it is just built-in with 
Python' venv module to actually work.  On the flip side, installing 
virtualenv actually just works as I recall.

Cheers,
-kyle


More information about the PyQt mailing list