ImportError: No module named _io in ubuntu 14.04
I had the same problem. This happened in Ubuntu - 14.04 and Virtual environment's Python version - 2.7.3
After spending a day in debugging, posting my answer here, hope it helps for future visitors.
I found that io.py
is invoking _io
module. I think _io
module is internal to the interpreter, so, just replacing the python
binary in the environment alone with the newer version should fix.
(In my case, Cloudera Manager 5.x Agent's virtualenv on ubuntu 14.04 was using python interpreter 2.7.3, replaced it with 2.7.6.
echo "Using " && python2.7 --version
mv myenv/bin/python myenv/bin/python.bak;
cp `which python2.7` myenv/bin/python
When a new virtualenv is created, it uses updated python binary from the system. Hence, that explains the accepted answer in the thread.
Your virtualenv became corrupt due to diffs in the Python system lib.
Best choice is to reinstall your virtualenv:
$ deactivate
$ rmvirtualenv nlmanagement
$ mkvirtualenv nlmanagement
$ pip install -r requirements.txt
You don't need to delete the virtual environment.
Just follow these steps.
-
Let's say your virtual environment name is "mydev" and you are using
virtualenvwrapper
, docd $WORKON_HOME virtualenv mydev
The above command just upgrades the link to the python executable without losing any package. Without
virtualenvwrapper
,$WORKON_HOME
might not be defined; then you need to change to the parent directory of the virtualenv. -
outside virtualenv, if your pip is not working, then just
easy_install pip
will resolve the issue.