BrandonJoffe / home_surveillance

Home surveillance system with facial recognition
1.23k stars 385 forks source link

Import Error for WebApp.py #33

Closed Ian1021 closed 7 years ago

Ian1021 commented 7 years ago

When I try to run WebApp.py using the command python WebApp.py it gives me a ImportError.

Traceback (most recent call last):
  File "webapp.py", line 19, in <module>
    from flask import Flask, render_template, Response, redirect, url_for, request, jsonify, send_file, session, g
ImportError: No module named flask

I am installing this using the Docker Instructions.

vahid-dan commented 7 years ago

Hi;

Are you sure you're running the command inside the docker? I guess you may have installed the docker; But you're trying to run the command directly on your machine, not inside the docker.

Cheers, Vahid

Ian1021 commented 7 years ago

How would I know if I am running the command inside the docker? If I'm not running it inside the docker then how do I run it?

vahid-dan commented 7 years ago

Run the docker, first:

docker run -v /Users/:/host -p 9000:9000 -p 8000:8000 -p 5000:5000 -t -i bjoffe/openface_flask_v2  /bin/bash

Method 1: You'll see something like root@4e539b3af017:/# in the command line. If you enter your commands there, it is inside the docker. But if you see your usual YourName@YourMachine on your terminal, you're not inside the docker.

Method 2: Run uname -a. If you are inside the docker, you should get this:

Linux 4e539b3af017 4.9.13-moby #1 SMP Sat Mar 25 02:48:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

If you get anything rather than this, you are not inside the docker (or Brandon has updated the docker which seems unlikely in the near future).

Vahid

Ian1021 commented 7 years ago

The first time I installed the docker I was successful but I closed the window. Now when I repeat that step I get this error.

Bind for 0.0.0.0:9000 failed: port is already allocated.

mathieuduperre commented 7 years ago

your container is probably still running. do a "docker ps -a" and you should see it running, in which case you can re-attach to it. Have a look at this website: https://docs.docker.com/engine/getstarted/.

This issue is not related to the actual software but to the container infra.

vahid-dan commented 7 years ago

Hi @Ian1021;

A simple solution would be logging out and then logging back in. A more complex but better solution would be stopping the docker completely by killing the related open processes and then try again.

Vahid