0

When I open a Gnome terminal in my Ubuntu 18 and execute the command ipython, I start an Anaconda IPython terminal version 5.8.0. Within Vim 8.1, that is what I also get if I first open a Vim terminal buffer with :term, navigate to the terminal and then execute the ipython command:

enter image description here

However, if instead I use the command :term ipython, I get a different non-Anaconda version of the IPython terminal:

enter image description here

Why would that be the case and how could one make sure that :term ipython gives the same version as is given by executing ipython on the terminal (in my case, the Anaconda one in the first picture)?

5
  • Could you please compare the output of :echo $PATH in Vim with the output of echo $PATH in the terminal opened via :term?
    – Ralf
    Jan 10, 2019 at 21:57
  • Do you have an alias for ipython in your shell config? Try type -a ipython in the shell window.
    – Ralf
    Jan 10, 2019 at 22:00
  • @Ralf echo $PATH indeed give different results and the anaconda2 path does not show up. I am opening Vim through a shortcut (gnome-terminal --command vim) and somehow this is making Vim to not get the system's PATH
    – FVb
    Jan 10, 2019 at 22:11
  • Guess you manipulate PATH in your shell setup (.bashrc). When you start gnome-terminal --command vim via desktop shortcut etc, no shell is involved, so the PATH is not changed. You could try gnome-terminal -x bash -c vim.
    – Ralf
    Jan 10, 2019 at 22:23
  • @Ralf Yeap, I immediately noticed that. See the answer that I posted.
    – FVb
    Jan 10, 2019 at 22:28

1 Answer 1

0

Thanks to @Ralf's comment to my question, I was able to identify that within Vim the system's $PATH did not contain Anaconda2's path.

This appears to happen because when Anaconda2 is installed, by default its path gets added to the .baschrc file, but that only affects whatever is opened via bash terminal - and I was opening Vim via a Desktop shortcut to Gnome-terminal.

Hence, a simple solution is to add Anaconda2's path to the Profile system's $PATH variable. To do that, open your profile:

gedit ~/.profile

Add a line to the file like the following (but of course substituting with your own Anaconda2's path):

PATH="/home/username/Programs/anaconda2/bin:$PATH"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.