FileNotFoundError Installing PyQt5 - python

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\

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:
pip3 install --upgrade pip
pip3 install --user PyQt5
sudo apt-get update -y
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.

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).

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.

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

on debianoids there is a nice way out of this bug
apt install python3-pyqt5

Related

Unable to install SimpleITK library

I am installing using following command:
python -m pip install SimpleITK
I got an error using CMake. The error message is given below:
CMake Error at /usr/share/cmake-3.10/Modules/ExternalData.cmake:1121 (message): Object MD5=890c808122bd90f398e6bc40ec862102 not found
The complete traceback is given as:
Traceback:
Traceback (most recent call last):
File "/home/ipcv-lab/.local/lib/python2.7/site-packages/skbuild/setuptools_wrap.py", line 589, in setup
cmkr.make(make_args, env=env)
File "/home/ipcv-lab/.local/lib/python2.7/site-packages/skbuild/cmaker.py", line 507, in make
os.path.abspath(CMAKE_BUILD_DIR())))
An error occurred while building with CMake.
Command:
cmake --build . --target install --config Release --
Source directory:
/tmp/pip-build-cUCNSY/SimpleITK
Working directory:
/tmp/pip-build-cUCNSY/SimpleITK/_skbuild/linux-aarch64-2.7/cmake-build
Please see CMake's output for more information.
I have tried installing with conda as well, but I am getting an error of unavailable channels
It looks like cmake is trying to compile SimpleITK. Not sure why it needs to do that for a pip install.
You could try downloading the Python wheel for SimpleITK directly and installing the wheel. Here's where you can download the package:
https://pypi.org/project/SimpleITK/#files
Also it looks like you're using Python 2.7. SimpleITK isn't supported on 2.7. You're going to have to use 3.5 or up.
As far as conda goes, did you use the "-c condo-forge" option to select the proper channel to download SimpleITK?

I can't install modules on pip install its giving error with red text [duplicate]

