Score:0

Ignore HTTP_PROXY env variable in conda install

vn flag

I'm trying to configure my local conda client to use a nexus channel, and use it only. The workspace I'm using has the HTTP_Proxy and HTTPS_PROXY environment variables set (And I need them to stay set...)

Every time I try to install anything (with or without adding the --override-channels) flag, this is the stack trace I'm getting:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/opt/conda/lib/python3.9/http/client.py", line 1257, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 91, in _send_request
    rval = super(AWSConnection, self)._send_request(
  File "/opt/conda/lib/python3.9/http/client.py", line 1303, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/http/client.py", line 1252, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 119, in _send_output
    self.send(msg)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 203, in send
    return super(AWSConnection, self).send(str)
  File "/opt/conda/lib/python3.9/http/client.py", line 952, in send
    self.connect()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPConnection object at 0x7f7c455ebd30>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/botocore/httpsession.py", line 254, in send
    urllib_response = conn.urlopen(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/util/retry.py", line 386, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/opt/conda/lib/python3.9/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/opt/conda/lib/python3.9/http/client.py", line 1257, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 91, in _send_request
    rval = super(AWSConnection, self)._send_request(
  File "/opt/conda/lib/python3.9/http/client.py", line 1303, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/http/client.py", line 1252, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 119, in _send_output
    self.send(msg)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 203, in send
    return super(AWSConnection, self).send(str)
  File "/opt/conda/lib/python3.9/http/client.py", line 952, in send
    self.connect()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.ProxyError: ('Cannot connect to proxy.', NewConnectionError('<botocore.awsrequest.AWSHTTPConnection object at 0x7f7c455ebd30>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1079, in __call__
    return func(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/conda/cli/main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "/opt/conda/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 81, in do_call
    module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
  File "/opt/conda/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/conda/lib/python3.9/site-packages/conda/cli/main_install.py", line 8, in <module>
    from .install import install
  File "/opt/conda/lib/python3.9/site-packages/conda/cli/install.py", line 19, in <module>
    from ..core.index import calculate_channel_urls, get_index
  File "/opt/conda/lib/python3.9/site-packages/conda/core/index.py", line 13, in <module>
    from .package_cache_data import PackageCacheData
  File "/opt/conda/lib/python3.9/site-packages/conda/core/package_cache_data.py", line 14, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "/opt/conda/lib/python3.9/site-packages/conda/core/path_actions.py", line 30, in <module>
    from ..gateways.connection.download import download
  File "/opt/conda/lib/python3.9/site-packages/conda/gateways/connection/download.py", line 14, in <module>
    from .session import CondaSession
  File "/opt/conda/lib/python3.9/site-packages/conda/gateways/connection/session.py", line 13, in <module>
    from .adapters.s3 import S3Adapter
  File "/opt/conda/lib/python3.9/site-packages/conda/gateways/connection/adapters/s3.py", line 14, in <module>
    boto3.client('s3')  # https://github.com/conda/conda/issues/8993
  File "/opt/conda/lib/python3.9/site-packages/boto3/__init__.py", line 93, in client
    return _get_default_session().client(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/boto3/session.py", line 258, in client
    return self._session.create_client(
  File "/opt/conda/lib/python3.9/site-packages/botocore/session.py", line 826, in create_client
    credentials = self.get_credentials()
  File "/opt/conda/lib/python3.9/site-packages/botocore/session.py", line 430, in get_credentials
    self._credentials = self._components.get_component(
  File "/opt/conda/lib/python3.9/site-packages/botocore/credentials.py", line 1969, in load_credentials
    creds = provider.load()
  File "/opt/conda/lib/python3.9/site-packages/botocore/credentials.py", line 1022, in load
    metadata = fetcher.retrieve_iam_role_credentials()
  File "/opt/conda/lib/python3.9/site-packages/botocore/utils.py", line 474, in retrieve_iam_role_credentials
    token = self._fetch_metadata_token()
  File "/opt/conda/lib/python3.9/site-packages/botocore/utils.py", line 368, in _fetch_metadata_token
    response = self._session.send(request.prepare())
  File "/opt/conda/lib/python3.9/site-packages/botocore/httpsession.py", line 285, in send
    raise ProxyConnectionError(proxy_url=proxy_url, error=e)
botocore.exceptions.ProxyConnectionError: Failed to connect to proxy URL: <HTTP_PROXY_URL>"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/opt/conda/lib/python3.9/http/client.py", line 1257, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 91, in _send_request
    rval = super(AWSConnection, self)._send_request(
  File "/opt/conda/lib/python3.9/http/client.py", line 1303, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/http/client.py", line 1252, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 119, in _send_output
    self.send(msg)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 203, in send
    return super(AWSConnection, self).send(str)
  File "/opt/conda/lib/python3.9/http/client.py", line 952, in send
    self.connect()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPConnection object at 0x7f7c455b8940>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/botocore/httpsession.py", line 254, in send
    urllib_response = conn.urlopen(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/util/retry.py", line 386, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/opt/conda/lib/python3.9/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/opt/conda/lib/python3.9/http/client.py", line 1257, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 91, in _send_request
    rval = super(AWSConnection, self)._send_request(
  File "/opt/conda/lib/python3.9/http/client.py", line 1303, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/http/client.py", line 1252, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 119, in _send_output
    self.send(msg)
  File "/opt/conda/lib/python3.9/site-packages/botocore/awsrequest.py", line 203, in send
    return super(AWSConnection, self).send(str)
  File "/opt/conda/lib/python3.9/http/client.py", line 952, in send
    self.connect()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.ProxyError: ('Cannot connect to proxy.', NewConnectionError('<botocore.awsrequest.AWSHTTPConnection object at 0x7f7c455b8940>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/bin/conda", line 13, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/conda/cli/main.py", line 152, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1371, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1082, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1126, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1137, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1207, in print_unexpected_error_report
    from .cli.main_info import get_env_vars_str, get_main_info_str
  File "/opt/conda/lib/python3.9/site-packages/conda/cli/main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "/opt/conda/lib/python3.9/site-packages/conda/core/index.py", line 13, in <module>
    from .package_cache_data import PackageCacheData
  File "/opt/conda/lib/python3.9/site-packages/conda/core/package_cache_data.py", line 14, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "/opt/conda/lib/python3.9/site-packages/conda/core/path_actions.py", line 30, in <module>
    from ..gateways.connection.download import download
  File "/opt/conda/lib/python3.9/site-packages/conda/gateways/connection/download.py", line 14, in <module>
    from .session import CondaSession
  File "/opt/conda/lib/python3.9/site-packages/conda/gateways/connection/session.py", line 13, in <module>
    from .adapters.s3 import S3Adapter
  File "/opt/conda/lib/python3.9/site-packages/conda/gateways/connection/adapters/s3.py", line 14, in <module>
    boto3.client('s3')  # https://github.com/conda/conda/issues/8993
  File "/opt/conda/lib/python3.9/site-packages/boto3/__init__.py", line 93, in client
    return _get_default_session().client(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/boto3/session.py", line 258, in client
    return self._session.create_client(
  File "/opt/conda/lib/python3.9/site-packages/botocore/session.py", line 826, in create_client
    credentials = self.get_credentials()
  File "/opt/conda/lib/python3.9/site-packages/botocore/session.py", line 430, in get_credentials
    self._credentials = self._components.get_component(
  File "/opt/conda/lib/python3.9/site-packages/botocore/credentials.py", line 1969, in load_credentials
    creds = provider.load()
  File "/opt/conda/lib/python3.9/site-packages/botocore/credentials.py", line 1022, in load
    metadata = fetcher.retrieve_iam_role_credentials()
  File "/opt/conda/lib/python3.9/site-packages/botocore/utils.py", line 474, in retrieve_iam_role_credentials
    token = self._fetch_metadata_token()
  File "/opt/conda/lib/python3.9/site-packages/botocore/utils.py", line 368, in _fetch_metadata_token
    response = self._session.send(request.prepare())
  File "/opt/conda/lib/python3.9/site-packages/botocore/httpsession.py", line 285, in send
    raise ProxyConnectionError(proxy_url=proxy_url, error=e)
botocore.exceptions.ProxyConnectionError: Failed to connect to proxy URL: "<HTTP_PROXY_URL>"

From what I can understand, it's happening because I have the environment variables set. According to the documentation, the environment variables are the most precedented configuration option possible.

Is there any way of "overriding" these variables from conda's perspective?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.