using-docker / creating-a-simple-web-app

Code for the "Creating a Simple Web App" chapter of Using Docker
Apache License 2.0
61 stars 60 forks source link

ImportError: No module named 'requests' #2

Open manishlamichhane opened 7 years ago

manishlamichhane commented 7 years ago

In the section "Taking Advantage of existing images" (Page 88), the build stops in 3rd layer with the error message:

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7efbf75dfb00>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/flask

P.S. It turns out to be the issue of how docker handles pip install command. And solution is to edit docker config with appropriate DNS. But my version of docker already has the DNS configured. But still it is not working.

P.P.S Turns out it has something to do with the country I am in. I used a vpn bypass and now its working :).

jacksontong commented 7 years ago

I have the same import error for requests, but not sure what is my problem

dnmonster_1 | dnmonster_1 | > dnmonster@0.1.0 start /usr/src/app dnmonster_1 | > node server.js dnmonster_1 | dnmonster_1 | dnmonster listening at http://:::8080 identidock_1 | Traceback (most recent call last): identidock_1 | File "identidock.py", line 2, in identidock_1 | import requests identidock_1 | ImportError: No module named 'requests'

if I run from the command line I don't have this error

docker run -d --name dnmonster amouat/dnmonster:1.0
docker run -d -p 5000:5000 -e "ENV=DEV" --link dnmonster:dnmonster identidock

my docker version

Client:
 Version:      17.03.0-ce
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:40:59 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   3a232c8
 Built:        Tue Feb 28 07:52:04 2017
 OS/Arch:      linux/amd64
 Experimental: true
lgmg commented 7 years ago

I have the same problem. I could solve this problem by rebuilding the service identidock docker-compose build identidock docker-compose up -d