3

My Flask app environment is using anaconda

When I use IDE like PyCharm, it provides a terminal which already in the specific conda environment, like this:

terminal session showing flask run

It could easily let me to start the app via command flask run

Then my question is, how could I start the app in an original terminal?

I tried to use flask run in the original terminal but the dependency module are not found (All dependencies are placed in the conda environment actually)

merv
  • 67,214
  • 13
  • 180
  • 245
yanqing
  • 31
  • 3
  • Have you created a virtual environment and installed all the necessary packages? – wvdgoot Apr 16 '21 at 07:00
  • Maybe you can use [this](https://stackoverflow.com/questions/48787250/set-up-virtualenv-using-a-requirements-txt-generated-by-conda/55687210#55687210) to setup your project. – wvdgoot Apr 16 '21 at 07:02
  • At the top of your image, there's a line that starts with `(flask_env_3)`. That's the name of the virtual environment your flask app needs to be in to run. You can activate it by running `source flask_env_3/bin/activate` in the terminal (in the root folder of your app), and then `flask run` should work – half of a glazier Apr 16 '21 at 11:23

1 Answers1

0

You can use conda run for this. E.g.,

conda run -n flask_env_3 flask run

You may need to add the flag(s) --live-stream or --no-capture-output (or both), for interactivity.

merv
  • 67,214
  • 13
  • 180
  • 245
  • BTW, if you do need either of those flags, please let us know, or edit it into the answer. – merv Apr 17 '21 at 04:02