Jamie
Jamie

Reputation: 81

FileNotFoundError Installing PyQt5

I'm been trying to install PyQt and I can't get past the below error. I've read a few posts suggesting that I should upgrade PIP, setup_tools, and ez_install. I've tried all of that with no luck. Any tips?

c:\Python27>pip install PyQt5_gpl-5.10.tar.gz
Processing c:\python27\pyqt5_gpl-5.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files (x86)\python36-32\lib\tokenize.py", line 452, in open
    buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\JAME~1.KRK\\AppData\\Local\\Temp\\pip-0u8uht47-build\\setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\JAME~1.KRK\AppData\Local\Temp\pip-0u8uht47-build\           

Same thing in 3.6:

c:\Program Files (x86)\Python36-32>pip install PyQt5_gpl-5.10.tar.gz
Processing c:\program files (x86)\python36-32\pyqt5_gpl-5.10.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "c:\program files (x86)\python36-32\lib\tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\JAME~1.KRK\\AppData\\Local\\Temp\\pip-f9s0_6sp-build\\setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in 
C:\Users\JAM~1.KRK\AppData\Local\Temp\pip-f9s0_6sp-build\

Upvotes: 7

Views: 9166

Answers (5)

user1986815
user1986815

Reputation:

on debianoids there is a nice way out of this bug

apt install python3-pyqt5

Upvotes: 0

Yong Wang
Yong Wang

Reputation: 1313

I just encountered the same issue and find clue in the topic. It has been solved by pip upgrade.

Here is the detail:

1. Issue case:

pip3 install pyqt5.

failed and report FileNotFoundError: [Errno 2] No such file or directory:

2. OS environment:

Win10 64x WSL2

3. Python environment

python 3.7.3

pip version 19.X (not write down)

Solved steps:

  1. pip3 install --upgrade pip
  2. pip3 install --user PyQt5
  3. sudo apt-get update -y
  4. sudo apt install libgl1-mesa-glx -y

now. It works.

Root cause:

a. pyqt in wsl, pip old version download wrong package. pip (v20.x) download below version PyQt5-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl

b. libgl1.so1. not such lib need install by apt intall

Hope my experience can help you.

Upvotes: 8

user3419537
user3419537

Reputation: 5000

You appear to be trying to make pip install the PyQt5 source archive. PyQt doesn't use the usual setup.py script that many python packages use and cannot be built and installed from source with pip. Furthermore, the .tar.gz format is intended for linux systems and Windows provides no native support. I am not sure whether pip on Windows would even handle the format. There is a .zip version provided for Windows users.

You need to either extract the archive and build from source, or allow pip to download and install the package itself with pip install PyQt5.

If you are using Python < 3.5, you will have to build from source (or install PyQt4 instead), as there are no official builds provided for these versions of Python. For everything else the pip command above should be enough.

Upvotes: 1

Skandix
Skandix

Reputation: 1994

you need to use Python >= 3.5 or try the older PyQt4

Upvotes: 0

FHTMitchell
FHTMitchell

Reputation: 12156

On PyPI it seems PyQT5 is for python 3.5 or higher only. Not python 2.7. Use an earlier version of PyQt or a newer version of python (Python 2.7 isn't supported beyond 2020, you'll need to move sooner or later).

Upvotes: 1

Related Questions