Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip not installing modules

Tags:

python

pip

numpy

As per object. I'm running Python 2.7.10 under Windows 7 64 bit. I added C:\Python27\Scripts to my PATH, and I can run pip, but it's not able to install modules. For example

pip install numpy

gives

Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after
connection broken by 'ProtocolError('Connection aborted.', gaierror(11004,'getaddrinfo failed'))': /simple/numpy/

It keeps retrying and failing for a while, and then it exits with

Could not find a version that satisfies the requirement numpy (from versions:
)
No matching distribution found for numpy

Probably I'm behind a firewall, but I'm quite disappointed because I can install packages under R perfectly fine with install.packages, and I don't see why I can't do the same with Python. If I install packages manually (in the case of NumPy, from here

NumPy

what do I miss, with respect to using pip?

As per suggestions in the comments, I downloaded the .whl file for NumPy from NumPy. I navigated to the downloads dir and executed

pip install numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

I only got

numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl is not a supported wheel on this platform.

What should I do?

like image 456
DeltaIV Avatar asked Nov 30 '15 10:11

DeltaIV


People also ask

Why does my pip install not working?

This error usually means there's a problem with the Python installation or the system variable PATH is not set up correctly. Try reinstalling Python and all its components to fix the problem. The easiest way is via the Python executable installer.

How do I fix pip module not found?

The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, install the module by running the python -m ensurepip --upgrade command on Linux or MacOS or py -m ensurepip --upgrade on Windows.

Why can't I import modules in Python?

This is caused by the fact that the version of Python you're running your script with is not configured to search for modules where you've installed them. This happens when you use the wrong installation of pip to install packages.


2 Answers

A proxy shall be used. For example:

python.exe -m pip install numpy --proxy="proxy.com:8080"

where "proxy.com:8080" is the proxy server address and port. This can be found in OS settings.

How to get them:

  1. Windows: What Is a Proxy or Proxy Server
  2. Linux How can I find out the proxy address I am behind?
  3. Mac OS X: How can I get Mac OS X's proxy information in a Bash script?
like image 128
Seweryn Habdank-Wojewódzki Avatar answered Oct 26 '22 14:10

Seweryn Habdank-Wojewódzki


To bypass the firewall, you can use a proxy

pip install numpy --proxy <domain\user:password@proxyaddress:port>

For example,

pip install numpy --proxy http://<username>:<password>@proxy.xyz.com:2180
like image 41
Tad Avatar answered Oct 26 '22 15:10

Tad