Downgrading Python Setuptools - python

I am getting an error while attempting to use Pyinstaller. After doing some research I believe the error is caused by a bug in the most recent version of setuptools (19.3). The fix seems to be downgrading to setuptools version 19.2. My issue is with the downgrade itself. My question is how does one downgrade setuptools in Ubuntu 15.04?

Just specify the version using pip:
pip install setuptools==19.2
If you are installing globally you will obviously need sudo.
~$ sudo pip install setuptools==19.2
Collecting setuptools==19.2
Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 486kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 19.1
Uninstalling setuptools-19.1:
Successfully uninstalled setuptools-19.1
Successfully installed setuptools-19.2
~$ sudo pip install setuptools==19.1
Collecting setuptools==19.1
Downloading setuptools-19.1-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 377kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 19.2
Uninstalling setuptools-19.2:
Successfully uninstalled setuptools-19.2
Successfully installed setuptools-19.1

Related

ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project

I am updating PyGObject and give an error.
How should I update PyGObject
.....
Environment:
macOS Big Sur 11.5.2
python --version
Python 3.9.7
pip --version
pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
my operation.
ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
pip install --upgrade PyGObject
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: PyGObject in /usr/local/lib/python3.9/site-packages (3.40.1)
Collecting PyGObject
Using cached PyGObject-3.42.0-cp39-cp39-macosx_11_0_x86_64.whl
Requirement already satisfied: pycairo>=1.16.0 in /usr/local/lib/python3.9/site-packages (from PyGObject) (1.20.1)
Installing collected packages: PyGObject
Attempting uninstall: PyGObject
Found existing installation: PyGObject 3.40.1
ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Pip is unsure on the package dependencies to clean up in the upgrade. You can force the upgrade by telling it to ignore what is already installed.
pip install PyGObject --ignore-installed

Pip hangs on installing packages

I'm using django in a virtual environment. I'm using powershell and trying to install pyopenssl.
Inside Virtual environment:
pip version = 19.2.3
python version = 3.8.3
Outside Virtual environment:
pip version = 21.2.4
python version = 3.8.3
I tried to upgrade pip inside virtual environment using python -m pip install -U pip and pip install --upgrade pip but it is hanged without producing any output here is the screenshot.
I try pip install pyopenssl:
(bookmarks) bookmarks> pip install pyopenssl
Collecting pyopenssl
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting six>=1.5.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting cryptography>=3.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
Installing build dependencies ...
it hangs on Installing build dependencies .... I've waited 30mins but nothing happened.
I've also tried python -m pip install pyopenssl
(bookmarks) bookmarks> python -m pip install pyopenssl
Collecting pyopenssl
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting cryptography>=3.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
Installing build dependencies ... \
And when I try pip -v install pyopenssl:
(Since the ouput is large, i'm only showing the last part.)
Added semantic-version>=2.6.0 from https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-any.whl#sha256=45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9 (from setuptools-rust>=0.11.4) to build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
Removed semantic-version>=2.6.0 from https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-any.whl#sha256=45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9 (from setuptools-rust>=0.11.4) from build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
Installing collected packages: setuptools, wheel, pycparser, cffi, toml, semantic-version, setuptools-rust
Creating C:\Users\Suhail\AppData\Local\Temp\pip-build-env-fwbrqqmx\overlay\Scripts
Successfully installed cffi-1.14.6 pycparser-2.20 semantic-version-2.8.5 setuptools-58.1.0 setuptools-rust-0.12.1 toml-0.10.2 wheel-0.37.0
Cleaning up...
Cleaned build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 304 0
Here again i'm stuck at this output, and pyOpenSSL is not installed.
However, pip install pyopenssl worked outside of the virtual environment screenshot
I'm stuck at this freeze for 2 days.
If you know the solution then please answer it. Thankyou
Here's what worked for me
Step 1: First I uninstalled pip:
pip uninstall pip
To make sure pip is uninstalled type pip and make sure you get ModuleNotFoundError: No module named 'pip'
Step 2: Download PIP get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Step 3: Install PIP:
python get-pip.py
To make sure pip is installed run pip --version make sure it is latest, (21.2.4) as of now.
Finally I was able to install pyopenssl :))
pip install pyopenssl

pip install failed, in ubuntu18 or in clean docker container because hash doesn't match

