Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

virtualenv not displaying #27

Closed
fuzzmz opened this issue Apr 17, 2015 · 21 comments
Closed

virtualenv not displaying #27

fuzzmz opened this issue Apr 17, 2015 · 21 comments

Comments

@fuzzmz
Copy link

fuzzmz commented Apr 17, 2015

I can't seem to get the virtualenv to display despite setting in .zshrc the line POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv)

@fuzzmz fuzzmz closed this as completed Apr 18, 2015
@bhilburn
Copy link
Member

Were you able to resolve this?

If there is a bug, I want to be sure we fix it!

@fuzzmz
Copy link
Author

fuzzmz commented Apr 19, 2015

Sorry, looks like didn't comment. It wasn't a bug, my instance of zsh
wasn't loading the virtualenv and virtualenvwrapper plugins.

-- Serban Constantin
On Apr 19, 2015 03:54, "Ben Hilburn" [email protected] wrote:

Were you able to resolve this?

If there is a bug, I want to be sure we fix it!


Reply to this email directly or view it on GitHub
#27 (comment)
.

@SalahAdDin
Copy link

@fuzzmz why? my zsh doesn't show me the virtualenv name.

@fuzzmz
Copy link
Author

fuzzmz commented May 15, 2016

@SalahAdDin, make sure you have the virtualenv and virtualenvwrapper plugins activated in your .zshrc file.

@SalahAdDin
Copy link

Oh thanks, i put the plugins and add virtualenv in the left side in powerlevel and it works!

@romantolkachyov
Copy link

I had the same issue because I add spaces around the equation. This is wrong:

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = (context dir virtualenv vcs)

This is right:

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir virtualenv vcs)

I hope it helps someone.

@Vadorequest
Copy link

Also had similar issue because I was told by some tutorial to replace the POWERLEVEL9K_LEFT_PROMPT_ELEMENTS

I did this instead: POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs newline virtualenv status) to fix it, it matches the old behavior, kinda got used to have the virtualenv displayed before the checmark.

@dritter
Copy link
Member

dritter commented Aug 12, 2018

@Vadorequest Not sure, what you are trying to say. It should be totally possible to change the order of the segments to your preference. Powerlevel9k is all about configurability. It comes with a small default set of segments, and if you want to display more (like virtualenv), you have to configure it.
So, it should be possible to set POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs newline status virtualenv) (if this is what you want).

@Vadorequest
Copy link

@dritter Indeed, I guess what I said was confusing.
Basically, by following some tutorial, I had changed the POWERLEVEL9K_LEFT_PROMPT_ELEMENTS value without knowing what it does, and lost the virtualenv display in the process. This thread helped me fix it back :)

@hududed
Copy link

hududed commented Oct 27, 2018

Hello, I have done the following and still can't see my virtualenv appearing at all.

I entered the plugins :

plugins=(
  ...
  virtualenv
  virtualenvwrapper
)

And added the elements to the left:
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs virtualenv)

Any suggestions how to troubleshoot?

@bhilburn
Copy link
Member

@hududed - So, the P9k virtualenv segment is independent of your OMZ plugins.

So, when you activate a virtualenv, you don't see anything at all? And, just to be sure, after you've put that in your .zshrc you've started a new terminal session?

@hududed
Copy link

hududed commented Oct 27, 2018

@bhilburn,

I think I am confusing the virtualenv with conda virtualenv. The steps I took above with the plugins and left prompt elements works.

I know this thread is not related to that conda, but do you know quickly how to setup similar to above for conda virtual environment in P9K?

@hududed
Copy link

hududed commented Oct 27, 2018

Hi again

Solved this for conda virtualenv. I followed #1019 and copied the prompt:

prompt_anaconda() {
  # Depending on the conda version, either might be set. This
  # variant works even if both are set.
  local _path=$CONDA_ENV_PATH$CONDA_PREFIX
  if ! [ -z "$_path" ]; then
    # config - can be overwritten in users' zshrc file.
    set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER "("
    set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER ")"
    "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON'
    py_version=$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
    "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$py_version $POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON'
  fi
}

Then added anaconda to the left / right prompt:
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs virtualenv anaconda)

@bhilburn
Copy link
Member

@hududed - So glad that's working for you! We'll work on getting #1019 merged =)

@haifeng-jin
Copy link

I encounter this because in ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh, it says export VIRTUAL_ENV_DISABLE_PROMPT=1.
Comment out this line.
Then it is running fine.

@carloscoelhow
Copy link

carloscoelhow commented Jan 3, 2019

I encounter this because in ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh, it says export VIRTUAL_ENV_DISABLE_PROMPT=1.
Comment out this line.
Then it is running fine.

It works for me! thanks!

@shroomsprite
Copy link

I encounter this because in ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh, it says export VIRTUAL_ENV_DISABLE_PROMPT=1.
Comment out this line.
Then it is running fine.

Works for me too! Thanks!

@ltkhiem
Copy link

ltkhiem commented Jan 22, 2019

I encounter this because in ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh, it says export VIRTUAL_ENV_DISABLE_PROMPT=1.
Comment out this line.
Then it is running fine.

Same here. It works

@Lwjivd
Copy link

Lwjivd commented Feb 9, 2019

I encounter this because in ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh, it says export VIRTUAL_ENV_DISABLE_PROMPT=1.
Comment out this line.
Then it is running fine.

thanks, it work

@dritter
Copy link
Member

dritter commented Feb 9, 2019

That shouldn't be necessary any more, as we merged #1128 into master recently. There is no new version released yet, but will be soon. And if you installed P9K via git, you can pull the newest version including the fix..

amarth1982 pushed a commit to amarth1982/powerlevel9k that referenced this issue May 15, 2019
…and-rm

Specify `command rm` to bypass any aliases
@ghost
Copy link

ghost commented Jun 20, 2019

Hi again

Solved this for conda virtualenv. I followed #1019 and copied the prompt:

prompt_anaconda() {
  # Depending on the conda version, either might be set. This
  # variant works even if both are set.
  local _path=$CONDA_ENV_PATH$CONDA_PREFIX
  if ! [ -z "$_path" ]; then
    # config - can be overwritten in users' zshrc file.
    set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER "("
    set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER ")"
    "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON'
    py_version=$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
    "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$py_version $POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON'
  fi
}

Then added anaconda to the left / right prompt:
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs virtualenv anaconda)

This is the only thing that worked for me. Thanks @hududed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests