17

I am trying to install Virtualenv wrapper on Ubuntu 14.04. But whenever I start a terminal, I get the error saying bash:

/usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory.

I also checked the bashrc script by using gedit ~/.bashrc, but there is no such line like that. Does anyone know where I am wrong?

glenn jackman
  • 27,524

6 Answers6

24

In my case, I had previously installed virtualenvwrapper using apt-get install virtualenvwrapper and later uninstalled it using apt-get remove virtualenvwrapper, which left the 'configuration' file /etc/bash_completion.d/virtualenvwrapper behind. This bash completion definition was sourced by bash (it had nothing to do with my .bashrc) and caused the error message.

The solution was to run:

sudo apt-get purge virtualenvwrapper

Which purged all files related to virtualenvwrapper. The reason I uninstalled it was to use pip's version instead (more up-to-date), which can be installed globally using:

sudo pip install virtualenvwrapper
user30747
  • 409
23

I just had the same problem on Linux Mint.

The following file was causing the issue: /etc/bash_completion.d/virtualenvwrapper

I made a backup (just in case) and deleted it, and everything seems to be working fine now.

5

Following these instructions, I found that the error occurred when sourcing the virtualenvwrapper bash script, i.e.:

source /usr/local/bin/virtualenvwrapper.sh

The script references the file /etc/bash_completion.d/virtualenvwrapper as pointed out by arcticfeather.

Open up the script using the following command:

sudo nano /etc/bash_completion.d/virtualenvwrapper

This is where the non-existent file is being referenced. Simply replace /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh with /usr/local/bin/virtualenvwrapper_lazy.sh and you should be good to go!

1

If none of the answers work like for myself, just create an empty file at the location giving out an error and shebang to it.

In the case of OP:

sudo nano /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh

and write:

#!/bin/bash

Save it and try to open terminal again, did the trick for me

ritiek
  • 111
1

You can install Extension to virtualenv for managing multiple virtual Python environments (virtualenvwrapper) in Ubuntu 14.04 from the Ubuntu Software Center or from the terminal using the following command:

sudo apt install virtualenvwrapper
gedit .bashrc

Add the following line to the end of .bashrc.

source /usr/share/virtualenvwrapper/virtualenvwrapper.sh

Save the changes to .bashrc and close gedit. Source your .bashrc for the changes to take effect.

cd 
source .bashrc
karel
  • 13,706
0

I hope it help someone, in my case i was trying to create the virtualenv being inside a screen (screen -S whatever), the solution was closing the screen and executing the virtualenv command again being outside.