0

I am writing a flask app in VisualStudio. The first lines of my __init__.py file for the application are:

import os
from flask import Flask
from config import Config
from flask_sqlalchemy import SQLAlchemy

When I launch the application it opens in my webbrowser (locally) without any fuss. However, if I open an interpreter and write:

from app import app

it fails as it says that there is no module called flask_sqlalchemy. I am using a virtual env and I can see that Flask-SQLAlchemy is installed. When I do pip install it says that the requirement is already satisfied.

Any ideas?

SuperShoot
  • 9,880
  • 2
  • 38
  • 55
Woody Pride
  • 13,539
  • 9
  • 48
  • 62
  • Are you switching to the venv in the command line before running the command? – justcode May 07 '19 at 18:31
  • I am opening the command line at the venv...Moreover, in the command line if I run `pip list` then Flask-SQLAlchemy is there – Woody Pride May 07 '19 at 18:33
  • try to use the full python path of this specific venv, and post results. – justcode May 07 '19 at 18:55
  • How would I do that? – Woody Pride May 07 '19 at 19:11
  • When you are in the interpreter [check that it is the interpreter from your virtual env](https://stackoverflow.com/a/2589722/6560549). – SuperShoot May 08 '19 at 02:00
  • You are right on the money, it is not my virtual env. This is odd. When I run the app from visual studio it evidently runs from the virtualenv, but when I open the command prompt it does not. This is weird as I installed the packages into the virtualenv, in the command prompt. I guess i need to change it back – Woody Pride May 08 '19 at 14:00

1 Answers1

0

Try install within pipenv with:

pipenv shell 
pipenv install package_name
Angelo Mendes
  • 905
  • 13
  • 24