Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtualenvwrapper_run_hook:12: permission denied error when running Environment

I've installed Virtualenvwrapper, and it seems to be running fine, but anytime I activate an env or run workon venv I get the following:

virtualenvwrapper_run_hook:12: permission denied: 
virtualenvwrapper_run_hook:12: permission denied:

This is what my .bash_profile looks like

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

Here are my packages

Package           Version
----------------- -------
distlib           0.3.4
filelock          3.7.0
pbr               5.9.0
pip               22.1.1
platformdirs      2.5.2
setuptools        49.2.1
six               1.15.0
stevedore         3.5.0
virtualenv        20.14.1
virtualenv-clone  0.5.7
virtualenvwrapper 4.8.4
wheel             0.36.2

I am using Python3.8.9

It looks like my environment activated, but I'm not a fan of seeing an error message I don't understand.

like image 609
Jesse Avatar asked Sep 02 '25 03:09

Jesse


2 Answers

I used vi ~/.zshrc to open my .zshrc file. Then I changed it to the following:

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /Users/username/.local/bin/virtualenvwrapper.sh

Replacing username with my actual user name.

I ran:

source ~/.zshrc

and it now all works. I think this is because for mac terminal I needed to edit my .zshrc file. I also downloaded the virtualenvwrapper package with pipx initially.

like image 160
Jesse Avatar answered Sep 05 '25 00:09

Jesse


In my case, I used homebrew to install python3 in my Apple M2. Where the script for virtualenwrapper is located at: /opt/homebrew/bin/virtualenvwrapper.sh.

Additionally, I don't have python linked, but python3 instead. As virtualenvwrapper will look for the python executable using command which python I was getting the error:

virtualenvwrapper_run_hook:12: permission denied:
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= and that PATH is
set properly.

Adding then VIRTUALENVWRAPPER_PYTHON whith the python3 path fixed my issue. This is how my profile looks like:

# Virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/opt/homebrew/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /opt/homebrew/bin/virtualenvwrapper.sh
like image 29
juanesarango Avatar answered Sep 05 '25 00:09

juanesarango