APIs icon indicating copy to clipboard operation
APIs copied to clipboard

File "api_server.py", line 2, in <module> from flask import Flask ImportError: No module named flask

Open FasihZafar opened this issue 7 years ago • 2 comments

FasihZafar avatar Jan 07 '19 16:01 FasihZafar

You need to install the flask module. In your command line (CMD) use the command:

"pip install flask"

zomry1 avatar Jan 13 '20 19:01 zomry1

I am encountering the same issue, and haven't figured out how to get the api_server.py file to run.

I followed the steps here to set up the virtual machine. Then, as instructed in Lesson 2: Accessing Public APIs - Part 5: Sending API Requests, I tried to run the server, and I get the output below:

vagrant@vagrant:/vagrant$ python api_server.py Traceback (most recent call last): File "api_server.py", line 2, in from flask import Flask ImportError: No module named flask

When I try to install flask as suggested I get a further error.

vagrant@vagrant:/vagrant$ pip install flask Traceback (most recent call last): File "/usr/local/bin/pip", line 7, in from pip._internal.cli.main import main File "/usr/local/lib/python2.7/dist-packages/pip/init.py", line 1, in from typing import List, Optional

ImportError: No module named typing

I have tried various approaches such as this one from stack overflow to allow pip to install flask without success. Can someone help me determine what is going run, such that the VM doesn't work per instructions?

camkinney avatar Jul 07 '21 20:07 camkinney