1

I installed python virtualenv and virtualenvwrapper on ubuntu 15.10 following the answer at How to set up and use a virtual python environment in Ubuntu?. The installation was successful, i.e. I can create, deactivate and work on my python virtualenvs. However since I installed it, every time I fire up the terminal I get:

bash: WORKON_HOME=~/.virtualenvs: No such file or directory

I checked if the environment variable WORKON_HOME is set correctly by typing:

echo $WORKON_HOME

and I get as output:

~/.virtualenvs

What can I do to remove the error? Thank you

EDIT 1

The output of grep WORKON_HOME ~/.bashrc command is:

echo "export WORKON_HOME=$WORKON_HOME" >> ~/.bashrc
echo "export PIP_VIRTUALENV_BASE=$WORKON_HOME" >> ~/.bashrc 
source WORKON_HOME=/home/diego/.virtualenvs
export WORKON_HOME=/home/diego/.virtualenvs
export WORKON_HOME=
export WORKON_HOME=
export WORKON_HOME=
export WORKON_HOME=
export WORKON_HOME=

EDIT 2

I have removed the lines you (@ByteCommander) mentioned. The error does not appear anymore. However, when I edit the .bashrc file, at the end it look like this:

source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=/home/diego/.virtualenvs
export WORKON_HOME=/home/diego/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=/home/diego/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=
export WORKON_HOME=/home/diego/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=/home/diego/.virtualenvs

There are many lines that repeat. Is this normal? Shall I remove the duplicate? Thanks

diegus
  • 487

1 Answers1

1

Okay, there are some wrong lines in your .bashrc file.

Please open ~/.bashrc in your favourite text editor and delete all these lines:

  • All lines that look like this pattern:

    echo "export SOMETHING" >> ~/.bashrc
    

    This includes e.g. those lines from your grep output:

    echo "export WORKON_HOME=$WORKON_HOME" >> ~/.bashrc
    echo "export PIP_VIRTUALENV_BASE=$WORKON_HOME" >> ~/.bashrc 
    
  • All lines that look like this pattern:

    export SOMETHING=
    

    This includes e.g. those lines from your grep output:

    export WORKON_HOME=
    
  • This line:

    source WORKON_HOME=/home/diego/.virtualenvs
    

If you are not sure whether to delete a line or not, better ask before you permanently remove it. Making a backup copy of the file before starting to delete lines could also be useful.

Byte Commander
  • 107,489