I install a rasbian os on my vmware workstation and I am currently trying to install some packages and modules. I have a problem with pip. I try:
sudo pip install PyQt5
sudo pip3 install pyqt5
sudo python3 -m pip install PyQt5
I got the same error.
ERROR: Could not find a version that satisfies the requirement pyqt5 (from versions: none)
ERROR: No matching distribution found for pyqt5
I try to install PyQt5 manually and for that I install sip with sudo pip3 install sip after that I try to configure pyqt5 files with python configure.py but I got this error:
Error: Unable to import PyQt5.sip. Make sure you have configured SIP to create a private copy of the sip module.
I already install sip. But my main problem is about pip. It's not working like I expect
I'm not sure if it's about pip or it is a problem about operating system (or if it is about me).
python --version:2.7.16
python3 --version:3.7.3
pip --version I got the error
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pip._internal.main import main
ImportError: No module named main
sudo pip --version :19.3.1
pip3 --version :18.1
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
I had some error, when tried to install on virtualenv. It helped me:
pip install --upgrade pip
Before I had 19.0.3 versin and upgraded to 22.0.4
then:
pip install PyQt5
Related
Goal: To import pyqt5 into python3 under Ubuntu 18.04
I know there are many answers to similar questions here and elsewhere. I have tried a lot of them, but I don't see anything that exactly matches my situation.
Starting with a clean installation of Ubuntu 18.04, I have tried many ways to be able to have the statement import pyqt5 succeed in Python 3.6.9, which is the default python3 on this distribution.
None of them have succeeded.
In several attempts, reinstalling Ubuntu anew several times, I have had pip3 either experience a 404 downloading https://pypi.org/simple/python3-pyqt5/ and confirmed the error by pasting the URL into Firefox and also getting a 404. (I also checked the Firefox was working fine accessing the Internet)
But usually I run through a process that seems to indicate that pyqt was loaded successfully but was still unable to import it in Python3.
Among the things I've tried from various web sites are:
pip3 install --upgrade pip
pip3 install pyqt5==5.14.0 vs pip3 install pyqt5 (defaulting to 5.14.1)
installing a simple pypi module and finding that I can import it into Python3 with no problem
running pip3 under sudo
upgrading python3 to Python 3.7.4
A more complete list of what I did starting with the reinstall is shown below.
Any suggestions for solutions or what to look at on my system?
I have a bootable memory stick of Ubuntu 18.04.4 that I created last week by downloading the executable from Ubuntu.com. Everything that's packaged with the release seems to work fine, including Python 3.6.9 in other situations. I do virtually nothing except the following steps.
sudo apt install python3-pip
pip3 install humanfriendly (just to ensure that pip3 works for a simply pypi module)
pip3 install --upgrade pip
pip3 install python3-pyqt5
sudo apt-get install pyqt5-dev-tools (no complaints from pip3 seems to work okay)
sudo apt-get install qttools5-dev-tools (seems to work)
in python3
>>>import pyqt5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyqt5'
pip3 uninstall pyqt5 (Successfully uninstalled PyQt5-5.14.0)
pip3 install pyqt5 --user (Successfully installed pyqt5-5.14.1
Try to import in python3 again, same result: "No module named 'pyqt5'"
cd ~/.local/bin
ls
humanfriendly pip pip3 pip3.6 pylupdate5 pyrcc5 pyuic5
(there seems not to be an entry for pyqt5 although there is for some of its stand-alone componentes)
pip3 uninstall pyqt5
ls
humanfriendly pip pip3 pip3.6
(what was there went away)
pip3 uninstall pyqt5 (Successfully uninstalled PyQt5-5.14.1)
pip3 install pyqt5 --user (seems to succeed)
try to import in python3 (same error)
pip3 uninstall pyqt5 (Successfully uninstalled PyQt5-5.14.1)
next I tried sudo pip3 uninstall pyqt5
seems to work; not importable in python3; sudo pip3 uninstall
next I created a virtual env, ~/.vents/tevs
activate the venv
pip3 install pyqt5==5.14.0
Installing collected packages: PyQt5-sip, pyqt5
attempt to import pyqt5 in python3: fails as before
pip3 uninstall pyqt5
(Successfully uninstalled PyQt5-5.14.0 after listing thousands of files
in .venvs/tevs/lib/python3.6/site-packages/PyQt5)
pip3 install python3-pyqt5
(fails with HTTP Error: 404 Client Error:
Not Found for url: https://pypi.org/simple/python3-pyqt5/)
Several problems should be noted in what the OP notes:
The name of the library does not necessarily match the name of how to import the libraries, on the other hand pip accepts names like pyqt5 and PyQt5 as equivalent, but when you import it you should use PyQt5, not pyqt5, so to test that you have installed you can do the following:
Run on the console:
$ python3 -c "from PyQt5.Qt import PYQT_VERSION_STR; print(PYQT_VERSION_STR)"
5.14.1
Run on python console:
Python 3.8.1 (default, Jan 22 2020, 06:38:00)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> print(PYQT_VERSION_STR)
5.14.1
python3-pyqt5 is the name of the package that offers ubuntu repositories for the version of pyqt5 that your community compiles which is generally a non-current version. So to install pyqt5 there are several methods:
Using ubuntu repository: sudo apt-get install python3-pyqt5
Using pip: python3 -m pip pyqt5 (You must use sudo if required) or python3 -m pip install pyqt5 --user (This method also applies to virtualenv)
So I can conclude that the OP has successfully installed PyQt5 but has failed to verify if the installation has been correct so I recommend using what is indicated in (1)
I recently encountered this problem on Ubuntu 20.04 and here is what worked for me.
Firstly, after trying much of what you described I finally decided to run python --version from terminal and the output told me that python 2.7 was the default version on my system. This was the problem.
Secondly, after thinking "sheeeee-*t partner", I checked for any python2 dependencies using apt rdepends python --installed.
Lastly, after confirming that I had no python2 dependencies, I ran sudo apt-get install python-is-python3 in order to make python3 the default version.
pip3 install PyQt5
Collecting PyQt5
Using cached https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.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-b2zw891b/PyQt5/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-b2zw891b/PyQt5/
Then I downloaded zip folder from https://www.riverbankcomputing.com/software/pyqt/download5 and run:
python3 configure.py --qmake /home/oo/Qt/5.14.0/gcc_64/bin/qmake
make
sudo make install
Successful
>>> import PyQt5
>>> import PyQt5.QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
>>>
So I installed
pip3 install PyQt5.sip
pip3 install sip
Successful
but still getting same error No module named 'PyQt5.sip' for import PyQt5.QtCore
also tried PyQtChart but still error
pip3 install PyQtChart
Collecting PyQtChart
Using cached https://files.pythonhosted.org/packages/83/35/4f6328db9a31e2776cdcd82ef7688994c11e265649f503858f1913444ba9/PyQtChart-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting PyQt5>=5.14 (from PyQtChart)
Using cached https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.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-gzep4mr7/PyQt5/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-gzep4mr7/PyQt5/
I also downloaded zip folder from https://www.riverbankcomputing.com/software/pyqtchart/download and run:
python3 configure.py --qmake /home/oo/Qt/5.14.0/gcc_64/bin/qmake
Error: Unable to import PyQt5.QtCore. Make sure PyQt5 is installed.
QT screenshot::
My end goal is to run candlestick chart using pyqt5.
sudo python3 -m pip install pyqt5 pyqtchart
[sudo] password for oo:
The directory '/home/oo/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/oo/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pyqt5 in /usr/lib/python3/dist-packages
Requirement already satisfied: pyqtchart in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: PyQt5-sip<13,>=12.7 in /home/oo/.local/lib/python3.6/site-packages (from pyqtchart)
but still getting same error:
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>> import PyQt5.QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
>>>
I think the initial pip install woes were due to PyQt5 switching to the manylinux2014 platform tag for the latest release (see the wheels on PyPI for 5.14.1 vs 5.14.0). Only pip versions >= 19.3 recognize this platform tag (ref), so if you happen to have an older version of pip, it would instead try to install from source.
Two easy options (to avoid the source install):
Update pip to the latest via pip3 install --upgrade pip
Install the previous release, which used manylinux1 (pip3 install pyqt5==5.14.0)
It seems that there is a bug in the latest version of PyQt5 to pypi so I installed a version 5.14:
sudo apt-get update && \
sudo apt-get autoclean
sudo apt-get update && sudo apt-get install \
-y --no-install-recommends \
python3-pip \
python3-setuptools
sudo python3 -m pip install pyqt5==5.14 pyqtchart==5.14
Copy the example of my previous answer in the main.py and then run:
python3 main.py
I recommend you search the folders and files generated by your failed attempts and delete them.
For my test I used the following Dockerfile
I also had the same issue installing PyQt5 (while trying to install ReText).
On Ubuntu 18.04 with Python 3.6.9 and Pip 9.0.1, I was able to pip install PyQt5 with these steps:
python3 -m venv env
source env/bin/activate
pip3 install pyqt5 --only-binary pyqt5
That was enough to make pip download the PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl binary wheel (that doesn't need/use the setup.py) instead of building from the source tarball.
According to https://pypi.org/project/PyQt5/#files, there are other binary wheels too, so hopefully that'll cover most platform needs.
Sometimes it is very difficult to install PyQt5 on Debian or Ubuntu Linux distro.
I was able to install it for python3 on my system running Debian 10 buster (stable).
I installed it with the apt package manager.
sudo apt-get update
sudo apt-get install python3-pyqt5
I have this problem too. It's because your pip is on older version and you should update it by using the below commands:
pip3 install setuptools wheel
pip3 install --upgrade pip
pip3 install --user pyqt5
For those who do not desperatly need 5.14, 5.12 can be a solution. This worked for me:
sudo python3 -m pip install pyqt5==5.12 pyqtchart==5.12
As the Question showed, you are downloading tar.zip file not wheel. Installing QT with pip is only allowed with wheel. Choose the version that has wheel file in PyPI homepage and matches to your Python version.
I had to build right version of sip from source in order to build desired version of PyQt5 from source and then I also got following error:
No module named 'PyQt5.sip'
and then
python3 -m pip install PyQt5.sip
solved the issue
I am having trouble properly installing pip3 for python3. It appears that I have installed pip and pip3 successfully.
whereis pip
pip: /usr/local/bin/pip /usr/local/bin/pip3.7
whereis pip3
pip3: /usr/bin/pip3 /usr/local/bin/pip3 /usr/local/bin/pip3.7 /usr/share/man/man1/pip3.1.gz
What makes me curious is when I type:
pip --version
pip 19.0.3 from /home/fmd/.local/lib/python3.6/site-packages/pip (python 3.6)
This gives proper result but when I do the same for pip3 I this:
pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
I have referred
https://pip.pypa.io/en/stable/installing/
How do you uninstall the package manager "pip", if installed from source?. And tried to uninstalling and reinstalling pip3 but it dosent seem to work I get the same error as above. How do I remove this error?
My system is:
> NAME="Ubuntu" VERSION="18.04.2 LTS (Bionic Beaver)" ID=ubuntu
> ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.2 LTS" VERSION_ID="18.04"
My bad seems like I installed pip3.7 binary
pip3.7 --version
pip 19.0.3 from /home/fmd/.local/lib/python3.6/site-packages/pip (python 3.6)
I would install python3 dependencies using pip3.7 rather than pip3
for example pip3.7 install numpy and so on.
After I upgraded pip from 8.1.1 to 19.0.1 by running
pip install --upgrade pip
I tried to test the version of pip by running
pip -V
But I got the following error
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
I set the python3 and pip3 to be default by putting the following in ~/.bashrc
alias python=python3
alias pip=pip3
My system is ubuntu 16.04
This is a common issue as referenced here : https://github.com/pypa/pip/issues/5221
You are trying to use the pip, which is shipped with the Debian system. You better try to avoid using that pip at any cost.
Please use python3 -m pip install package instead of the system pip which you have in the debian system.
I also recommend using venv - virtual environments for keeping your system environment safe.
I am trying to install something using "python setup.py install" but it shows me this error :-
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup
ImportError: No module named setuptools
I have installed this missing module using "pip install setuptools". But still it shows me the same error .I have also tried to install this using "sudo apt-get install python-setuptools" but the problem still remains the same. Help me in this issue
If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version:
On Linux or macOS:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
If you’re using a Python install on Linux that’s managed by the system package manager (e.g “yum”, “apt-get” etc…), and you want to use the system package manager to install or upgrade pip, then see link