0

I have installed anaconda on my machine with python 3.7, pip version 19.0.3

I am trying pip install from Windows command line. I am getting the error for all package installations tried through pip. It would be great if some one can help me out.

Command given: pip install lifetimes

Eror message:

Collecting lifetimes
Could not install packages due to an EnvironmentError: Please check proxy URL. It is malformed and could be missing the host.
Amir Shabani
  • 3,857
  • 6
  • 30
  • 67
JJchry
  • 25
  • 1
  • 6
  • Are you looking for help with setting pip to use a proxy or are you having trouble with a proxy setup you already tried to configure? – Cohan Apr 10 '19 at 13:15
  • https://github.com/conda/conda/issues/7969 – phd Apr 10 '19 at 18:08
  • Thanks for helping me.Tried the commands set http_proxy=http://[username:password@]proxyserver:port set http_proxy=https://[username:password@]proxyserver:port and it worked perfectly fine – JJchry Apr 11 '19 at 05:47

1 Answers1

1

To use pip behind a proxy, you can specify the proxy with the --proxy option.

pip install --proxy=https://user:pass@server:port packages

If you're going to do several pip installs in a given session, you can set your proxy variables in the terminal or command prompt. The lines below are taken from here. If you have the ability to define the environmental varibles, do that once and you should be good to go.

# Windows
set http_proxy=http://[username:password@]proxyserver:port
set http_proxy=https://[username:password@]proxyserver:port

# Linux
export https_proxy=https://[username:password@]proxyserver:port

At work, we still had some issues because some domains were not trusted, so you can add the following lines to tell pip that the following domains are okay.

--trusted-host pypi.python.org 
--trusted-host files.pythonhosted.org 
--trusted-host pypi.org

If you want to set up Anaconda to use the proxy without having to specify the proxy each time, you need to create a .condarc file in your home directory. Add the following lines to the .condarc file and you should be good to go. More information can be found here.

proxy_servers:
    http: http://user:pass@server:port
    https: https://user:pass@server:port
Cohan
  • 4,384
  • 2
  • 22
  • 40
  • Many Thanks for helping me I have tried commands set http_proxy=http://[username:password@]proxyserver:port set http_proxy=https://[username:password@]proxyserver:port and this worked perfectly fine.This issue was happening due to proxy. – JJchry Apr 11 '19 at 05:44