0

I'm trying to follow this guide. I made virtualenv and installed flask in it:

Requirement already satisfied (use --upgrade to upgrade): Flask in     /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in   /usr/local/lib/python2.7/dist-packages (from Flask)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from Flask)

After pip freeze > requirements.txt the file contains only:

argparse==1.2.1
distribute==0.6.28
wsgiref==0.1.2

And there is no Flask package. I'm trying to run simple example and got:

ImportError: No module named flask

How to install the package properly?

mirt
  • 1,453
  • 1
  • 17
  • 35

1 Answers1

2

You need to run pip freeze > reuirements.txt inside your virtualenv. Thus, make sure that your virtualenv was activated correctly. As the Heroku documentation is mostly written from Linux point of view, this may be a little tricky especially on Windows (see a related question):

  • Windows command-prompt activation is done using venv\Scripts\activate.bat
  • If you are using Windows PowerShell, you need to run venv\Scripts\activate.ps1 instead.

Note that you need to activate virtualenv for sudo as well. Example:

sudo bash
source venv/bin/activate
pip install Flask

However one of the points in virtualenv is that you don't need sudo. Thus, you could simply omit using sudo and simply just run:

source venv/bin/activate
pip install Flask
Community
  • 1
  • 1
jsalonen
  • 29,593
  • 15
  • 91
  • 109
  • hm, app is running but requirements.txt after updating still the same – mirt Oct 16 '12 at 11:27
  • Can you find Flask directory under your virtualenv? I mean do you have `flask` folder under `venv/lib/site-packages`? – jsalonen Oct 16 '12 at 16:32
  • in venv/lib/python2.7/site-packages i have distribute-0.6.28-py2.7.egg easy-install.pth pip-1.2.1-py2.7.egg setuptools.pth, no flask – mirt Oct 16 '12 at 17:40
  • It means you didn't run `pip install Flask` inside your virtualenv, which is what you need to do! You probably have Flask installed globally under Python's shared site-packages, which is the reason why your app works, but pip freeze doesn't, since it only freezes the dependencies under the virtualenv. – jsalonen Oct 16 '12 at 17:45