How to install websocket 8.1 via pip - python

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.

Related

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.

Why can I install pytorch with pip but not with pipenv

I am a relative pipenv newbie, and I am trying to install pytorch with cuda 11 for a machine learning project.
I am installing pytorch on linux with python 3.6. I have made a fresh pipenv environment with pipenv install.
To install the latest version of pytorch with cuda 11, the command is:
pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
When I run this command, it works fine and installs:
$ pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.7.0+cu110
Using cached https://download.pytorch.org/whl/cu110/torch-1.7.0%2Bcu110-cp36-cp36m-linux_x86_64.whl (1137.1 MB)
Collecting torchvision==0.8.1+cu110
Using cached https://download.pytorch.org/whl/cu110/torchvision-0.8.1%2Bcu110-cp36-cp36m-linux_x86_64.whl (12.9 MB)
Collecting torchaudio===0.7.0
Using cached torchaudio-0.7.0-cp36-cp36m-manylinux1_x86_64.whl (7.6 MB)
Collecting dataclasses
Using cached dataclasses-0.8-py3-none-any.whl (19 kB)
Collecting numpy
Using cached numpy-1.19.4-cp36-cp36m-manylinux2010_x86_64.whl (14.5 MB)
Processing /home/denisonc/.cache/pip/wheels/6e/9c/ed/4499c9865ac1002697793e0ae05ba6be33553d098f3347fb94/future-0.18.2-py3-none-any.whl
Collecting typing-extensions
Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting pillow>=4.1.1
Using cached Pillow-8.0.1-cp36-cp36m-manylinux1_x86_64.whl (2.2 MB)
Installing collected packages: dataclasses, numpy, future, typing-extensions, torch, pillow, torchvision, torchaudio
Successfully installed dataclasses-0.8 future-0.18.2 numpy-1.19.4 pillow-8.0.1 torch-1.7.0+cu110 torchaudio-0.7.0 torchvision-0.8.1+cu110 typing-extensions-3.7.4.3
(deep-sinter) [denisonc#cvgpu02 deep-sinter]$ pipenv update
Running $ pipenv lock then $ pipenv sync.
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Updated Pipfile.lock (ca72e7)!
Installing dependencies from Pipfile.lock (ca72e7)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
All dependencies are now up-to-date!
However, changing 'pip' to 'pipenv' causes the following error:
$ pipenv install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Installing torch==1.7.0+cu110...
Error: An error occurred while installing torch==1.7.0+cu110!
Error text:
ERROR: Could not find a version that satisfies the requirement torch==1.7.0+cu110 (from -r /tmp/pipenv-tvts06b7-requirements/pipenv-0wd75ill-requirement.txt (line 1)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.3.1, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0)
ERROR: No matching distribution found for torch==1.7.0+cu110 (from -r /tmp/pipenv-tvts06b7-requirements/pipenv-0wd75ill-requirement.txt (line 1))
✘ Installation Failed
Last week I was able to complete this installation on the same system in a different pipenv. In the mean time I upgraded pipenv to the latest version. This error occurred after the upgade.
This is very confusing to me because my understanding was that pipenv uses pip under the hood. I can't understand why the behavior would be different. I would like to install pytorch within my pip environment so that I can keep libraries isolated from other projects.

Unable to Install tensorflow-text on Raspbian

I need to install tensorflow-text on a Raspbian machine and I'm facing some issues.
Python version: 3.7.3
Tensorflow version: 2.2 (installed from source)
Pip version: 20.2.4
When I try to install from pip, I get:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement tensorflow-text (from versions: none)
ERROR: No matching distribution found for tensorflow-text
So I then tried to install the package manualy downloading it's files, but it's wheels are all x86_64 and Raspbian is running in a 32bit machine so I'm not sure what can I do to install this package, I've seen many people tring this by their own but I couldn't find any valid solution, any ideas?

Downgrading Python Setuptools

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

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