pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.47k stars 3.01k forks source link

Problem installing several packages behind a proxy (Python 3) #3478

Closed ispmarin closed 8 years ago

ispmarin commented 8 years ago

Working on a machine behind a authenticating proxy, I created a virtualenv with Python 3 on a Ubuntu 14.04 installation without problems. Then I tried to install several packages with

pip install pandas jupyter matplotlib folium plotly

and got the error:

Collecting pandas
  Using cached pandas-0.17.1.tar.gz
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/numpy/: hostname 'proxy.company.com' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org' -- Some packages may not be found!
    Couldn't find index page for 'numpy' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: hostname 'proxy.company.com' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org' -- Some packages may not be found!
    No local packages or download links found for numpy>=1.7.0
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-n0mfyg4f/pandas/setup.py", line 589, in <module>
        **setuptools_kwargs)
      File "/usr/lib/python3.4/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/setuptools/dist.py", line 264, in fetch_build_eggsisp
        replace_conflicting=True
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/pkg_resources.py", line 580, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/pkg_resources.py", line 818, in best_match
        return self.obtain(req, installer) # try and download/install
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/pkg_resources.py", line 830, in obtain
        return installer(requirement)
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/setuptools/dist.py", line 314, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 587, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('numpy>=1.7.0')

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-n0mfyg4f/pandas

so if failed. I tried then

pip install numpy

and it worked without problems. After that, issuing the first pip command again, everything worked.

Pip works wihtout problems with python 2 on the same system and with exactly the same environment variables for proxy (http_proxy, etc).

xavfernandez commented 8 years ago

It's because you were installing a package with setup_requires (https://github.com/pydata/pandas/blob/91ee418/setup.py#L47). For such package, setuptools uses easy_install (File "/home/user/.virtualenvs/maps/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 587, in easy_install in your stacktrace), to fetch the needed dependency. So the issue would need to be raised on setuptools tracker.

xavfernandez commented 8 years ago

Note that once numpy is installed, the setup_requires is available and easy_install is not needed anymore so everything works fine.

ispmarin commented 8 years ago

Got it. pip is version 8.0.2, Python 3.4.3, setuptools is 20. When I install pandas it works. Can I help with anything else?

dstufft commented 8 years ago

There's no much we can do here. We don't have control over setup_requires until future work in the PEP space is finished to add a standard for build time dependencies that pip can read and install.