HallerPatrick / HallerPatrick/py_lsp.nvim

How to automatically use a conda environment?

Open
#42 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Lua
Stars
109
Forks
14
PR merge metrics
No merged PRs in 30d

Description

I am trying to automatically set a conda environment if a `.py` file is opened. I wonder if you can help me out. I tried the following
```
return {
"HallerPatrick/py_lsp.nvim",
config = function()
require('py_lsp').setup{
opts = {
host_python = "~/opt/anaconda3/envs/py12/bin",
auto_source = true,
language_server = "pyright",
source_strategies = "conda", -- "default", "poetry", "conda", "system",
default_venv_name = "py12"
}
}
end,
}
```
but it returns
```
Could not retrieve python path, try :PyLspReloadVenv
```
Then, if I do `:PyLspActivateCondaEnv`, then the cond environment is used in `lsp`, though `:checkhealth` shows
```
py_lsp: require("py_lsp.health").check()

py_lsp.nvim Report ~
- ERROR No client attached
- ERROR Setup is incorrect
```
How am I supposed to change the code to automatically set the conda environment. Thanks in advance.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.