kassio / neoterm

Wrapper of some vim/neovim's :terminal functions.
Other
1.31k stars 117 forks source link

Python REPL doesn't launch using expected config on Ubuntu 20.04 LTS #308

Open jakebrinkmann opened 4 years ago

jakebrinkmann commented 4 years ago

Describe the bug Ubuntu doesn't ship with python anymore, but ships with python3 so the check is_valid which evaluates executable('python') should possibly include executable('python3') or something.... (I think the way is_valid is handled is not very clear, although maybe it's the simplest way).

To Reproduce Steps to reproduce the behavior:

  1. verify python is not installed, but python3 is
  2. Opened a neoterm with :Ttoggle
  3. Try to send line to terminal :TREPLSendLine
  4. See E121: Undefined variable: g:neoterm_repl_command
  5. See E116: Invalid arguments for function join(g:neoterm_repl_command) =~# 'ipython'

Expected behavior Configuration according to https://github.com/kassio/neoterm/blob/master/doc/neoterm.txt#L272 should allow me to execute code in a REPL.

Screenshots/gifs N/A

Versions (Issues without this information will take longer to be answered/solved):

let g:neoterm_repl_python = \ ['source .virtualenv/bin/activate', 'python']

" This makes it "work": let g:neoterm_repl_command = add(g:neoterm_repl_python, '')


 - Vim or Neovim
   - [x] vim
   - [ ] neovim
 - Version [vim --version] `VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)`

**Additional context**
Hope I provided enough context. Awesome plugin. Thank you for your hard work. ♥
kassio commented 4 years ago

@incoggnito can you help me with this one, please?

even4void commented 3 years ago

On Ubuntu, you can define the default version of Python that is being used, and the path for the binary, using update alternative. For instance, to set Python 3.8.5 as the default interpreter when typing python at the prompt, run (as root):

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8.5 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7.1 2

The number you put at the rightmost position defines the priority of a specific version of Python if you have multiple versions installed on your OS. You can query the defaults using sudo update-alternatives --config python. Usually, a single symlink /usr/bin/python3 -> /usr/bin/python should do the trick, though, or you can use some convenience package.

An alternative for @kassio would be to rely on python3_host_prog, instead of plain hard coded executable('python'), provided it is defined using let g:python3_host_prog = '/usr/bin/python3' in (neo)vim init file, as expected.

Hope that helps.

xarthurx commented 2 years ago

Still have this issue after a fresh install.

vim: neovim 0.6.1 OS: Windows

  • Opened a neoterm with :Ttoggle
  • Try to send line to terminal :TREPLSendLine
  • See E121: Undefined variable: g:neoterm_repl_command
  • See E116: Invalid arguments for function join(g:neoterm_repl_command) =~# 'ipython'

I'm using conda env, but the error exists even in base environment.