Closed febridev closed 5 months ago
If you are using Pyright
, Pylance
, or pylsp
, it should work out of the box. What error are you getting? What venv manager are you using?
after choose the venv I didn't get anything and library already install on venv still got error on current python file
What venv manager are you using?
What is your config?
@febridev, can you provide the info @mennohofste asked for?
I only using pip @mennohofste
this my config
local venv_status, venv_selector = pcall(require, "venv-selector")
if not venv_status then
return
end
venv_selector.setup({
dependencies = { "neovim/nvim-lspconfig", "nvim-telescope/telescope.nvim", "mfussenegger/nvim-dap-python" },
event = "VeryLazy",
})
venv_selector.get_active_path()
venv_selector.get_active_venv()
venv_selector.retrieve_from_cache()
pip
is a package manager, not a venv manager. How do you create virtual environments? What command do you run?
Furthermore, it seems you are using lazy.nvim; however, you are not calling the setup function correctly. The setup
function of venv-selector
does not have dependencies
, nor event
keys.
I think it is easiest if you read the README thoroughly, as well as the lazy.nvim documentation.
For reference, this is what a lazy.nvim configuration should look like:
return {
'linux-cultist/venv-selector.nvim',
dependencies = { 'neovim/nvim-lspconfig', 'nvim-telescope/telescope.nvim', 'mfussenegger/nvim-dap-python' },
config = function()
require('venv-selector').setup {
-- Your options go here
-- name = "venv",
-- auto_refresh = false
}
end,
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>' },
},
}
I using this command for create virtual env
virtualenv my-env
and for nvim I use .lua file
this issue already solved I reset my configuration on neovim + packer
on this hooks configuration that is optional or mandatory? because after switch vitrual env :VenvSelect my library still suggest error doesn't import