How I can fix NewConnectionError in my pip installer? - installation

I have a problem with my pip: any package I want to install returns an error message:
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
Defaulting to user installation because normal site-packages is not writeable
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcfa2776760>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
It isn't problem with my Internet or VPN or DNS, I have checked it.
Before a problem I have tried to install pgadmin and used those commands:
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo
apt-key add sudo sh -c 'echo "deb
https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs)
pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo /usr/pgadmin4/bin/setup-web.sh sudo ufw allow 'Apache' sudo ufw
enable
And now I can't install anymore else :( Can somebody help me to fix it?

Related

Issue in pip install command

Please help me in fixing the below command
pip install GitPython
Error:
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifoedHTTPSConnection object at 0x00000>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',) ': /simple/gitpython
Could not find a version that satisfies the requirement GitPython (from versions :)
No matching distribution found for GitPython

pip install inside the conda environment

I have the following setup inside the condarc file:
ssl_verify: true
use_pip: True
add_pip_as_python_dependency: True
channels:
- conda-forge
- defaults
proxy_servers:
http: proxyserver
https: proxyserver
I am using Anaconda behind the company proxy that those details about the proxy servers are mentioned under the http: and https: fields.
Once I activate the environment and issue the following command :
pip install -r requirements.txt
I am getting the following error:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after
connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at
0x000002A615C950D0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/jinja2/
It seems to be an SSL error to me. I fixed it by bypassing as shown below:
pip install -r requirements.txt —trusted-host pypi.org —trusted-host files.pythonhosted.org
If you are in a corporate network it may occur due to firewall blockage. Try the above solution.

Docker-compose, pip install -r requirements.txt' returned a non-zero code: 1

I am kind of new with docker-compose. Terminal displays this message when building container. Not sure where the problem is.
(base) MacBook-Pro-de-Carlos-Arau:webscrap carlosarau$ docker-compose up
Building web
Step 1/5 : FROM python:2.7
---> 68e7be49c28c
Step 2/5 : WORKDIR /usr/src/app
---> Using cache
---> be06bd573b0f
Step 3/5 : ADD requirements.txt /usr/src/app
---> Using cache
---> eb33847b4acb
Step 4/5 : RUN pip install -r requirements.txt
---> Running in e16754e4db86
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting Flask==1.1.1
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),)': /packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),)': /packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),)': /packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),)': /packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),)': /packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),))
WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Here you can find my Dockerfile and docker-compose yml
Dockerfile:
FROM python:2.7
WORKDIR /usr/src/app
ADD requirements.txt /usr/src/app
RUN pip install -r requirements.txt
ADD . /usr/src/app
docker-compose.yml:
version: '2'
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: 'xxx'
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/usr/src/app
depends_on:
- db
Running on Mac OS Yosemite with python 2.7 (unable to upgrade to 3.6)
Thanks for you help
I see that you use python2.7.
It is unsupported since january 2020. It is possible your problem comes from here.
Your build environment does not recognize the SSL certificate of https://files.pythonhosted.org as valid.
If the root certificate of files.pythonhosted.org was added in a more recent python version, that may explain it.
I strongly advise to find a way to update your python to python3 before anything else.

PIP not working - proxy

python pip is not working behind proxy
I tried
sudo -H pip --proxy https://proxy_ip:proxy_port install <package>
sudo -H pip --proxy https://usename:password#proxy_ip:proxy_port install <package>
sudo easy_install pip
and nothing is working, I also tried setting environment variables HTTP_PROXY but it isn't working.
For instance, here is the error when trying to install toolz:
Collecting toolz
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
Could not find a version that satisfies the requirement toolz (from versions: )
No matching distribution found for toolz
I use pip install behind a proxy frequently. Here's the syntax that's working for me:
sudo pip --proxy username:password#ip_address:port install <package_name>
The problem was within a conf file that loads old proxy settings. Also the environment variables are case sensitive. So check if there is a difference between HTTP_PROXY and http_proxy by using printenv in linux
Then as #MedAli suggested: adding --proxy while using pip will work

ConnectTimeoutError installing Tensorflow on windows

I'm triying to install Tensorflow, and I get the following:
C:\>pip3 install --upgrade tensorflow
Collecting tensorflow
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by
ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000240DAD78BA8>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/tensorflow/
I've also tried to install it downloading the .whl on the GitHub repository, and I get the same kind of error:
C:\>pip3 install tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
Processing c:\tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
Collecting bleach==1.5.0 (from tensorflow==1.1.0)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001FEE571BCC0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/bleach/
My PC is connected to my university's network which need a HTTP proxy configuration. Could it be the problem? How could I fix it?
So pip work abruptly behind proxy for that you can refer Using pip behind a proxy
But for your alternate you can download Tensorflow wheel from (Python 2 CPU)
For other Python Version or CPU/GPU
https://github.com/tensorflow/tensorflow#installation

Resources