4

as written in the title and as you can see in the first image I'm trying to install pandas and I get this error each time and not just pandas but all the libraries , I know this question has been asked but none of the answers that I found helped me . I'm not using a proxy .

C:\Users\yoooo>pip install pandas

C:\Users\yoooo>pip install pandas 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/pandas/ WARNING: Retrying (Retry(total=3, 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/pandas/ WARNING: Retrying (Retry(total=2, 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/pandas/ 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/pandas/ WARNING: Retrying (Retry(total=0, 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/pandas/

ERROR: Could not find a version that satisfies the requirement pandas (from versions: none)

ERROR: No matching distribution found for pandas

error

tried to ping pypi.org and got this

 C:\Users\yoooo>ping pypi.org

Pinging pypi.org [2a04:4e42::223] with 32 bytes of data:

Request timed out.

Request timed out.

Reply from 2a04:4e42::223: time=227ms

Reply from 2a04:4e42::223: time=556ms

Ping statistics for 2a04:4e42::223:

Packets: Sent = 4, Received = 2, Lost = 2 (50% loss), Approximate round trip times in milli-seconds: Minimum = 227ms, Maximum = 556ms, Average = 391ms

ping

pip and python versions (I can't update pip obviously).

C:\Users\yoooo>python --version

Python 3.8.6

C:\Users\yoooo>pip --version

pip 20.2.1

versions

what do you think the problem is ? and if it's caused by my internet provider what should I tell them ? telling them I'm not able to install python libraries will not be understandable . PS:

tried this and and it led to the same error eventually

C:\Users\yoooo>pip --default-timeout=1000 install pandas

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/pandas/ ...

3 Answers3

4

You need to give precedence to IPv4 over IPv6.

To do so, open CMD with administrator permissions and apply the following command:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4
2

Try adding the default timeout flag to pip:

pip --default-timeout=1000 install pandas

If that doesn't work, download the wheel file from here. Then change directory to where you saved it. Then run:

pip install <.whl file name>
DapperDuck
  • 2,728
  • 1
  • 9
  • 21
  • Have you installed any other libraries? – DapperDuck Jan 17 '21 at 12:50
  • yep numpy , pyside 2,venv and more – Mohamed Abomokh Jan 17 '21 at 12:52
  • Pandas is a large library. You might just have a slow internet connection. Try raising the default timeout. – DapperDuck Jan 17 '21 at 12:55
  • I have a speed of ~160Mbs currently and I'm using an ethernet , so I don't think it's a slow connectivity problem . – Mohamed Abomokh Jan 17 '21 at 12:58
  • I'm not sure why this is happening then. I updated my answer to include details about how to install from wheel files. – DapperDuck Jan 17 '21 at 13:07
  • https://stackoverflow.com/questions/52328655/pip-cant-install-any-package the first comment from this helped me , but I'm not sure that it is safe. Yeah I think eventually I'll just manually download wheels or just use a free proxy – Mohamed Abomokh Jan 17 '21 at 13:10
  • Yeah, I wouldn't trust free proxies because there is a chance they can read the data passed through them. I recommend just manually installing the wheel. – DapperDuck Jan 17 '21 at 13:15
  • I tried using my IP instead of the random proxy (e.g. --proxy="my.personal.ip.ipv4:8080" )and It caused the same problem so it looks like my IP is causing the problem , I'll try contacting the internet provider and ask them to change my IP or something like that . if that doesn't work then I'll just have to download them manually . – Mohamed Abomokh Jan 17 '21 at 13:20
1

In my case, ubuntu 20.4, changing it to prefer IPv4 over IPV6, resolved the issue.

I was using strace pip install <some packages>, and noticed that IPv6 is been used (maybe there is a simple way).

this is how I change it to prefer IPv4 over IPV6: edit the file /etc/gai.conf and uncomment the line:

precedence ::ffff:0:0/96  100

restart is not required.

Maoz Zadok
  • 4,871
  • 3
  • 33
  • 43