8000 Suddenly Cannot See the Python venv Segment · Issue #2866 · romkatv/powerlevel10k · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Suddenly Cannot See the Python venv Segment #2866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MintCider opened this issue May 28, 2025 · 4 comments
Closed

Suddenly Cannot See the Python venv Segment #2866

MintCider opened this issue May 28, 2025 · 4 comments

Comments

@MintCider
Copy link
MintCider commented May 28, 2025

I've been using p10k for months and it works always as expected. However, recently (maybe in one or two weeks?), I found it no longer showing python venv segment at the right.

I've checked a series of environmental variables like

❯ uv venv
Using CPython 3.11.11
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
❯ source .venv/bin/activate
❯ echo $VIRTUAL_ENV
/Users/<username>/temp/venv_test/.venv
❯ echo $VIRTUAL_ENV_PROMPT
(venv_test)
❯ echo $VIRTUAL_ENV_DISABLE_PROMPT

and as someone asked in #1763,

❯ typeset -pm 'VIRTUAL_ENV|POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV'
export VIRTUAL_ENV=/Users/<username>/temp/venv_test/.venv
typeset POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=true

I've also checked ~/.p10k.zsh and virtualenv is not commented out in the typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS.

Image

So any help or advice for this issue?

@romkatv
Copy link
Owner
romkatv commented May 29, 2025

What is the output of the following command when the virtual environment is active?

(
  eval "$__p9k_intro"
  _p9k_prompt_segment() { ; }
  setopt xtrace
  [[ -n $VIRTUAL_ENV ]] || return
  prompt_virtualenv
)

@MintCider
Copy link
Author
8000

Like this

❯ source .venv/bin/activate
❯ (
  eval "$__p9k_intro"
  _p9k_prompt_segment() { ; }
  setopt xtrace
  [[ -n $VIRTUAL_ENV ]] || return
  prompt_virtualenv
)
+-zsh:11> [[ -n /Users/<user>/temp/venv_test/.venv ]]
+-zsh:12> prompt_virtualenv
+prompt_virtualenv:1> [[ -n /Users/<user>/temp/venv_test/.venv && -n '' ]]
+prompt_virtualenv:3> [[ -n '' ]]
+-zsh:7> trap - INT

@romkatv
Copy link
Owner
romkatv commented May 30, 2025

Something in your zsh startup files (likely in ~/.zshrc or a file sourced from it) defines a function called prompt_virtualenv. This function overrides the one from powerlevel10k.

@MintCider
Copy link
Author

Checked. There is one. The segment is back after removing it. Thanks a lot for the help!

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

No branches or pull requests

2 participants
0