Issue
So my development environment really hasn't changed for a long time. I am using Bash on Ubuntu on Windows for about a year now. I just apply the regular updates with:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Haven't had any issues until last week. When I would workon env
and then start up Django, all of these Python errors related to encryption and hashing would come up. Don't really remember what they said, but apparently couldn't find something. I just ignored them because I am in the middle of a project and figured I'd address them later since it is just the dev server.
Anyway, I come in yesterday to work and all of a sudden I am getting:
-bash: /usr/local/bin/python3.6: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.6 and that PATH is
set properly.
I read a number of SO questions related to this. Basically they all suggested to uninstall virtualenv
, virtualenvwrapper
, and pip
. That is if doing pip3 install --upgrade virtualenvwrapper
didn't work, which it didn't. Uninstalled, reinstalled, and left work yesterday with everything seeming to be running fine.
Came into work today and the problem is back so I am not sure how to fix it. I am running Python 3.6.3
and PIP3
. My ~/.bashrc
has the following with some additional lines that I have added to "fix" the issue:
export PYTHONPATH=${PYTHONPATH}:/usr/bin
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6
export WORKON_HOME=/mnt/c/dev/.venvs
export VIRTUALENVWRAPPER_VIRUTALENV_ARGS='--no-site-packages'
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
source /usr/local/bin/virtualenvwrapper.sh
The latest error message is:
/usr/bin/python3.6: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6 and that PATH is
set properly.
-bash: /usr/local/bin/python3.6: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.6 and that PATH is
set properly.
Python 3.6.3
is in the /usr/bin
and virtualenvwrapper.sh
is in the /usr/local/bin/virtualenvwrapper.sh
. Not sure why it is looking in /usr/local/bin/python3.6
as I don't see where this is specified.
Wish I knew what caused it to break all of a sudden. Thanks for the help!
Solution
I guess I will go ahead and answer this.
Apparently this is an issue related to the Windows 10 Fall Creators Update. Using Ubuntu either with Bash on Ubuntu on Windows (lxrun
), or Ubuntu through the Windows Store (if you can get it to download), results in this error. From what I understand, the error is from using repos in the Linux environment to install such things as virtualenv
or npm install
on /mnt/c
or any Windows drive. I guess an issue with symlinks between the two.
For me the environment broke with Microsoft Windows [Version 10.0.16299.19]
. This was on my work computer which basically shut me down for a few days until I figured out what was going on. My personal laptop was still under Microsoft Windows [Version 10.0.15063] and ran fine. I had to have IT restore to a previous build and shut off Windows Updates until they fix the issue.
I had been running this setup since the beginning of the year with no issues installing venvs
and npm
repos in my project directories.
Answered By - cjones Answer Checked By - David Marino (WPSolving Volunteer)