All this should be unnecessary, once you install the virtualenvwrapper package, (apt-get install virtualenvwrapper), next time you open a shell (but you need to open a new one, you probably stayed in the same one and that's why you had to do everything manually) you will have virtualenvwrapper functions in your shell, no need to activate anything manually (this is done through the /etc/bash_completion.d/virtualenvwrapper file)
Logging in from a cold boot I received errors that /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh did not exist which it didn't. I removed the sourcing of the script from my .bashrc file and then looked at the /etc/bash_completion.d/ folder to see if virtualenvwrapper was present
and it was. It was hard coded to use the lazy version (USE_FULL=no).
I removed the package with apt-get remove and installed it with pip3 install
last night so neither script was present in /usr/share/virtualenvwrapper, so why is the script still present in /etc/bash_completion.d/? Poor clean up on the part of the apt-get removal process or is it related to using pip3 to install the package?.
I corrected this by reinstalling with apt-get install virtualenvwrapper. No errors occured. Then I logged out of that shell & started a new one, but still mkvirtualenv was not to be found in my path. So logged out of the entire session & back in, still not in my path. Checked both /etc/bash_completion.d/ and /usr/share/virtualenvwrapper/ and they looked OK. The contents of that file are:
# bash completion snippet for virtualenvwrapper
USE_FULL=no
if [ "$USE_FULL" = "yes" ]; then
. /usr/share/virtualenvwrapper/virtualenvwrapper.sh
else
. /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh
fi
Inspecting the environment with set showed 2 virtualenvwrapper settings:
VIRTUALENVWRAPPER_SCRIPT=/usr/share/virtualenvwrapper/virtualenvwrapper.sh
_VIRTUALENVWRAPPER_API=' mkvirtualenv rmvirtualenv lsvirtualenv showvirtualenv workon add2virtualenv cdsitepackages cdvirtualenv lssitepackages toggleglobalsitepackages cpvirtualenv setvirtualenvproject mkproject cdproject mktmpenv'
root@Jessie:/etc/bash_completion.d#
However the mkvirtualenv command still fails with command not found.
I'm not the only one that has problems with the wrapper script. Look at the comments here for example:
http://stackoverflow.com/questions/25774829/mkvirtualenv-command-not-foundIn my case the .bashrc file is simple, small and clean so that is unlikely the issue.
The workaround I'm using was to add this to the end of my .bashrc:
source /etc/bash_completion.d/virtualenvwrapper
Probably not the correct way to resolve whatever the actual problem is but it works and I have no time to dig into it anymore.
Could it be that /etc/bash_completion.d scripts are probably executed on termination of the shell, not the start of it? If so that would explain it. From several quick google searches it seems others use that to run scripts upon shell startup, so scratch that idea.
However it is still necessary to use the -p parameter to get the correct python version:
mkvirtualenv -p`which python3` bts_tools
It looks like I've overcome the last major issue and the build is working well, at least it has gotten to 70% complete now so I think I'm good. Onto the next series of steps...