linux-cultist / venv-selector.nvim

Allows selection of python virtual environment from within neovim
MIT License
470 stars 44 forks source link

[BUG] Error executing Lua callback: .../nvim/lazy/venv-selector.nvim/lua/venv-selector/venv.lua:186: bad argument #1 to 'spawn' (string expected, got nil) #176

Closed DWarez closed 1 month ago

DWarez commented 1 month ago

Hello, I just installed this plugin but it doesn't seem to work. Whenever I invoke ``:VenvSelect", I get the following error message:


Error executing Lua callback: .../nvim/lazy/venv-selector.nvim/lua/venv-selector/venv.lua:186: bad argument #1 to 'spawn' (string expected,
 got nil)
stack traceback:
        [C]: in function 'spawn'
        .../nvim/lazy/venv-selector.nvim/lua/venv-selector/venv.lua:186: in function 'find_parent_venvs'
        .../nvim/lazy/venv-selector.nvim/lua/venv-selector/venv.lua:40: in function 'load'
        ...azy/venv-selector.nvim/lua/venv-selector/mytelescope.lua:185: in function 'open'
        .../nvim/lazy/venv-selector.nvim/lua/venv-selector/init.lua:51: in function <.../nvim/lazy/venv-selector.nvim/lua/venv-selector/ini
t.lua:50>

Then a Telescope window opens but I cannot search into it and nothing appears on the list, as in the picture below:

image

I have installed the plugin using LazyVim, as follows:

return {
  'linux-cultist/venv-selector.nvim',
  dependencies = { 'neovim/nvim-lspconfig', 'nvim-telescope/telescope.nvim', 'mfussenegger/nvim-dap-python' },
  opts = {
    -- Your options go here
    -- name = "venv",
    -- auto_refresh = false
  },
  event = 'VeryLazy', -- Optional: needed only if you want to type `:VenvSelect` without a keymapping
  keys = {
    -- Keymap to open VenvSelector to pick a venv.
    { '<leader>vs', '<cmd>VenvSelect<cr>' },
    -- Keymap to retrieve the venv from a cache (the one previously used for the same project directory).
    { '<leader>vc', '<cmd>VenvSelectCached<cr>' },
  },
}

Any help is appreciated, thanks!

DWarez commented 1 month ago

solved, I was missing fd. Just install it: sudo pacman -S fd and everything should work fine.

linux-cultist commented 1 month ago

Yeah but I also noticed you are using the very old main branch. :) You should try the regexp branch instead that has tons of updates and allows you to make your own searches if needed.

Also it will find your venvs automatically in most cases without any config.

DWarez commented 1 month ago

Yeah but I also noticed you are using the very old main branch. :) You should try the regexp branch instead that has tons of updates and allows you to make your own searches if needed.

Also it will find your venvs automatically in most cases without any config.

I modified my nvim config but I still get the warning of using an older version. How can I know if I'm using the new one? Should I run some command to remove the old plugin and install the new one?

linux-cultist commented 1 month ago

You can switch to the regexp branch in the github repo and follow instructions for installing, but I can link it here as well:

https://github.com/linux-cultist/venv-selector.nvim/tree/regexp

And just remove your old config. :) The new version is a rewrite from scratch to deal with all kinds of issues that were hard to fix without rewriting it. It has its own settings and options as you see in the Readme.

Good luck and hope it works well for you.