Closed polo871209 closed 1 month ago
Hi,
Try adding enable_debug_output = true
to the settings and restart neovim. When you use the plugin, you will see a lot of messages in neovim. Type :messages to see it all. And post it here, and we can see if there are any clues. :)
VenvSelect:
{
anaconda = {},
anaconda_base_path = "/opt/homebrew/Caskroom/miniconda/base",
anaconda_envs_path = "/opt/homebrew/Caskroom/miniconda/base/envs",
auto_refresh = true,
cache_dir = "/Users/polo/.cache/venv-selector/",
cache_file = "/Users/polo/.cache/venv-selector/venvs.json",
changed_venv_hooks = { <function 1>, <function 2>, <function 3>, <function 4> },
dap_enabled = false,
enable_debug_output = true,
hatch_path = "~/Library/Application/Support/hatch/env/virtual",
name = "venv",
notify_user_on_activate = true,
parents = 2,
pdm_path = "~/.local/share/pdm/venvs",
pipenv_path = "~/.local/share/virtualenvs",
poetry_path = "~/Library/Caches/pypoetry/virtualenvs",
pyenv_path = "~/.pyenv/versions",
search = true,
search_venv_managers = true,
search_workspace = true,
venvwrapper_path = "~/.virtualenvs"
}
VenvSelect: Setting fd_binary_name to 'fd' since it was found on system.
VenvSelect: Telescope path: /Users/polo
VenvSelect: Looking for parent venvs in '/' using the following parameters:
VenvSelect:
{ "--absolute-path", "--color", "never", "-E", "/proc", "-HItd", "^venv$", "/" }
VenvSelect: Found venv in parent search: /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/venv/
VenvSelect: Found venv in parent search: /opt/homebrew/Caskroom/miniforge/base/envs/ultron/lib/python3.12/venv/
VenvSelect: Found venv in parent search: /usr/local/mysql-shell-8.0.33-macos13-arm64/lib/mysqlsh/lib/python3.10/venv/
VenvSelect: Found venv in parent search: /opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/venv/
VenvSelect: Found venv in parent search: /opt/homebrew/Caskroom/miniforge/base/pkgs/python-3.12.3-h4a7b5fc_0_cpython/lib/python3.12/venv/
VenvSelect: Found venv in parent search: /opt/homebrew/Caskroom/miniforge/base/pkgs/python-3.10.14-h2469fbe_0_cpython/lib/python3.10/venv/
VenvSelect: Found venv in parent search: /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/venv/
VenvSelect: Found venv in parent search: /System/Volumes/Data/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/
VenvSelect: Found venv in parent search: /System/Volumes/Data/usr/local/mysql-shell-8.0.33-macos13-arm64/lib/mysqlsh/lib/python3.10/venv/
VenvSelect: Found venv in parent search: /System/Volumes/Data/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/venv/
...
Seems like it does found the env, but does now show in the result?
@linux-cultist I think it's because of my telescope config
Also my conda env are listing the wrong path (which not even exist) /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/venv/
I think i will start by only using poetry and only create .venv in the project dir, that will be a easy fix for me, thanks!
You can try the regexp branch of the plugin I'm working on too. The current code has grown quite complicated because it was never intended to support all those venv managers from the start, so there is a lot of conditional statements and complicated logic in the current code base. And bugs too.
The rewrite in the regexp
branch is quite different since it's designed from the start to support your own queries if the built in ones are not finding things. And it's a lot simpler code because it doesn't try to guess what you want. :)
You can try that branch if you want. It's using a different much simpler config too.
Here is an example if you want to try the regexp
branch:
Configuration for lazy.nvim:
return {
"linux-cultist/venv-selector.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap-python", --optional
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
},
lazy = false,
branch = "regexp", -- This is the regexp branch, use this until its merged with the main branch later
config = function()
require("venv-selector").setup()
end,
keys = {
{ ",v", "<cmd>VenvSelect<cr>" },
},
},
The plugin will look in /opt/anaconda/bin
and ~/.conda/envs
for python venvs automatically but if you have them in another location, you can create two searches that replaces the build-in ones:
require("venv-selector").setup {
settings = {
search = {
anaconda_envs = {
command = "fd bin/python$ ~/.conda/envs --full-path --color never -E /proc" -- change path here to your anaconda envs
},
anaconda_base = {
command = "fd /python$ /opt/anaconda/bin --full-path --color never -E /proc", -- change path here to your anaconda base
},
},
},
}
Just run the fd
commands on the command line first to make sure they list only your python venvs, otherwise you have to slightly change the regexp or alter the fd command to exclude paths. The end result needs to be absolute paths to pythons:
/home/cado/.conda/envs/conda1/bin/python
/opt/anaconda/bin/python
Im closing this since its probably a telescope configuration issue but hope you try the new version. It just works a lot better. :)
Hi I am still new to NeoVim sorry if I asked sth very stupid
here are my setting plugin inside lazyvim on mac
this config are copy from official docs
i have fd install on my machine with
brew install fd
I tried many different config but still end up with nothing
even if I create .venv directly under the current dir, still there is nothing showing up. Please help me with my config or is there more example.