Closed SimFG closed 2 months ago
how do u set up your python env? did u enter the venv before opening any file in nvim?
@CharlesChiuGit i had done it.
did mason.log suggest anything?
where is the mason.log
@SimFG
where is the
mason.log
Use :MasonLog
https://github.com/williamboman/mason.nvim?tab=readme-ov-file#commands
@CharlesChiuGit sorry for the late reply
hmmm, seems normal in mason.log
u r sure 'pynvim' is installed in current python env? or u installed in the global python?
@CharlesChiuGit i have install the pynvim
in the current python env.
but in the global python, i don't.
i install the pynvim
in the global env, it doesn't take effect.
hmmm, i'm not sure why.
Mine works fine.
Env info: OS: macOS 14.4.1 python: 3.12.3 neovim: NVIM v0.10.0-dev-2560+gf879a6545-Homebrew nvimconfig: https://github.com/CharlesChiuGit/nvimdots.lua (my personal config, but it should perform the same on most part.)
Can't repro for me too. Try using pyright
?
:MasonInstall pyright
and MasonUninstall pylsp
@ayamir I tried executing them, but it still doesn't work
Not exactly a Python expert, but a skim through the docs seems to suggest that pyright/pylsp has a pretty robust venv detection regime. AFAIU to fix this issue, u could create a pyrightconfig.json
in ur project's root directory and drop in this (correct me if I'm off base lol):
{
"venv": "<name-of-the-venv>"
"venvPath": "/path/to/venv",
}
If that tweak does the trick (with pyright
), it's likely because pylsp's getting mixed up about where to look for venvs (it's only checking out the dirname of these items). So, to sort this out right, u might need to tweak its config to point straight to the files in ur project root.
@CharlesChiuGit When i uninstall the pylsp, and close the nvim. and then open the nvim, it auto install the pylsp and doesn't seem to use the pyright
u install/uninstall pylsp in your venv? no need at all. mason install all lsp in it's own venv. check mason's help for more info. it's usually in "~/.local/share/mason"
u also need to disable pylsp in "lua/core/settings.lua" and config pyright .
check our wiki on how to do it.
No matter what I try, nothing seems to work. 😥
https://github.com/ayamir/nvimdots/wiki/Usage#modify-lsps-linters-and-formatters
@SimFG or just remove it in core/settings.lua
temprarily.
Actually I also want to know basedpyright whether is good enough to replace pylsp as @CharlesChiuGit mentioned in #1172.
so so so so ... god 😵💫
hmmm, it got me thinking maybe the error is from jedi-lsp
or other linter/formater u config in null-ls
plz make sure your env is 100% the same as our default config, otherwise we cant debug.
there are all my diff. and i use the conda
to manage the python environment.
Try :MasonUninstallAll
and open nvim again too reinstall all lsp in the config.
Also screenshot :NullLsInfo
and check what linter you have installed.
u can also use :Trouble
to check which lsp is generating the warnings.
@CharlesChiuGit after reinstall all lsp, it seem to work fine. But it seems that *
can't recognize it. I don't know if it's normal.
that's 100% normal since it's not the pythonic way to do import
and it's unsafe.
it's better to only import the things u need.
So can u show us what's your :LspInfo
and :NullLsInfo
now?
@CharlesChiuGit @ayamir Thanks a lot lot lot !!!
:LspInfo
:NullLsInfo
yeah, it looks like jedi-lsp
's or null-ls
linter's issue.
Version confirmation
Following prerequisites
Not a user config issue
Neovim version
v0.9.5
Operating system/version
macOS 13.0.1
Terminal name/version
iterm2 Build 3.4.15
$TERM environment variable
No response
Branch info
main (Default/Latest)
Fetch Preferences
SSH (use_ssh = true)
How to reproduce the issue
when i open my python project, but there are many import error. what should i do to solve it? thanks a lot for your help and precious time. i have install the![image](https://github.com/ayamir/nvimdots/assets/21985684/a899fd80-ffe5-4ede-bd54-9b4b5063fe2c)
pvnivm
for the python.Expected behavior
there is no import error
Actual behavior
No response
Additional information
No response