Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

"ImportError: No module named datetime" - Werkzeug running inside a rebuilt virtualenv. #574

ModerationMike opened this Issue Feb 27, 2014 · 4 comments


None yet
4 participants

I have a fresh installed cloud server with Ubuntu 12.04 LTS, python 2.7.3 and virtualenv 1.11.4.

I do the following in my webfoot for nginx:

  • virtualenv venv
  • . venv/bin/activate
  • pip install uwsgi
  • pip install flask

To host a simple Flask app. On a fresh box I have no issue. However if I remove the venv dir with a rm command after deactivate and do the same install I get these errors.

Traceback (most recent call last):
  File "/var/www/onsite/onsite.py", line 1, in <module>
    from flask import Flask
  File "/var/www/onsite/venv/local/lib/python2.7/site-packages/flask/__init__.py", line 17, in <module>
    from werkzeug.exceptions import abort
  File "/var/www/onsite/venv/local/lib/python2.7/site-packages/werkzeug/__init__.py", line 154, in <module>
  File "/var/www/onsite/venv/local/lib/python2.7/site-packages/werkzeug/exceptions.py", line 67, in <module>
    from werkzeug._internal import _get_environ
  File "/var/www/onsite/venv/local/lib/python2.7/site-packages/werkzeug/_internal.py", line 15, in <module>
    from datetime import datetime, date
ImportError: No module named date time

Tried multiple deletes and re-install of the venv. Spinning up a new host fixes the issue until the venv is removed or pip installs are made to it down the line. Whats breaking here?


Ivoz commented Feb 28, 2014

where are you getting venv/local from?


qwcode commented Feb 28, 2014

local is from the "unix_local" distutils scheme that debian systems use


qwcode commented Feb 28, 2014

if possible, diff -r a copy of the VE dir that works vs the one that doesn't so you can spot what files or links are missing or broken. from what you describe, I'm not sure what's going on.

ztane commented Jun 17, 2014

ah run into this myself too, with werkzeug; this was old venv however

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment