Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu 14.04 upgrade broke all my virtualenvs

I've seen a couple of fixes for this, but none have worked for me, but I gather that its my virtualenvs that got broken. I just upgraded to 14.04 from 12.04, and now all my pyramid applications no longer work.

When I run ../bin/pserve development.ini, I get the following error:
ImportError: No module named _ctypes

When I run ../bin/python setup.py develop, (also when I try run pshell) I get:
ImportError: No module named _io

I've fixed one project (each pyramid app is in a separate virtualenv) by first removing the old project folder, then reinstalling the virtualenv instance and then copying my scripts back into it. But this is time consuming, and I have several projects.

Is there a quick fix for this?
I've seen removing duplicates of python and simple reinstall of virtualenv, but removing duplicates is not a good option, and the second solution didn't work for me. But maybe I did something wrong there.

I really think that there should be a quick fix for this. Surely reinstalling all virtualenvs cannot be the only solution?

like image 746
Roman Avatar asked Aug 22 '14 08:08

Roman


2 Answers

You can simply do

cp /usr/bin/python2 /path/to/my-virtualenv/bin/python2

or

cp /usr/bin/python3 /path/to/my-virtualenv/bin/python3

(Don't need to make a new virtualenv.)

like image 156
aiai Avatar answered Jan 02 '23 07:01

aiai


A quick fix that works is to create a new virtualenv and copy its bin/python to the broken virtualenvs. Five simple steps:

  1. mkvirtualenv lero
  2. cd ~/.virtualenvs
  3. for d in */; do cp lero/bin/python $d/bin/python; done
  4. deactivate
  5. rmvirtualenv lero
like image 30
Pedro Werneck Avatar answered Jan 02 '23 06:01

Pedro Werneck