Reputation: 161
As I'm starting to learn Python programming, I installed virtualenvwrapper via these commands:
# Install distribute: http://pypi.python.org/pypi/distribute
wget http://python-distribute.org/distribute_setup.py
sudo python distribute_setup.py
# Install pip http://pypi.python.org/pypi/pip
sudo easy_install pip
# Install virtualenv
sudo pip install virtualenv
# Install virtualenvwrapper
sudo pip install --upgrade virtualenvwrapper
virtualenvwrapper.sh
echo source `which virtualenvwrapper.sh` >> $HOME/.bashrc
# IMPORTANT
# Go to the working directory
# Start a working environment virtualenv
mkvirtualenv <working environment name>
# Install all the requirements for the working environment
pip -E $VIRTUAL_ENV install -r requirements.txt
I've been getting this error every time I open a terminal (via guake)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/virtualenvwrapper/hook_loader.py", line 72, in main
backupCount=1,
File "/usr/lib/python2.6/logging/handlers.py", line 112, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python2.6/logging/handlers.py", line 64, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python2.6/logging/__init__.py", line 827, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python2.6/logging/__init__.py", line 846, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 2] No such file or directory: '/home/ahim/$VIRTUALENVWRAPPER_LOG_DIR/hook.log'
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'm using Linux Mint 10 64bit GNOME.
Is there any way to solve this error I see in the terminal?
I've tried searching via google but none of them seems to fix this problem.
Thank you in advance.
===Edit===
This is what is written in /home/user/.bashrc
source /usr/local/bin/virtualenvwrapper.sh 2> /dev/null
VIRTUALENVWRAPPER_LOG_DIR=/tmp
export VIRTUALENVWRAPPER_LOG_DIR
Please help :(
Upvotes: 16
Views: 19104
Reputation: 14581
I had similar issues. I removed any settings in my ~/.bashrc related to virtualenv, eg:
# virtualenv
#export WORKON_HOME=~/virtualenvs
#source /usr/local/bin/virtualenvwrapper.sh
That fixed the errors.
Upvotes: 2
Reputation: 1
Try and use the export command like this:
$export VIRTUALENVWRAPPER_LOG_DIR = "/path/to/the/hook.log"
In my case, the hook.log was created in the same path that my virtualenvwrapper config where in /home/my_user/.virtualenvs, so what I did was to export the variable like this
$export VIRTUALENVWRAPPER_LOG_DIR = "./"
Upvotes: 0
Reputation: 512
For complete removal under debian remove following:
/usr/local/bin/virtualenvwrapper*
/etc/bash_completion.d/virtualenvwrapper
That worked for me
Also delete files from python's dist-packages (depends on distro and python version)
Upvotes: 1
Reputation: 5878
According to this, it seems to be an error with the APT package on Debian/Ubuntu/Mint.
I have installed virtualenvwrapper through APT first, then removed it and installed it via pip.
apt-get install virtualenvwrapper
apt-get remove virtualenvwrapper
pip install virtualenvwrapper
The APT package has added the file /etc/bash_completion.d/virtualenvwrapper
but didn't remove it. This is the file that's causing problems.
The recommended solution is to remove this file and the errors stop appearing. (Weirdly, simply renaming the file was not enough).
Upvotes: 16
Reputation: 1
I've had a similar problem while trying to make it work on Debian. I needed to run it as a user other than the X user, but it used the ~/.virtualenvs
directory of the X user for WORKON_HOME
, VIRTUALENVWRAPPER_LOG_DIR
and VIRTUALENVWRAPPER_HOOK_DIR
.
It works now that I set those variables to a proper directory in ~/.bashrc
.
Upvotes: 0
Reputation: 125
For those who come afterwards, I had the same problem on Ubuntu 12 and solved this way:
Switch to correct user:
su username
Make sure your WORKON_HOME variable is set to the path you want it to be (defaults to ~/.virtualenv)
WORKON_HOME=$HOME/.virtualenv
Then add these two lines before your source command:
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
Then save and re-source your bashrc:
source ~/.bashrc
Upvotes: 6
Reputation: 5604
You need to set the VIRTUALENVWRAPPER_LOG_DIR
environment variable. Add this to your .bashrc
file:
VIRTUALENVWRAPPER_LOG_DIR=/tmp
export VIRTUALENVWRAPPER_LOG_DIR
Upvotes: 0