0

I have create an ec2 instance which has default python 2.7 installed. I have installed python 3.5.1 and I can see both directories /usr/bin/python3 and /usr/bin/python . I have created a virtualenv using virtualenv -p python3 .env . But when I execute pip install -r requirements.txt for python3, it displays this error message.

Failed to establish a new connection: [Errno 101] Network is unreachable',)'

How can I fix it?

Also,

if I execute :

sudo python3 -m pip install Flask

I get -

/usr/bin/python3: No module named pip
jason
  • 3,932
  • 11
  • 52
  • 123
  • 1
    Ah! This means that your client can't make an outbound HTTPS connect to the Network ( as it says.. Errors never lie you know! ) This problem is usually caused by a firewall or DNS problem that limits outbound connections. It could also be caused by a router misconfiguration. – d-coder Jan 03 '18 at 08:59
  • How can I fix it? Should I edit/set outbound/inbound rules? – jason Jan 03 '18 at 09:02
  • I've figured it out. Open up all the inbound and outbound ports like 8080,80, etc.. for pip to install – jason Jan 03 '18 at 09:55
  • Yes. That's the right way to do it. – d-coder Jan 03 '18 at 09:56
  • 1
    @d-coder Please post your answer below. I'll accept it. Also, it will help others in the future :) – jason Jan 03 '18 at 09:57
  • 1
    Did you know you can also write an answer to it and accept it ? I really appreciate your thoughts on this one though! – d-coder Jan 03 '18 at 10:02
  • @d-coder Cool!! Thanks – jason Jan 03 '18 at 10:03

1 Answers1

-2

I've figured it out. Open up all the inbound and outbound ports like 8080,80, etc.. for pip to install.

jason
  • 3,932
  • 11
  • 52
  • 123
  • How to do it ? I am new to linux – Spartan Mar 18 '18 at 06:14
  • 2
    Click on ec2 instance on aws and you'll see 4 tabs below. There is inbound and outbound tab under it. Select inbound and add any tcp and access from anywhere in both the tabs. PLease remember to close the ports and ip's after testing before pushing to prod – jason Mar 18 '18 at 06:18
  • Idk why the downvotes for this answer though. [This](https://stackoverflow.com/questions/11585377/python-socket-error-errno-111-connection-refused) other might be insightful for `errno 111` – M.K Jan 16 '23 at 09:13