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?

  • Have you checked other configuration files such as .bash_profile, and system-wide versions in /etc/? – user373230 Mar 24 '15 at 16:34
  • Yes I already checked .bash_profile, but it is empty and I dont know how to check /etc/. – Abhishek Singh Mar 24 '15 at 16:40
  • There should be un-hidden global files as /etc/bash.bashrc. – user373230 Mar 24 '15 at 16:42
  • Have a look at this source chrisstrelioff.ws/sandbox/2014/09/04/… which may assist you with some idea. – vembutech Mar 24 '15 at 16:43
  • @vembutech I checked the above link, but it did not help.I already add path of my virtualenvwrapper.sh in my bashrc. But I didn't found any path like I described above in my question. Whenever I tried source ~/.bashrc, it gives the above error – Abhishek Singh Mar 24 '15 at 17:01
18

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.

  • 1
    Worked for me (+1). – FractalSpace Dec 11 '15 at 16:57
15

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
  • I had this issue in sublime text 3 on OSX when building a script and to solve I just installed it via pip as your command states above. Thanks – James Campbell Feb 16 '17 at 15:25
  • Worked for me on Ubuntu 16.04 – Juha Untinen Jul 16 '18 at 8:22
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
    Didn't work for me. – FractalSpace Dec 11 '15 at 16:57
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

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
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.