How to install Python packages over SSH Port Forwarding?

Proxy is going to be tricky. I suggest that you scp the pip module source file and install it locally from source. Use
pip install package —download="/pth/to/downloaded/file” to get the package, scp it to the dest server and use pip install “/pth/to/scp/file”


It's look like my problem. after exploration, I have found a solution. And because in my region, pypi.python.org is slow, so I change my pip.conf and use pypi.douban.com/simple, as my index-url. this website use http protocol. so in my solution. I use 80 port as my target port.

Problem: I have two host. host1 could connect Pypi.douban.com. and host2 couldn't. but I can connect host2 in host1 through ssh.

so in host2, I open a tmux session and open a ssh tunnel by local port forwarding(not remote port forwarding):

ssh -L 9999:pypi.douban.com:80 username@host1

after this redirect, I can use

pip install scikit-learn --proxy localhost:9999

to install package in host2.

Tags:

Python

Ssh

Pip