2

I'm new to python (and linux) and I'm trying to run the setup.py, however it's not working properly because there's a corporative proxy blocking te request to pypi.

I check this link to properly use the setup.py and also check this and this solutions in stackoverflow but I can't make them work (or I'm wrong in the way I'm applying them).

I'm using:

  • virtualenv
  • virtualenvwrapper
  • python 2.7
  • Ubuntu 14

I already add the http_proxy and https_proxy in .profile and .bashrc.

When I use pip install --proxy the.proxy:port some_module it's working properly (also I know the env variables do something is because before that I can't even get to stackoverflow.com, so I'm assuming they work just fine).

What I have already tried is:

  • Trying to use --proxy on python
  • Look for something similar to --proxy in python
  • Trying to add the proxy configuration described in one of the solutions mentioned earlier in my setup.py (which is add to the description of this problem)
  • Tried and successfully downloaded a couple of modules with pip --proxy (this is my current not-so-good-solution)
  • Messing with the python configuration files in the virtualenv in hope of find some proxy config

My setup.py file looks like this:

from setuptools import setup, find_packages
import requests

with open('development.txt') as file:
    install_requires = file.readlines()

with open('development_test.txt') as file_test:
    test_requires = file_test.readlines()

setup(
    name="my_project",
    version="1.0.0-SNAPSHOT",
    packages=find_packages(),
    install_requires=install_requires,
    test_suite="nose.collector",
    tests_require=test_requires,
)


proxies = {
  "http": "http://proxy.myproxy.com:3333",
  "https": "http://proxy.myproxy.com:3333",
}

# not sure what goes here... tried a few things but nothing happend

requests.get("https://pypi.python.org", proxies=proxies)

I'll try any suggestion, any help appreciated. Thanks

Community
  • 1
  • 1
chomsky
  • 300
  • 3
  • 13

1 Answers1

2

After a deep search about how python works and not being able to find the problem I start looking to how the bash commands work. It turn out you have to export the http_proxy variables with sudo -E.

A rocky mistake.

chomsky
  • 300
  • 3
  • 13