pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

pyenv-virtualenv: prompt changing not working for fish

Open aronla opened this issue 4 years ago • 9 comments

Hi! I'm using fish and I'm running into the above message when I do pyenv activate my_venv. If I do source .../my_venv/activate.fish the prompt shows up so it doesn't look as if it should be impossible to get the same to work with pyenv activate.

This issue is very related/the same as the stale https://github.com/pyenv/pyenv-virtualenv/issues/284

Thank you, and thanks for a great project!

aronla avatar May 11 '21 06:05 aronla

@aronla what message are you seeing?

agoose77 avatar May 13 '21 07:05 agoose77

@agoose77 I get the following:

> pyenv activate myenv pyenv-virtualenv: prompt changing not working for fish >

However, when sourcing activate.fish for the env, I get a prompt as expected: myenv >

aronla avatar May 13 '21 08:05 aronla

I'm also having this issue

bbeaudreault avatar Jun 04 '21 17:06 bbeaudreault

I am having this issue as well

MSDuncan82 avatar Jun 05 '21 14:06 MSDuncan82

It seems like prompt changing will be removed from future release too, I don't know why this is the case.

https://github.com/pyenv/pyenv-virtualenv/blob/294f64f76b6b7fbf1a22a4ebba7710faa75c21f7/bin/pyenv-sh-activate#L214-L234

yochem avatar Jun 18 '21 10:06 yochem

Most probably, Virtualenv didn't support Fish when this code was written but now, it does. So feel free to submit a PR.

native-api avatar Oct 08 '21 00:10 native-api

As a workaround, I have added to my config.fish to disable the message:

set -gx PYENV_VIRTUALENV_DISABLE_PROMPT 1

and in my fish_prompt function I use

set pyenv_version (pyenv version-name | string split ':')

and use $pyenv_version to display the active version in the prompt.

ian-h-chamberlain avatar Jan 20 '22 16:01 ian-h-chamberlain

Hi, is this latest comment the solution?

  • I installed fish and omf and the pyenv integration and there is no promt, which for me is typical when developing in Python.

  • I hovered around SO and several open/closed issue threads and still not sure why prompt showing was removed or how to bring it back.

Is the right solution to copy paste the above code? Is there something else?

image

petroslamb avatar May 21 '22 08:05 petroslamb

For what it's worth, the following out-of-the-box prompts will display the current virtualenv (select them with the fish_config command):

  • Disco
  • Nim
  • Simple Pythonista

EDIT: Or just use https://github.com/IlanCosman/tide

jnns avatar Oct 08 '23 12:10 jnns