0

I'm trying to setup virtualenv using these steps but I'm getting the following error due to source /usr/local/bin/virtualenvwrapper.sh (either invoked from terminal or through .bashrc):

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.

I found this SO question which is similar to what I'm experiencing. I tried to follow all the steps outlined by the accepted answer but to no avail (FWIW, I got my pip updated in the process).

The only difference I can think of is that they already have a working virtualenv setup before they upgraded, and the upgrade broke it. However, this is my first time installing virtualenv. What can be causing this problem? I'm on Ubuntu Lucid Lynx with both Python 2.6.5 and 3.1.2 installed. I'd be happy to get virtualenv running for 2.6.5; I'll be using it for Django. which python gives usr/bin/python .

Community
  • 1
  • 1
skytreader
  • 11,467
  • 7
  • 43
  • 61
  • 1
    You haven't provided enough information for anyone to really help you. For example, which of the steps in those instructions have you completed successfully, and what is the command that is causing the error? I would also suggest that you start from scratch with https://github.com/brainsik/virtualenv-burrito, it is designed to automate this entire process for you and install virtualenv and virtualenvwrapper in one single step. – glyphobet Jul 31 '12 at 22:53
  • Added details to address comments of @glyphobet . Meanwhile, I'll be checking out virtualenv-burrito. – skytreader Aug 01 '12 at 04:46

2 Answers2

1

Really, guys. For first-timers just use virtualenv-burrito, as glyphobet suggested. It's wonderful! [cue: dreamy look]

skytreader
  • 11,467
  • 7
  • 43
  • 61
1

As I didn't find the suggested solution a way to understand what was wrong, I found out that the pip installed virtualenv is not good enough for debian/ubuntu.

You need to remove the pip installed package, and use apt-get to install it:

apt-get install virtualenvwrapper

This will install the bash completion scripts. IF you don't need all of them you can only source the single one:

source /etc/bash_completion.d/virtualenvwrapper

Hope this helps someone.

Mr Peach
  • 1,364
  • 1
  • 12
  • 20