No module named 'setuptools', even though the module is installed - python

I'm trying to install the openpyxl package with pip, using Windows.
PS C:\Scripts> pip install openpyxl
Collecting openpyxl
Using cached openpyxl-2.5.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
When I run the setuptools installation I get:
PS C:\Scripts> pip install setuptools
>>
Requirement already satisfied: setuptools in c:\scripts\lib\site-packages
I tried uninstalling and installing the setuptools again, but no success. What am I doing wrong?
PS C:\Users\dolinar\Desktop\setuptools-38.4.0> python .\easy_install.py
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 2] No such file or directory: 'C:Lib\\site-packages\\test-easy-install-9076.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:Lib\site-packages\
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
The directory exists.

It should be installed system-wide. If you are using Ubuntu/Debian:
apt-get install -y python-setuptools
If you are on Windows, see this answer to install setup tools.

Related

pip raise FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-_2yekith/pyqt5/setup.py' [duplicate]

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

Error while installing robotframework -ride

I'm new to Python and have been trying to install some packages with pip.
I have gone through this sequence-------------
Download Python 2.7.15 from
https://www.python.org/downloads/
PATH = C:C:\Python27;C:\Python27\Scripts
(Is this we have to set in User Variable or System Variable?)
Then download wxPython from this link (Download this version wxPython2.8-win64-unicode-2.8.12.1-py27)
http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
Then
Download setuptools (setuptools-39.2.0.zip) for Python from
https://pypi.org/project/setuptools/#files
Then
Download PIP files (pip-10.0.1.tar.gz) from
https://pypi.org/project/pip/#files
Now Extract the Setuptools
After extracting from the same folder TYPE "cmd" it will open then run this commend
"python setup.py install"
Now Extract the PIP files
After extracting from the same folder TYPE "cmd" it will open then run this commend
"pip install robotframework"
On the cmd run these commends one-by-one
pip install robotframework-ride
pip install robotframework-selenium2library
pip install selenium
pip install decorator
pip install docutils
pip install xlrd
pip install xlwt
pip install xlutils
pip install pigments
But pip install robotframework-ride unroll gives me
D:\Python\pip-10.0.1\pip-10.0.1>pip install robotframework-ride
Collecting robotframework-ride
Using cached https://files.pythonhosted.org/packages/3c/14/a5f97f5cf5e981f01e8
c0b4c405b0dfc9bc86500cabb044d2c462f73004a/robotframework-ride-1.5.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Deeksha\AppData\Local\Temp\pip-install-f5wsnk57\robotframew
ork-ride\setup.py", line 20, in <module>
execfile(join(ROOT_DIR, 'src', 'robotide', 'version.py'))
NameError: name 'execfile' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Deeksha\
AppData\Local\Temp\pip-install-f5wsnk57\robotframework-ride\
How can I solve this?

Cannot upgrade awscli: no module named _internal and other errors

When I try to upgrade awsli: pip install awscli --upgrade, I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
ImportError: No module named _internal
Following the instructions on Stackoverflow: pip: no module named _internal
Then I get the following errors:
python2.7 get-pip.py --user --force-reinstall
Collecting pip
Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
botocore 1.9.22 requires docutils>=0.10, which is not installed.
awscli 1.14.69 requires colorama<=0.3.7,>=0.2.5, which is not installed.
awscli 1.14.69 requires docutils>=0.10, which is not installed.
awscli 1.14.69 requires rsa<=3.5.0,>=3.1.2, which is not installed.
awscli 1.14.69 requires s3transfer<0.2.0,>=0.1.12, which is not installed.
Installing collected packages: pip
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/porter/.local/lib/python2.7'
Check the permissions.
You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
So, all in all it is a great mess. I don't think that upgrading to pip version 10.0.1 will do any good.
Edit:
I found the culprit: /home/porter/.local/lib/python3.5. In this folder, there are the site-packages that pip is asking about: colorama, docutils, rsa, s3 etc.
What to do now? awscli is installed at: /usr/local/lib/python2.7/dist-packages/awscli
but its dependencies are installed at: /home/porter/.local/lib/python2.7/
so upgrading awscli, even after changing the permissions, doesn't work.
Maybe it is better to deinstall awscli alltogether? But how?
It appears that you have files in your home directory that aren't owned by you. This is the common result of using the sudo command improperly at some point in the past. Find these files with:
find $HOME -not -user $USER -exec ls -lad {} \;
and change ownership back to you with the chown command.
I got it done. It needs a few steps though.
1. I deleted the site-packages in /home/porter/.local/lib/python2.7/
2. I then removed awscli with this command:
sudo python -m pip uninstall awscli
I had to use the python -m command. Otherwise I got the above-mentioned error:
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
ImportError: No module named _internal

Cannot pip install scipy, mlxtend and math libraries

I am using python 3.5 on windows 10. I am not able to install some libraries like scipy, mlxtend and math.
I have installed and upgraded setuptools and ez_setup following this answer
Python pip install gives "Command "python setup.py egg_info" failed with error code 1"
When I try to pip install scipy and mlxtend I get the following error:
NotFoundError: no lapack/blas resources found
And when I try to install math I get the following error:
Using cached Math-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:\Users\raisa\AppData\Local\Temp\pip-build-e23g412r\math\setup.py", line 2, in <module>
raise RuntimeError("Package 'Math' must not be downloaded from pypi")
RuntimeError: Package 'Math' must not be downloaded from pypi
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\raisa\AppData\Local\Temp\pip-build-e23g412r\math\
On Windows, you'll want to locate the unofficial binaries here and download the appropriate .whl files for the packages you're wanting to install. Use pip to install and upgrade wheel and setuptools then do pip install the_name_of_the_file.whl
so altogether, assuming you want to install matplotlib and the .whl file is in your current directory...
pip install wheel
pip install --upgrade setuptools
pip install matplotlib‑1.5.3‑cp35‑cp35m‑win32.whl

pip install failure :Command python setup.py egg_info failed with error code 1 [duplicate]

I'm trying to install PyQt package with pip, but I get this error:
~$ pip install PyQt
Downloading/unpacking PyQt
Downloading PyQt-x11-gpl-4.8.3.tar.gz
(9.8Mb): 9.8Mb downloaded Running
setup.py egg_info for package PyQt
Traceback (most recent call last):
File "<string>", line 14, in <module>
IOError: [Errno 2] No such file or directory:
'/home/john/build/PyQt/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in
<module>
IOError: [Errno 2] No such file or
directory:
'/home/john/build/PyQt/setup.py
---------------------------------------- Command python setup.py egg_info
failed with error code 1 Storing
complete log in
/home/john/.pip/pip.log
That's because that file has a configure.py not a setup.py. configure.py generate a make file that you use to build pyqt against the qt lib you choose by passing --qmake option to configure.py, it has different options too. I suggest filing a bug with the pip maintainer.
If you're on Mac, you can use homebrew:
brew install pyqt
You can, alternatively, install PyQt4 using ActivePython's binary package manager.
$ pypm install pyqt4
The following packages will be installed into "~/.local" (2.7):
pyqt4-4.8.3.0
Hit: [pypm-free.activestate.com] pyqt4 4.8.3.0
Installing pyqt4-4.8.3.0
$
So long as you already have PyPM, no compilation required.
Sharing my setup procedure:
create virtual environment on your project folder and activate:
python3 -m venv venv
source venv/bin/activate
use pip to install PyQt5 (Note: specify the version especially on Centos7)
pip3 install pyqt5==5.14
you can pip install the directory of the downloaded version of pyqt after you download it ..google for your desired version

Categories

Resources