How can I show pyenv version in my bash shell - pyenv

What is an easy way to show which pyenv version I am in, in my bash shell prompt?
When using ananconda, showing which conda environment is automatic with this between ()
How can I get something similar with pyenv?

Related

powershell and conda: conda activate env returns command not found

I have pip installed powerline-shell in my base conda env. Switching envs yields the following error:
conda activate <env_name>
-bash: powerline-shell: command not found
I also tried running conda init powershell but it took no actions.
I have miniconda3, with conda 4.7, installed on MacOS Mojave.
I don't know a simple solution to this. I'm thinking you either need to install it in every env (which I don't recommend because it's best to avoid using pip in Conda) or you create a link to the powerline-shell binary in another location that you can keep on PATH to avoid adding the entire miniconda3/bin/ directory to PATH. I've done something like this in the past, but never with a Python entry point before.
I'd try something like
mkdir -p ~/.local/bin
ln -s /your/path/to/miniconda3/bin/powerline-shell ~/.local/bin/powerline-shell
Then add .local/bin to PATH in your .bashrc, probably toward the beginning (e.g., before the Conda section). The path here (~/.local/bin) is totally arbitrary, so adjust to your preferences. Main point is to minimize what you are exposing globally in a shell session.
Note: conda init powershell is for Windows PowerShell users.

Multiple .bash_profiles on mac osx

I'm taking a course on mongodb where I have to install the mongo shell on my mac. In order to run the mongo shell, I had to change the PATH in .bash_profile. The thing is I had anaconda installed and the bash profile for conda (which I overwrote for the mongo shell). So now, my conda prompt is not usable. I created a local conda environment where I can install some python dependencies I need, but for some reason, I can't execute conda commands in the folder I created the local environment for. I keep getting a 'command not found' response. I know for sure the conda environment was activated because its listed in my anaconda navigator.
Any ideas?

Fish can't execute anything on my machine without python3

I have an issue with my fish shell when using pyenv with Python2 activated:
$ pyenv shell 2.7.14
$ ls
pyenv: python3: command not found
The `python3' command exists in these Python versions:
3.6.4
It seems like even when I execute a command as simple as ls / cat / etc, something is calling Python 3. I never get a similar issue without pyenv removing access to Python 3.
How can I find out what is calling Python 3? I've tried clearing my config.fish file, but this problem still occurs
This might be triggered by autocompletion. From the README section on optional dependencies:
automated completion generation from manual pages requires Python 3.5+
the fish_config web configuration tool requires Python 3.5+ and a web browser

Using conda environment in IPython interactive shell

I am trying to use the interactive shell of IPython within my conda env and am having issues.
The steps I take are:
source activate myenv
conda install ipython
ipython
When I am in ipython interactive shell, it calls python from the anaconda root bin. (~/anaconda2/bin')
Is there anything I can do to change the python path to ~/anaconda2/envs/myenv/bin and import packages from myenv?
I see few solutions to making env work in jupyter when I search the web, but no answer on making it work on the interactive shell.
This is likely due to your $PATH variable being messed up.
THe easiest way to make sure you get IPython from within an env is to use $ python -m IPython <rest of the options> to start IPython. This works for many of the Python installable application; like pytest, pip and other.

Configure Eclipse to use bash login shell for Cygwin toolchain

I have a custom Makefile project in Eclipse and although the build does get run in a Cygwin shell... it does not seem to be a login shell (bash --login) as it doesn't set my environment variables like running cygwin.bat does.
Where in Eclipse can I change the shell command so that it will be a login shell?
What you actually aim with bash --login are your settings from /etc/profile.
Under UNIX you normally have only one login shell and so these settings are inherited by all other shells. Under Windows any Bash window is an isoloated login shell, which leads to missing environment settings when running Bash from tools that run bash simply as command processor.
I had a similar problem with Emacs compile feature. The best solution under Windows is to set the environment variable BASH_ENV to a script. Bash will execute this script when started without -i or --login, so that /etc/profile is not run. Hence the script will setup Bash for non-interactive, non-login shells.
Example:
BASH_ENV=%USERPROFILE%\.bash_env
as user environment variable. The least thing to do in this script is to set PATH as in /etc/profile:
PATH="/usr/local/bin:/usr/bin:${PATH}"
Check the path-settings in /etc/profile as it is created by Cygwin's setup.exe. You may also copy settings from ~/.bashrc or source this script.
Hope this helps.