Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi i am trying to fix this for a long time but without success. When i open my zsh terminal i get this error: (terminal is working but error appear)

 Welcome to the world of tomorrow!
virtualenvwrapper_run_hook:12: permission denied: There was a problem running the initialization hooks. 

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
set properly.

I tried few things but... dont know how to solve it. Somehow during looking for a search i found i should post here an output of:

→ sudo dpkg --configure -a
Setting up python-pip (1.0-1build1) ...
/var/lib/dpkg/info/python-pip.postinst: 6: /var/lib/dpkg/info/python-pip.postinst: pycompile: not found
dpkg: error processing python-pip (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up libc-dev-bin (2.15-0ubuntu10.5) ...
Setting up gnome-control-center-data (1:3.4.2-0ubuntu0.13) ...
Setting up linux-libc-dev (3.2.0-56.86) ...
Setting up python-virtualenv ( ...
/var/lib/dpkg/info/python-virtualenv.postinst: 6: /var/lib/dpkg/info/python-virtualenv.postinst: pycompile: not found
dpkg: error processing python-virtualenv (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up libglib2.0-0 (2.32.4-0ubuntu1) ...
Setting up libglib2.0-0:i386 (2.32.4-0ubuntu1) ...
Setting up gimp (2.6.12-1ubuntu1.2) ...
/var/lib/dpkg/info/gimp.postinst: 11: /var/lib/dpkg/info/gimp.postinst: pycompile: not found
dpkg: error processing gimp (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up libpolkit-gobject-1-0 (0.104-1ubuntu1.1) ...
Setting up libgnome-control-center1 (1:3.4.2-0ubuntu0.13) ...
Setting up libnm-util2 ( ...
Setting up libc6-dev (2.15-0ubuntu10.5) ...
Setting up libpulse-mainloop-glib0 (1:1.1-0ubuntu15.4) ...
dpkg: dependency problems prevent configuration of virtualenvwrapper:
 virtualenvwrapper depends on python-virtualenv; however:
  Package python-virtualenv is not configured yet.
dpkg: error processing virtualenvwrapper (--configure):
 dependency problems - leaving unconfigured
Setting up libpolkit-agent-1-0 (0.104-1ubuntu1.1) ...
Setting up libupower-glib1 (0.9.15-3git1ubuntu0.1) ...
Setting up libaccountsservice0 (0.6.15-2ubuntu9.6.1) ...
Setting up libpolkit-backend-1-0 (0.104-1ubuntu1.1) ...
Setting up libglib2.0-bin (2.32.4-0ubuntu1) ...
Setting up libnm-glib4 ( ...
Setting up policykit-1 (0.104-1ubuntu1.1) ...
Setting up gnome-settings-daemon (3.4.2-0ubuntu0.6.4) ...
Setting up accountsservice (0.6.15-2ubuntu9.6.1) ...
dpkg: error processing ubuntu-system-service (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:


→ python --version
zsh: command not found: python

Part of my ~/.zshrc

# python virtual env wrapper
if [ -f ~/.local/bin/ ]; then
    export WORKON_HOME=~/.virtualenvs
    source ~/.local/bin/
    plugins=("${plugins[@]}" virtualenvwrapper)

# pythonbrew
[[ -s ~/.pythonbrew/etc/bashrc ]] && source ~/.pythonbrew/etc/bashrc   

Part os zsh -xv

# Invoke the initialization functions
+/home/trki/.local/bin/> virtualenvwrapper_initialize
+virtualenvwrapper_initialize:1> virtualenvwrapper_derive_workon_home
+virtualenvwrapper_derive_workon_home:1> typeset 'workon_home_dir=/home/trki/.virtualenvs'
+virtualenvwrapper_derive_workon_home:5> [ /home/trki/.virtualenvs '=' '' ']'
+virtualenvwrapper_derive_workon_home:12> echo /home/trki/.virtualenvs
+virtualenvwrapper_derive_workon_home:12> unset GREP_OPTIONS
+virtualenvwrapper_derive_workon_home:12> grep '^[^/~]'
+virtualenvwrapper_derive_workon_home:21> echo /home/trki/.virtualenvs
+virtualenvwrapper_derive_workon_home:21> unset GREP_OPTIONS
+virtualenvwrapper_derive_workon_home:21> egrep '([\$~]|//)'
+virtualenvwrapper_derive_workon_home:30> echo /home/trki/.virtualenvs
+virtualenvwrapper_derive_workon_home:31> return 0
+virtualenvwrapper_initialize:1> export 'WORKON_HOME=/home/trki/.virtualenvs'
+virtualenvwrapper_initialize:3> virtualenvwrapper_verify_workon_home -q
+virtualenvwrapper_verify_workon_home:1> RC=0 
+virtualenvwrapper_verify_workon_home:2> [ ! -d /home/trki/.virtualenvs/ ']'
+virtualenvwrapper_verify_workon_home:11> return 0
+virtualenvwrapper_initialize:6> [ /home/trki/.virtualenvs '=' '' ']'
+virtualenvwrapper_initialize:11> virtualenvwrapper_run_hook initialize
+virtualenvwrapper_run_hook:1> typeset hook_script
+virtualenvwrapper_run_hook:2> typeset result
+virtualenvwrapper_run_hook:4> hook_script=+virtualenvwrapper_run_hook:4> virtualenvwrapper_tempfile initialize-hook
+virtualenvwrapper_tempfile:2> typeset 'suffix=initialize-hook'
+virtualenvwrapper_tempfile:3> typeset file
+virtualenvwrapper_tempfile:5> file=+virtualenvwrapper_tempfile:5> virtualenvwrapper_mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
+virtualenvwrapper_mktemp:1> mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
+virtualenvwrapper_tempfile:5> file=/tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 
+virtualenvwrapper_tempfile:6> [ 0 -ne 0 ']'
+virtualenvwrapper_tempfile:6> [ -z /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 ']'
+virtualenvwrapper_tempfile:6> [ ! -f /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 ']'
+virtualenvwrapper_tempfile:11> echo /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7
+virtualenvwrapper_tempfile:12> return 0
+virtualenvwrapper_run_hook:4> hook_script=/tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 
+virtualenvwrapper_run_hook:11> cd /home/trki/.virtualenvs
+cd:1> [[ x/home/trki/.virtualenvs == x... ]]
+cd:3> [[ x/home/trki/.virtualenvs == x.... ]]
+cd:5> [[ x/home/trki/.virtualenvs == x..... ]]
+cd:7> [[ x/home/trki/.virtualenvs == x...... ]]
+cd:9> [ -d /home/trki/.autoenv ']'
+cd:13> cd /home/trki/.virtualenvs
+virtualenvwrapper_run_hook:12> '' -m virtualenvwrapper.hook_loader --script /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 initialize
virtualenvwrapper_run_hook:12: permission denied: 
+virtualenvwrapper_run_hook:15> result=126 
+virtualenvwrapper_run_hook:17> [ 126 -eq 0 ']'
+virtualenvwrapper_run_hook:27> [ initialize '=' initialize ']'
+virtualenvwrapper_run_hook:29> cat - There was a problem running the initialization hooks. 

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
set properly.
+virtualenvwrapper_run_hook:38> rm -f /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7
+virtualenvwrapper_run_hook:39> return 126
+virtualenvwrapper_initialize:13> virtualenvwrapper_setup_tab_completion
+virtualenvwrapper_setup_tab_completion:1> [ -n '' ']'
+virtualenvwrapper_setup_tab_completion:20> [ -n 4.3.17 ']'
+virtualenvwrapper_setup_tab_completion:30> compctl -K _virtualenvs workon rmvirtualenv cpvirtualenv showvirtualenv
+virtualenvwrapper_setup_tab_completion:31> compctl -K _cdvirtualenv_complete cdvirtualenv
+virtualenvwrapper_setup_tab_completion:32> compctl -K _cdsitepackages_complete cdsitepackages
+virtualenvwrapper_initialize:15> return 0
+/home/trki/.zshrc:17> plugins=( git python django symfony2 zsh-syntax-highlighting composer history-substring-search virtualenvwrapper ) 

# pythonbrew
[[ -s ~/.pythonbrew/etc/bashrc ]] && source ~/.pythonbrew/etc/bashrc
+/home/trki/.zshrc:21> [[ -s /home/trki/.pythonbrew/etc/bashrc ]]

Also when i try to open ubuntu software center absolutly nothing happens. No idea what to do now.

share|improve this question
Welcome to AskUbuntu. Could you add some more info about your environment? It seems that your zsh is configured to load some python environment - you should check ~/.zshrc and ~/.zlogin to see what it's failing. Also running a different shell and running zsh -xv there should give you hints. – Rmano Nov 12 '13 at 1:31
Thx. I updated info in my question but i am not much smarter from it :/ Any ideas what to do? – Trki Nov 12 '13 at 6:24
It seems you have packages badly installed, as if they had been held or force-installed or something similar. Have you tried sudo apt-get install -f to repair installation? And if you have held packages you can look here. Moreover, what do you mean with "nothing happens" running software-center? try to run it from a terminal to see what it says... – Rmano Nov 12 '13 at 15:17
i updated my question. Please have a look at it. (at the bottom). How can i run it from the terminal? – Trki Nov 12 '13 at 19:42
You can run software-center from command line in a terminal. However, this is clearly a problem related to the python virtualenv, and I do not know even what it is... – Rmano Nov 12 '13 at 20:57

Disclaimer: I do not know anything about the python virtualenv you have installed, but it seems you have the packages in an inconsistent state. Probably a lot of problems arises from the fact that something is failing in your shell startup files and you have an half-baked environment up. So this is a wild guess, you should check with the support of the virtualenv thing you have.

Disclaimer: if you have installed things forcing the installation (you or some script) this can disrupt your system.

I would try to do the following:

1) try to see if it is automatically fixable:

sudo apt-get install -f

2) If this fails, try to see if you have "held" packages:

apt-mark showhold 

3) if you have, un-hold them with:

sudo apt-mark unhold <package name> 

And then repeat the step 1.

After that, probably the best thing you can do is removing all the packages that are creating problems with

sudo apt-get remove <package> 

or even (you have played around with configuration files)

sudo apt-get purge <package>

and then reinstall them with sudo apt-get install. I would do this at least with the packages that give you error:

python-pip python-virtualenv gimp virtualenvwrapper ubuntu-system-service

and probably zsh too --- probably you'll have to remove/rename the .zshrc, .zlogin, .zshenv files too (if some installation script has modified them, reinstalling zsh will not change files in your home dir). Hope this helps...

share|improve this answer
everything i tried to remove ends up with – Trki Nov 13 '13 at 8:28
I really do not know what to suggest more. It seems you managed to have no python in your system, try to install or reinstall python-minimal (sudo apt-get reinstall python-minimal) but then I think you need to refer to he python-virtualenv developers. Something has really messed up your system. – Rmano Nov 13 '13 at 15:01
Hmm but i think its not just with the python is it? Have a look at this please: – Trki Nov 13 '13 at 18:24
Ubuntu will not work without python. And it seems that you do not have python installed. So, yes, I think it's not just python, but try to go step by step... Have you tried to reinstall python? – Rmano Nov 13 '13 at 18:53
Did not know ubuntu will not work without python. And yea sure, several times and its kind of possible i mess something with paths or i had two different versions of python or something like that and i messed it all somehow :/ When i run python in zsh (terminal) there is no python, or python -v or --version returns nothing as well. – Trki Nov 14 '13 at 0:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.