A program I am trying to install requires the installation of PyQt5 5.15.0 , which gives me this error. The odd thing is that the installation works fine for the latest version of PyQt5 (5.15.2), but this program requires 5.15.0 specifically.
Command Output:
Collecting PyQt5==5.15.0
Using cached PyQt5-5.15.0.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6'
cwd: C:\Users\mshal\AppData\Local\Temp\pip-install-sfw90hvc\pyqt5_e2cc46859b554da7b84798abae5378ba
Complete output (31 lines):
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 126, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 479, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\project.py", line 79, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 225, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6' Check the logs for full command output.
I am on the latest version of pip. Any ideas on the root cause of this issue?
What helped me is upgrading pip from 20.2.3 to the latest one (in my case 21.1.1)
For Mac/Homebrew users.
The answer by #the-x is leading in the right direction. On a Mac with QT5 installed via Homebrew the qmake binary just needs to be added to the path. This can be achieved through
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
(of course depending on where the homebrew files are installed)
Running on arm with python3.6 (ubuntu18 on nvidia Xavier):
sudo apt install qt5-default
For MacOS users.
I am on Apple M1 silicon using Python 3.9.8. What worked for me was #Apaul's comment in the original question section. Install pyqt5-sip prior to pyqt5.
I also have an Intel Mac and on that machine, I do not need to do this.
Checking the binaries that PyQt5 provides in pypi for version 5.15.0 I see that it does not provide the binaries for python3.9 in windows, so pip is trying to compile using the source code which is complicated and can generate several dependency problems (for example you must have Qt 5.15 installed, etc). So my recommendation is to install a more updated version of PyQt5, for example 5.15.2 since if it provides the binaries for python3.9 on windows, in addition to being a wrapper of an LTS version of Qt then it will have solved several bugs.
python -m pip install PyQt5==5.15.2
Another solution is to use python3.8 instead of python3.9 so that you can install pyqt5 5.15.0 from pypi without problems.
Upgrading your pip enables you to install PyQt5. Personally, I had the same issue while installing PyQt6 and I upgraded my pip, and everything installed perfectly. I think both python and pip versions play an important role in installing PyQt so make sure you have later versions.
This is the command I used in Linux:
pip install --upgrade pip
Combining several answers on this question: On an Apple M1 Pro Macbook with macOS Ventura 13.0.1, with Homebrew 3.6.17 and python 3.11.0 the following commands fixed it for me (no sudo):
brew install qt5
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
python3 -m ensurepip --default-pip
pip3 install pyqt5-sip
pip3 install pyqt5 --config-settings --confirm-license= --verbose
That last step calls qmake to compile all of Qt on your M1 and takes many minutes to complete, be patient and let it finish.
Since qt5-default was not available, I installed qt5-default's dependencies
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
after that I installed pyqt5 via apt-get first and afterwards via pip
sudo apt-get install pyqt5-dev
pip install pyqt5
now wheel seems to work
side-note:
I am not sure if sudo apt-get install pyqt5-dev is even necessary
The error message thrown here is misleading - it's not an issue with a sipbuild.api attribute. Indeed, in this case program qmake is missing, see last line of the Python traceback. Have a look if it's installed on your system and add it to your PATH variable. Otherwise, install it. On Linux this would be done with
sudo apt-get install qt5-qmake
I had this problem on my M1 Mac using Python 3.9.12 when I was trying to install a library: pip install pixellib.
The first thing I did was: pip install pixellib --verbose to see the whole log, and there I noticed that PyQt5 was waiting for an input. So then I found someone else with that issue, and used pip install pyqt5 --config-settings --confirm-license= --verbose which took some time to compile, but worked!
I could not get any of the above solutions to work but I managed to get it working using python3.9, PyQt5=5.15.2, pip=22.0.2 and sip=6.5.0 by using sudo apt-get install PyQt5. If you need it in a virtual environment, you can manually copy the PyQt5 folder from your default /usr/lib/python3/dist-packages to the site-packages folder in your virtual environment.
To all those that are struggling with Apple M1 installation, here is a working solution, specifically addressing the problem of installing the pixellib library that depends on PyQt5 but you can apply it equally to other libs:
PyQt5 is not supported on Apple M1, it needs qt6: https://www.reddit.com/r/learnpython/comments/o4w1ut/comment/h2jele3/?utm_source=share&utm_medium=web2x&context=3 , https://www.qt.io/product/qt6
this means you need to install PyQt6: python3 -m pip install PyQt6
go to the lib you need, in my case pixellib: https://pypi.org/project/pixellib/#files and
download the wheel file
get the wheel tool: pip install wheel
unpack the wheel wheel unpack pixellib-0.7.1-py3-none-any.whl
Change its dependency of PyQt5 to PyQt6
edit pixellib-0.7.1/pixellib-0.7.1.dist-info/METADATA
pyQt5 => pyQt6
pack it back wheel pack pixellib-0.7.1
install it: pip install pixellib-0.7.1-py3-none-any.whl
test in python: `
# should work
import pixellib
P.S. thanks to Terra and ChaOS for supporting work on the project underlying this report.
I finally managed to make it works on M1/M2 Macbook Pro.
None of these answers worked for me, so I looked at brew to install pyqt.
The following command will install pyqt5 via brew:
brew install pyqt#5
Then it just worked.
This can be resolved by switching to an environment with Python >= 3.8

can not install specific version of nltk

for a specific reason I need to install nltk 2.09b in python 2.7 version. But whenever I execute the following command,
pip2 install nltk==2.0b9
I get the following error:
Collecting nltk==2.0b9
Using cached https://files.pythonhosted.org/packages/ea/b3/4c5157bf034437905fbbd3c80e58c8b4a22cf3400db0bdf19dae3079a732/nltk-2.0b9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/3b/yskb8jks10lf_pqvv1sy7v740000gn/T/pip-install-63jdDZ/nltk/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3b/yskb8jks10lf_pqvv1sy7v740000gn/T/pip-install-63jdDZ/nltk/
But if I run without any version specification I don't get an error. like the following:
pip2 install nltk;
How can I solve this issue?
First thing: using anaconda, you probably have a recent enough pip and setuptools and should use conda itself to update those. With anaconda, conda install is the primary resource for installing anaconda-provided packages. Then, "2.0b9" is a beta release (as indicated by the "b9") and might suffer from a configuration problem for the install. The setup.py file is not located at the root of the downloaded archive file, I suppose that creates the problem.
Use this
pip3.6 install nltk==version

python pip install os windows errno 2

trying to pip install the os modules on a Python 3.6 build on windows 10. Searching has led me to run as administrator, to try to update pip, run with a different cache directory so it downloads a fresh tarball, and also update setuptools. No luck with anything. Very odd to me is the double backslash in the filename. I'm very green when it comes to the python architecture. One thing that may or may not be relevant is that this is a replacement PC where I attempted to migrate data from my Win7 PC. But that may be a red herring. Anyway here's the output. Any help appreciated. Thanks!
c:\Python36>pip install os
Collecting os
Using cached os-0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python36\lib\tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\swideb\\AppData\\Local\\Temp\\pip-build-_g65v8sr\\os\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\swideb\AppData\Local\Temp\pip-build-_g65v8sr\os\
c:\Python36>
The os package comes standard. See here for the Python 3.6 library. No need to install it with pip. Just import os.

Installing bsddb3 6.1.1 in Windows: FileNotFoundError: 'db/include\\db.h'

I'm running Windows 7 x64, with Python 3.4. When I run pip install bsddb3 I get:
λ pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Users\User\AppData\Local\Temp\pip-build-soqf0_qb\bsddb3\setup.py", line 42, in <module>
import setup3
File "C:\Users\User\AppData\Local\Temp\pip-build-soqf0_qb\bsddb3\setup3.py", line 375, in <module>
with open(os.path.join(incdir, 'db.h'), 'r') as f :
FileNotFoundError: [Errno 2] No such file or directory: 'db/include\\db.h'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-build-soqf0_qb\bsddb3
So I tried downloading the sources for bsddb3. I made sure I had the BSD DB Windows binaries from Oracle installed; I downloaded them from Berkeley DB 6.1.26.msi. Moving the include and lib directories from the DB install to a /db directory in the bsddb3 folder fixed the problem of not being able to find the libraries. But then the setup failed on a missing variable that's in the posix section but not properly declared in the Windows section.
Fixing that, and a couple of other adjustments, and python setup.py build actually ran the build, but after a bunch of warnings about unsafe conversions it failed with an error:
warning: I don't know what to do with 'runtime_library_dirs': ['db/lib']
error: don't know how to set runtime library search path for MSVC++
I'm not sure what to do next. Other than rewrite the library I was originally trying to use so that it uses SQLAlchemy instead or something.
One don't really want to spend couple of nights compiling that on Windows, so the best option is to use pre-built binary from Unofficial Windows Binaries for Python Extension Packages.
Download the package for your Python version (cpXX part of the name) and architecture (win_amd64 or win32), like bsddb3-6.1.1-cp34-none-win_amd64.whl, and install it with pip:
pip install bsddb3-6.1.1-cp34-none-win_amd64.whl
Based on cyberj0g's answer.
https://www.lfd.uci.edu/~gohlke/pythonlibs/#bsddb3
pip install bsddb3-6.1.1-cp34-none-win_amd64.whl
Note: the cp part is corresponding to the CPython version.
which means cp36 is for CPython 3.6.And divided into 32-bit and 64-bit versions for windows
bsddb3‑6.2.5‑cp36‑cp36m‑win32.whl
bsddb3‑6.2.5‑cp36‑cp36m‑win_amd64.whl

Categories

Resources