The problem is like following one.
In some machines, I can't install django with pip. (not only django, but also numpy and so on...)
$ pip install --no-cache-dir django
Collecting django
Downloading Django-3.1.7-py3-none-any.whl (7.8 MB)
|????????????????????????????????| 7.8 MB 5.6 MB/s
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8:
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got 7140cf41703d27896793ef3ca9f79323d12eac477f8cea29c79c76a7f17379f1
I checked the some articles in stackoverflow and noticed that there are many questions concerning this problem.
Learning from those articles, then I'm struggling.
By the way, in stackoverflow, I found the answer which says this problem is likely to be the issue of the pip.
Please refer to https://stackoverflow.com/a/61731528/8674852.
So I tried installing in the machine with old pip, then I have succeeded to install django with pip.
It is the pip 20.3.3.
Succeeded
$ pip --version
pip 20.3.3 from /home/user/.local/lib/python3.6/site-packages/pip (python 3.6)
$ pip install django
Defaulting to user installation because normal site-packages is not writeable
Collecting django
Downloading Django-3.1.7-py3-none-any.whl (7.8 MB)
|????????????????????????????????| 7.8 MB 2.8 MB/s
Collecting asgiref<4,>=3.2.10
Using cached asgiref-3.3.1-py3-none-any.whl (19 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting pytz
Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)
|????????????????????????????????| 510 kB 3.0 MB/s
Installing collected packages: sqlparse, pytz, asgiref, django
Successfully installed asgiref-3.3.1 django-3.1.7 pytz-2021.1 sqlparse-0.4.1
WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Failed
But the other machine with pip 21.0.1 failed to install django.
$ pip --version
pip 21.0.1 from /home/user/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pip (python 3.8)
$ pip install django
Collecting django
Using cached Django-3.1.7-py3-none-any.whl (7.8 MB)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8:
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got 7c5af478cb5c9748d0477912637f98da101a0e7be763b61c71c053e0cc98fa08
But ...., In this machine, even if I downgraded pip into 20.0.2 or 20.3.3, the result didn't changed, installing failed.
$ pip install pip==20.0.2
Collecting pip==20.0.2
Downloading pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
|????????????????????????????????| 1.4 MB 3.1 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.0.1
Uninstalling pip-21.0.1:
Successfully uninstalled pip-21.0.1
Successfully installed pip-20.0.2
$ pip install --no-cache-dir django
Collecting django
Downloading Django-3.1.7-py3-none-any.whl (7.8 MB)
|????????????????????????????????| 7.8 MB 6.4 MB/s
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8:
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got ba57de6ac1d02039af8ce41e9af8663fd9fb6b62db55870b9b1e6eabe5c1ff73
WARNING: You are using pip version 20.0.2; however, version 21.0.1 is available.
You should consider upgrading via the '/home/user/.pyenv/versions/3.8.8/bin/python3.8 -m pip install --upgrade pip' command.
Environment
By the way, all of the above execution of commands was done in the same host PC.
But I tried pip install django in several different environments in the same host PC.
pip
Guest OS
Virtualmechanism
Host OS
Specifiedversion
Result
20.3.3
Ubuntu18
virtualbox
windows10
null
success
20.3.3
Ubuntu18
virtualbox
same with above
3.1.7
success
21.0.1
Ubuntu20
WSL2
same with above
null
success
21.0.1
Ubuntu20
WSL2
same with above
3.1.7
success
20.0.2
CentOS7
virtualbox
same with above
null
fail
20.0.2
CentOS7
virtualbox
same with above
3.1.7
fail
20.3.3
CentOS7
virtualbox
same with above
null
fail
20.3.3
CentOS7
virtualbox
same with above
3.1.7
fail
21.0.1
CentOS7
virtualbox
same with above
null
fail
21.0.1
Ubuntu18(different from above)
virtualbox
same with above
null
fail
21.0.1
Debian GNU/Linux 10 (buster)
docker
ubuntu18 on windows10
null
fail
21.0.1
Debian GNU/Linux 10 (buster)
docker
ubuntu18 on windows10
3.1.7
fail
* To specify version I executed $ pip install django==3.1.7 and pip install --no-cache-dir django==3.1.7
Question
Why these problem occurs ?
Is the cause of this problem the network configuration ?
Is there anything I could do for finding the solution ?
Memo
One committer for the pip said
it sounds like a network configuration problem on your production server
Please refer to pypa/pip : package installation issue on the server-THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE #8510
But no one knows what kind of network configuration effects against the hash.
Could you tell me how I can investigate the cause network configuration?
There is also other answer saying it is the problem of https://pywheels.org/.
Please refer to https://stackoverflow.com/a/52407348/8674852.
But...., at least, though it is not everytime, I succeeded to execute pip install django.
So, I'm not sure but I think https://pywheels.org/ isn't the cause of this problem at now.
About other module
pip can't install not only django, but also numpy in above failed environment.
This is the sample of the result executed in docker container.
# in this container, I executed `pip install numpy --no-cache-dir`
web_1 | Requirement already satisfied: pip in /usr/local/lib/python3.8/site-packages (21.0.1)
web_1 | Collecting numpy
web_1 | Downloading numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB)
web_1 | ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
web_1 | numpy from https://files.pythonhosted.org/packages/75/f6/60e7d3a1da53a9979f37931d3cc619211accb339df06af8b387889b8d6ba/numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl#sha256=edb1f041a9146dcf02cd7df7187db46ab524b9af2515f392f337c7cbbf5b52cd:
web_1 | Expected sha256 edb1f041a9146dcf02cd7df7187db46ab524b9af2515f392f337c7cbbf5b52cd
web_1 | Got ea51c3b37824f3efff5ad03076fdeb6d802e153664ec73599054a006262105a5
Besides, I couldn't even downgrade pip in docker container which failed to install django 3.1.7.

