Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 2 tasks
jakebrinkmann opened this issue Sep 29, 2020 · 3 comments
Open
1 of 2 tasks

Comments

@jakebrinkmann
Copy link

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):

  • OS: Ubuntu 20.04.1 LTS
  • neoterm commit master/807a94f746bac2ab328dc22e6ca88bd411283cc8
  • Add all the configuration you have for neoterm
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
    • 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
Copy link
Owner

kassio commented Oct 2, 2020

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

@even4void
Copy link
Contributor

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
Copy link

xarthurx commented Apr 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants