What ports does pip use?
Asked Answered
R

2

16

This is hopefully a quick one to answer, I'm trying to provision a box on AWS with puppet and one of the steps involves a pip install from a requirements file. Something like this: -

/usr/local/venv/ostcms/bin/pip install -r /vagrant/requirements.txt

The step basically fails because it can't find any of the packages in the requirements file, but when I open the AWS box's security group up to allow "All Traffic" the pip step works.

I'm trying to find the port that pip uses so I can basically have that port, http and ssh open on the box and live happily ever after.

Rachmaninoff answered 13/3, 2014 at 11:27 Comment(0)
S
23

Pip runs on 3128 so make sure you have that open in your AWS console. Otherwise pip will get blocked when attempting to talk to PyPi (or anywhere else it cares to download from).

Samoyed answered 13/3, 2014 at 11:28 Comment(2)
To anyone finding this in 2018, I needed to enable port 443 (HTTPS) to get Pip working on AWS.Atul
I just discovered that since I was running my custom pypi-server on port 8080, I needed to add a netfilter rule like this: "-A INPUT -p tcp --dport 8080 -m state --state NEW -j ACCEPT". I didn't find it necessary to add a specific rule for port 3128. I hope this can help someone else having this problem.Shelashelagh
F
0

In 2024 I don't find pip using 3128 anymore. You may check the process ID for that pip request by ps -aux | grep pip | awk -F ' ' '{ print $2 }'; then look for the state and port in netstat: netstat -anp | grep <the ID>. In my case, "SYN_SENT" and the targeted port was 443. So I guess the acknowledgement had been blocked by the Iptables. Run iptables -A INPUT -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT and iptables -A OUTPUT -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT. Problem solved.

Fuchsia answered 24/4, 2024 at 7:13 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.