How to install websocket 8.1 via pip

Trying to install websocket 8.1 version but i couldnt install that spesific version.
pip install websockets
This is installing 8.0.2
Successfully installed websockets-8.0.2
Then Im writing
pip install websocket 8.1
then it says
Collecting websocket
Downloading https://files.pythonhosted.org/packages/f2/6d/a60d620ea575c885510c574909d2e3ed62129b121fa2df00ca1c81024c87/websocket-0.2.1.tar.gz (195kB)
100% |████████████████████████████████| 204kB 819kB/s
Collecting 8.1
Could not find a version that satisfies the requirement 8.1 (from versions: )
No matching distribution found for 8.1
Python and pip versions.
Python 3.6.0
pip 9.0.1
Any help apreciated...
You should replace websocket with websockets:
pip install websockets==8.1
Collecting websockets==8.1
Downloading https://files.pythonhosted.org/packages/cf/cb/c35513c4a0ff24ca13e33f7336ba8c1a864449fad9fea8e37abdad11c38d/websockets-8.1-cp36-cp36m-manylinux1_x86_64.whl (73kB)
100% |████████████████████████████████| 81kB 934kB/s
Installing collected packages: websockets
Successfully installed websockets-8.1
I checked and it works fine.
You need at least python==3.6.1 in your case.

How do you install Python Xlib with pip?

"Python Xlib" ( http://pypi.python.org/pypi/Python%20Xlib ) is a low level python library for working with xlib. I have installed it on my Ubuntu Linux machine via apt, i.e. sudo aptitude install python-xlib. However is it possible to install it with pip in a virtualenv? I am writing a software package that uses xlib, and would like to be able to include an install_requires line in my setup.py.
Since the package is on PyPI (and appears in results of pip search xlib), I tried to pip install … the following package names but nothing worked: python\ xlib, python-xlib, Python Xlib, Python-Xlib, Python%20Xlib, but none worked.
`
Is it possible to install python xlib with pip?
sudo pip install svn+https://svn.code.sf.net/p/python-xlib/code/trunk/
Worked for me.
pip3 install python3-xlib
and
pip3 install python-xlib
When we run this command from the terminal, we can easily install it:
Collecting python3-xlib
Downloading https://files.pythonhosted.org/packages/ef/c6/2c5999de3bb1533521f1101e8fe56fd9c266732f4d48011c7c69b29d12ae/python3-xlib-0.15.tar.gz (132kB)
|████████████████████████████████| 133kB 1.3MB/s
Installing collected packages: python3-xlib
Running setup.py install for python3-xlib ... done
Successfully installed python3-xlib-0.15
GeorgeGentlys-Mac-mini:~ georgegently$ pip3 install python-xlib
Collecting python-xlib
Downloading https://files.pythonhosted.org/packages/f7/91/9f794491d1a8b810a9d4bb8fc9766a98354cb62bd6990685032b00f87001/python_xlib-0.25-py2.py3-none-any.whl (165kB)
|████████████████████████████████| 174kB 1.3MB/s
Collecting six>=1.10.0 (from python-xlib)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six, python-xlib
Successfully installed python-xlib-0.25 six-1.12.0```

Categories