Pip shows web socket error and I cannot install any packages - python

I tried installing django but didn't work. Instead it gave me this error...
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions')': /simple/django/
ERROR: Could not find a version that satisfies the requirement django (from versions: none)
ERROR: No matching distribution found for django
I tried to install other packages and modules but none of them could be installed. I reinstalled python and while doing that I lose all my previous packages. I had a project with PyQt5 which I could install successfully two weeks ago but after I reinstalled python my packages, modules, etc. where gone and now pip won't work I don't know why.
I tried changing my network and tried using my phone's hotspot but it didnt solve the problem. I tried giving the version name of the packages but that didn't work either.
My network doesn't have a proxy or is not connected to a vpn. I can download any other stuff but I just cannot download stuff with pip.
Thanks in advance!

Related

How to install PIP on python2.7 with python3 already installed, in Windows

I have already installed both Python 3.9.7 and Python 2.7 in my Windows. I need to install some libraries like scipy to run an old project, which is written in Python2.
It's a kinda big project so I prefer not to edit the syntax and make it compatible with Python3.
I have to install pip on my python2 for installing the required libraries. I tried to use the instructions mentioned here.
But I get this error:
c:\users\amerali\appdata\local\temp\tmponnk1_\pip.zip\pip\_vendor\urllib3\util\ssl_.py:164:
InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail.
You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/pip/
Which occurs 5-6times, then it gives the following error :
ERROR: Could not find a version that satisfies the requirement pip<21.0 (from versions: none)
ERROR: No matching distribution found for pip<21.0
I tried it with another internet connections as well, but didn't fix it.
Is there any solutions or an alternative way to install pip?

Error while trying to install 'pymongo' libary

I tried to run my code on Linux ad get this error:
ModuleNotFoundError: No module named 'pymongo'
then I install with these commands :
$ pip install pymongo
$ pip install pymongo==2.1.1
$ pip install --upgrade pymongo
and still get an error :
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pymongo/
I've tried to search this error - specific on 'pynomgo' and couldn't find anything.
I'd be happy if anyone can help me here.
thank you in advance.
Please do check your internet connection.
Because the error says read timed out which meant there is a problem in internet connectivity.
If you still can't resolve the problem Please tell which OS you are using.
Because in linux based OS pymongo will be pre-installed.

Which repositories are pip packages installed from?

I need to download a package using pip. I ran pip install <package> but got the following error:
[user#server ~]$ pip install sistr_cmd
Collecting sistr_cmd
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0cd90>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c290>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c510>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0cf10>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c190>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Could not find a version that satisfies the requirement sistr_cmd (from versions: )
No matching distribution found for sistr_cmd
I verified that the source of the problem is the network blocking most sites because I am working behind a proxy (required by the organization). To allow these downloads, I need to compile the list of urls of the source of the downloads and send it to the network admins to unblock.
According to pip documentation (cited and explained in brief in the pip Wikipedia article), “Many packages can be found in the default source for packages and their dependencies — Python Package Index (PyPI)," so I went to the PyPI page for Biopython and found the github repository and the required dependencies for the package. There are also download links on the PyPI page and I want to be sure that all sources for the download are allowed. So does pip install from the original source of a package (the github repository or wherever the original package is hosted), the packages listed in the PyPI page under downloads, or does it search through both?
Thank you in advance for the help.
It appears a network connection, later you may try below:
pip install sistr-cmd
See the difference between - and _ for more info check here
According to user abarnert:
"If you run pip with the --verbose flag, it will show you all the links it considers. Generally speaking, it goes to https://pypi.org/simple/{PACKAGE} first. That page will have links to downloads for wheels and source for all versions that the maintainer has uploaded, and it will look for the appropriate version's wheel by trying its links in order. Usually there is no github repo listed as a source.
If you want to install everything from github (or any other location) that you know, the simplest thing to do is to manually give the repo to pip instead of just the package names. Ideally, install everything you care about that way on a machine that isn't firewalled from most of the internet, build a requirements.txt file (as explained here), then copy that requirements file to your firewalled machine and try to install it."
Running pip install with the --verbose flag shows extensive detail about where the package is being pulled from and about the network connection and traceback.

Can't install anything with Conda

I keep getting the following error when I try to install or update modules with Conda. Any help?
I install using the following commands (basically any installation or upgrade command):
conda install tensorflow
conda install numpy
And this is the error message:
Fetching package metadata ... CondaHTTPError: HTTP 000 CONNECTION
FAILED for url
Elapsed: -
An HTTP error occurred when trying to retrieve this URL. HTTP errors
are often intermittent, and a simple retry will get you on your way.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='pypi.python.org',
port= 443): Max retries exceeded with url:
/simple/win-64/repodata.json (Caused by New
ConnectionError(': Failed to establish a new connection: [Errno
11004] getaddrinfo fail ed',))",),)
Also pip is not able to install any modules either. It keeps saying:
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection : [Errno 11004] getaddrinfo failed',)': /simple/tensorflow/
My guess is you installed Anaconda on a work computer behind a firewall. I had the same issues after installing it on my work laptop too, but no problems at all with the installation on my personal laptop at home. Please see this answer for setting up a .condarc config file in your home directory which is typically c:\users[your user id].
The answer addresses both config entries for proxy servers and ssl verification.
https://stackoverflow.com/a/54621792/5745815

Installing a Python pip package on Windows 10, through a proxy

I'm trying to install a Python pip package on Windows 10. Unfortunately, the proxy at my work is giving me trouble.
Things I've tried:
python -m pip install --proxy "http://sam.s1:1234#proxy.det.nsw.edu.au:8080"
python -m pip install --proxy http://sam.s1:1234#proxy.det.nsw.edu.au:8080
& 2. with the protocol changed to https
& 2. omitting the protocol, eg: python -m pip install --proxy sam.s1:1234#proxy.det.nsw.edu.au:8080
set HTTP_PROXY=sam.s1:1234#proxy.det.nsw.edu.au:8080 set HTTPS_PROXY=%HTTP_PROXY% set FTP_PROXY=%HTTP_PROXY%
Editing the proxy address for the HTTP_PROXY env variable in the same way described in steps 1 to 4.
Creating a pip.ini file at %APP_DATA%/pip/ with the following contents:
[global]
proxy = "http://sam.s1:1234#proxy.det.nsw.edu.au:8080"
trusted-host = pypi.python.org
Editing the proxy address in the pip.ini file in the same way described in steps 1 to 4.
They all give me similar errors such as:
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002A6F091B080>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))': /simple/django/
and
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002142813B128>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
and
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/django/
Although sorting out once and for all how to download packages though the proxy would be nice, I'll settle for instructions on any methods that circumvent the proxy entirely, like downloading the package and compiling from source (I usually use Ubuntu, so I have no idea how to do this type of thing on Windows).
Other information:
The proxy is configured via a pac script
The package I'm currently trying to install is Django, but there will probably be others in the future.
I installed pip when I installed Python 3.6.3 (via the checkbox that says something like, do you also want to install pip as well as Python).
I know that pip is grabbing the settings from the .ini file, since I can change the output of $ pip list by setting a value for [list].
I have no idea about the proxy thing, but you can download Python packages from the Python Package Index (PyPI) and install them with pip. There's no need to compile from source in most cases, and definitely not with Django.
You can download Django here and then install it with pip install <path to downloaded package>.

Categories