title: Python virtualenvs stopped working
body: <p>I've Raspberry Pi as my web server and everything worked fine for last 8 months. </p>
  
  <p>But now, for some reasons, my virtual enviroments stopped working! When I activate some virtual enviroment by <code>source venv/bin/activate</code>. And then when I type e.g. <code>pip list</code> I get:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/var/www/sova/nvenv/bin/pip", line 7, in &lt;module&gt;
      from pip import main
    File "/var/www/sova/nvenv/lib/python3.4/site-packages/pip/__init__.py", line 9, in &lt;module&gt;
      from pip.log import logger
    File "/var/www/sova/nvenv/lib/python3.4/site-packages/pip/log.py", line 8, in &lt;module&gt;
      from pip import backwardcompat
    File "/var/www/sova/nvenv/lib/python3.4/site-packages/pip/backwardcompat/__init__.py", line 5, in &lt;module&gt;
      import imp
    File "/var/www/sova/nvenv/lib/python3.4/imp.py", line 22, in &lt;module&gt;
      from importlib import util
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec
    File "&lt;frozen importlib._bootstrap&gt;", line 1467, in exec_module
    File "&lt;frozen importlib._bootstrap&gt;", line 1570, in get_code
    File "&lt;frozen importlib._bootstrap&gt;", line 656, in _compile_bytecode
  ValueError: bad marshal data (unknown type code)
  </code></pre>
  
  <p><code>gunicorn</code> is not running also with this output:</p>
  
  <pre><code>Oct 10 14:08:19 smecpi systemd[1]: Started gunicorn sova  daemon.
  Oct 10 14:08:19 smecpi gunicorn_start[20298]: Starting sova_app as nginx
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: Traceback (most recent call last):
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "/var/www/sova/nvenv/bin/gunicorn", line 5, in &lt;module&gt;
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: from pkg_resources import load_entry_point
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "/var/www/sova/nvenv/lib/python3.4/site-packages/pkg_resources.py", line 21, in &lt;module&gt;
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: import imp
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "/var/www/sova/nvenv/lib/python3.4/imp.py", line 22, in &lt;module&gt;
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: from importlib import util
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 1467, in exec_module
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 1570, in get_code
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: File "&lt;frozen importlib._bootstrap&gt;", line 656, in _compile_bytecode
  Oct 10 14:08:20 smecpi gunicorn_start[20298]: ValueError: bad marshal data (unknown type code)
  Oct 10 14:08:20 smecpi systemd[1]: gunicorn_sova.service: main process exited, code=exited, status=1/FAILURE
  Oct 10 14:08:20 smecpi systemd[1]: Unit gunicorn_sova.service entered failed state.
  </code></pre>
  
  <p>furthermore in another separate virtualenv I get similar error (after <code>pip install</code>):</p>
  
  <pre><code>Traceback (most recent call last):
    File "/var/www/myweb/venv/bin/pip", line 7, in &lt;module&gt;
      from pip import main
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec
    File "&lt;frozen importlib._bootstrap&gt;", line 1467, in exec_module
    File "&lt;frozen importlib._bootstrap&gt;", line 1570, in get_code
    File "&lt;frozen importlib._bootstrap&gt;", line 656, in _compile_bytecode
  ValueError: bad marshal data (invalid reference)
  </code></pre>
  
  <p>Any ideas? Thank you</p>