8

Since I do not use them at this time I tried to uninstall virtualenv and virtualenvwrapper via the Ubuntu Software Center. Now whenever I open a console I get the following error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named virtualenvwrapper.hook_loader
virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.

Also the directory ~/.virtualenvs/ is still present.

How can I bring my system back to a clean and functional state as before the installation of virtualenv and virtualenvwrapper?

Updates

As suggested I checked the following files for occurrences of virtualenv each with a negative result:

~/.bashrc
~/.profile
/etc/profile
/etc/profile.d/*
/etc/environment
3
  • Well, you have followed some additional user-specific steps in the installation of virtualenvwrapper. This is outside the scope of the Ubuntu Software Centre. Please include the steps you have followed (perhaps the official docs?). Then we can provide instructions how to revert these steps.
    – gertvdijk
    Jul 9, 2013 at 12:15
  • I can not remember to have done so. Can this result from an installation by pip? Unfortunately I do not know whether I used pip or the Software Center to install. How can I find out?
    – hielsnoppe
    Jul 9, 2013 at 12:20
  • I found it in the history so I am pretty sure I used Software Center instead of pip. Anyhow I do not know of any changes I made especially not in reference to the docs.
    – hielsnoppe
    Jul 9, 2013 at 12:37

2 Answers 2

6

I got the same issue, but eventually found out where the problematic file was. It's

/etc/bash_completion.d/virtualenvwrapper

Delete it and you won't see the error message again.

PS: Here's how I found out where the file was:

grep -lir "virtualenvwrapper" /etc/

1

You've probably followed this step from the documentation:

You will want to add the command to source /usr/local/bin/virtualenvwrapper.sh to your shell startup file, changing the path to virtualenvwrapper.sh depending on where it was installed by pip.

Just installing the virtualenvwrapper won't include anything in your shell startup and you would not have got the error in your question on opening a new console.

I cannot guess where exactly you've modified your shell configuration, but if you use Bash, then you've probably put it in ~/.bashrc or ~/.profile:

export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh

Just remove those lines and try to create a new terminal window.

3
  • Thanks for taking the time to help! Unfortunately neither of the two files contains the lines you mention. Is there another place where they might be written? I am pretty sure that I never put them anywhere by hand.
    – hielsnoppe
    Jul 9, 2013 at 13:56
  • Try /etc/profile, files in /etc/profile.d/ (I think one of those could be it) and /etc/environment.
    – gertvdijk
    Jul 9, 2013 at 14:21
  • I checked all of these (see updated question) and there is nothing about virtualenv in there. :S
    – hielsnoppe
    Jul 9, 2013 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .