TransWikia.com

-bash: /usr/bin/virtualenvwrapper.sh: No such file or directory

Stack Overflow Asked by user1807271 on December 13, 2021

I can’t figure out where the shell is trying to run /usr/bin/virtualenvwrapper.sh upon server login. I want virtualenvwrapper permanently uninstalled, not just removed from the shell instance. I thought I uninstalled it with pip uninstall virtualenvwrapper, but every time I log into the server I get the error -bash: /usr/bin/virtualenvwrapper.sh: No such file or directory, as if there is some sort of leftover artifact. Yesterday I did a lot of tinkering and I can’t remember all the changes I made or how I made this happen. Where is it executing the search for virtualenvwrapper.sh?

SUPPLEMENTARY INFO

$ echo $PATH
/usr/lib64/qt-3.3/bin
/usr/local/bin/ibm/lsf/9.1/linux2.6-glibc2.3-x86_64/etc
/usr/local/bin/ibm/lsf/9.1/linux2.6-glibc2.3-x86_64/bin
/usr/local/bin
/bin
/usr/bin
/usr/local/sbin
/usr/sbin
/sbin/usr/local/bin/CASAVA-1.8.2/bin
/usr/local/bin/blast
/usr/local/bin/mirdeep2
/usr/local/bin/velvet

$ sudo vim ~/.bashrc
1 # .bashrc
2
3 # Source global definitions
4 if [ -f /etc/bashrc ]; then
5         . /etc/bashrc
6 fi
7
8 # User specific aliases and functions

8 Answers

It can be that you python packages are installed somewhere else. So try:

$ which python
/home/tesla/miniconda3/bin/python

or

$ which virtualenvwrapper.sh
/home/tesla/miniconda3/bin/virtualenvwrapper.sh    

To check the location of python installation. In my case I was using miniconda, therefore system was not able to find the location mentioned in the documentation. If the above location is not /usr/local/bin/virtualenvwrapper.sh then now use :

source /home/tesla/miniconda3/bin/virtualenvwrapper.sh

Should work.

Answered by Amiay Narayan on December 13, 2021

I also confronted the same problem, but this worked for me: -

  1. Create a directory to hold the virtual environments.mkdir $HOME/.virtualenvs
  2. Add a line like export WORKON_HOME=$HOME/.virtualenvsto your .bashrc.
  3. Add a line like source /path/to/this/file/virtualenvwrapper.sh to your .bashrc.
  4. Run: source ~/.bashrc
  5. Run: mkvirtualenv temp
  6. This time, the "temp" environment is included.
  7. Run: workon temp
  8. The virtual environment is activated.

If you are on Ubuntu 20 then use the code given below in ~/.bashrc

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh

Answered by Maheep on December 13, 2021

Setting up a Virtual Environment Now open your terminal in the home directory by right clicking and choosing the option “Open in Terminal”. You can also press the CTRL, ALT, and T keys on your keyboard at the same time to open the Terminal application automatically.

You first need to create a special directory that will hold all of your virtual environments. So proceed with creating a new hidden directory called virtualenv.

$ mkdir .virtualenv

Now you should install pip for Python3.

$ sudo apt install python3-pip

Confirm the pip3 installation.

$ pip3 --version

Now install virtualenv via pip3.

$ pip3 install virtualenv

To find where your virtualenv was installed, type:

$ which virtualenv

Install virtualenvwrapper via pip3:

$ pip3 install virtualenvwrapper

We are going to modify your .bashrc file by adding a row that will adjust every new virtual environment to use Python 3. We will point virtual environments to the directory we created above (.virtualenv) and we will also point to the locations of the virtualenv and virtualenvwrapper.

Now open the .bashrc file using Vim editor.

$ vim .bashrc

If you still haven’t used the Vim editor or you don’t have it installed on your computer you should install it now. It is a widely used Linux editor, and for good reason.

$ sudo apt install vim

After you've installed Vim open the file .bashrc file by typing the vim .bashrc command in your terminal. Navigate to the bottom of the .bashrc file, press the letter i to enter the insert mode of Vim, and add these rows:

#Virtualenvwrapper settings:
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV=/home/your_username/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh

After you are done, press the esc key. Then type :wq and press enter. This command will save and exit the Vim editor. Close and reopen your terminal when you’re done.

To create a virtual environment in Python3 and activate it immediately, use this command in your terminal:

$ mkvirtualenv name_of_your_env

You should confirm that this environment is set up for Python3:

$ Python -V

To deactivate the environment use the deactivate command.

$ deactivate

To list all available virtual environments use the command workon or lsvirtualenv (same result as workon but shown in a fancy way) in your terminal:

$ workon

$ lsvirtualenv

To activate one specific environment use workon + name of your environment:

$ workon name_of_your_env

There are several useful command you might need to use someday:

Rmvirtualenv will remove a specific virtual environment located in your .virtualenv directory.

$ rmvirtualenv name_of_your_env

Cpvirtualenv will copy the existing virtual environment to a new virtual environment and activate it.

$ cpvirtualenv old_virtual_env new_virtual_env

Well done! You have now created your first isolated Python 3 environment.

Answered by Bukhosi Moyo on December 13, 2021

For anyone finding this in the future. The virtualenvwrapper.sh script is/was now located at /usr/share/virtualenvwrapper/virtualenvwrapper.sh on Ubuntu 20.04.1 LTS (at least for me in my VM).

(Sadly i can't just comment on the above post mentioning the locations so it would all be together, because new user reputation)

Answered by Zaughon on December 13, 2021

Confirmed for Ubuntu 18 , as already answered by @Tarique . The shell script virtualenvwrapper.sh for the wrapper is within - ~/.local/bin/

(base) dhankar@dhankar-1:~/opencv_cuda$ cd ~/.local/bin/
(base) dhankar@dhankar-1:~/.local/bin$ ls -ltr
total 100
-rwxr-xr-x 1 dhankar dhankar 41703 Jul 23 20:56 virtualenvwrapper.sh
-rwxr-xr-x 1 dhankar dhankar  2210 Jul 23 20:56 virtualenvwrapper_lazy.sh
-rwxr-xr-x 1 dhankar dhankar   259 Jul 23 20:56 virtualenv

Answered by Rohit Dhankar on December 13, 2021

sudo -H pip3 install virtualenvwrapper

i ran into to similar problem where installation could not suceed because ~/.cache/pip and ~/.cache/pip/http is not owned by the current user. installing with -H or --set-home option solved my problem.

Answered by udeep shrestha on December 13, 2021

on ubuntu 12.04 LTS, installing through pip, it is installed to

/usr/local/bin/virtualenvwrapper.sh

And if you are using Ubuntu 16.04 or later, it is installed to

~/.local/bin/virtualenvwrapper.sh

Answered by Tarique on December 13, 2021

There are a number of files that might be run when you login to your terminal if you are using the bash shell.

You should check ~/.bashrc, ~/.bash_profile, ~/.bash_login and ~/.profile for "/usr/bin/virtualenvwrapper.sh".

Likely one of those files is being run on login and contains the missing script which you uninstalled.

Answered by njachowski on December 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP