oh-my-bash icon indicating copy to clipboard operation
oh-my-bash copied to clipboard

virtualnev name not showing.

Open pradhanvickey opened this issue 3 years ago • 8 comments

Hi - I can just see my python version of virtual env not the virtual env name. Please let me know who to fix it. and i want to print virtualenv name to the right side. Is it possible?

image

pradhanvickey avatar Mar 30 '21 13:03 pradhanvickey

@pradhanvickey, I have the same issue. Were you able to find a solution somehow?

eusojk avatar Jun 30 '21 14:06 eusojk

I found that powerline series themes can show conda virtual environment name. But the default theme "font" can't. I think there may be some bugs in function virtualenv_prompt which font theme uses. Powerline theme use the function __powerline_python_venv_prompt defined by itself. So there may be something about $VIRTUAL_ENV.

I'm not good at bash shell script. If I have some wrong, please correct me.

shelfofclub avatar Sep 08 '21 08:09 shelfofclub

I created this PR to show Virtual Env on the Sirup theme: https://github.com/ohmybash/oh-my-bash/pull/335

It's just needed to be approved and merged or you guys can just check the code and replace it directly in your environment. For me, it's working now.

juanswan13 avatar Jun 15 '22 00:06 juanswan13

I'm facing this problem with agnoster and powerline themes after an OS update, this wasn't the behavior in previous versions, why did they change it? I don't find it clearly how to fix it following @juanswan13 example to be honest.

joaco18 avatar Jul 10 '22 06:07 joaco18

@joaco18

Q1. Which problem are you facing? Actually, it seems to me that people are talking about several different problems in this single issue. For example,

  • OP is talking about the problem that the Python version is shown instead of the path
  • I think I have seen a problem that virtualenv or other information is shown in black letters on a black background so it appears as a blank area of finite width.
  • Or, it might be the problem that the area of the virtualenv information is not shown.
  • Another possibility is just that the virtualenv is unsupported by the selected theme. @juanswan13 is providing the solution for the problem that the sirup theme does not show the virtualenv path simply because sirup does not support it. But, I don't think this applies to your case because agnoster and powerline themes seemed supposed to support it.

Q2. What is the result of the following command?

$ declare -p VIRTUAL_ENV

akinomyoga avatar Jul 10 '22 07:07 akinomyoga

Thanks @akinomyoga for your answer, you were right in deed, my comment was not useful at all.

My problem is this one:

"Or, it might be the problem that the area of the virtualenv information is not shown."

I'm using agnoster theme in a Ubuntu 22.04 OS. I'm using anaconda environments. For example I'm in base environment and the command line shows: jseia@petalo  ~ 

The output for: $ declare -p VIRTUAL_ENV is: bash: declare: VIRTUAL_ENV: not found Thanks for any help.

joaco18 avatar Jul 12 '22 05:07 joaco18

I'm using anaconda environments.

Ah, OK. So you are actually using "condaenv" instead of "virtualenv". I have checked agnoster, but agnoster only supports "virtualenv" but not "condaenv". Maybe you have switched from venv to conda when you updated the operating system? It seems #282 is an example to support "condaenv" in agnoster, though it seems to also contain unrelated style changes.

akinomyoga avatar Jul 12 '22 06:07 akinomyoga

I have rebased #282 and reverted unrelated changes.

akinomyoga avatar Jul 12 '22 06:07 akinomyoga