can't seem to resolve reportMissingImports with coc-pyright on my python3.9 venv on neovim
See original GitHub issueHi, I recently switched to neovim from vim yesterday and installed coc-pyright with it since coc-python’s README recommended it, I have a python3.9 venv at /opt/, I have extensively searched through issues here and found #87 similar to my issue. I have even installed pynvim
in my venv with python -m pip install pynvim
and added this line in my neovim init.vim:
let g:python3_host_prog = '/opt/bin/python'
Here is my output of CocInfo
:
## versions
vim version: NVIM v0.4.3
node version: v15.5.0
coc.nvim version: 0.0.80-cf0e8400a4
coc.nvim directory: /home/ubuntu/.config/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux
## Log of coc.nvim
2021-01-01T06:53:11.766 INFO (pid:4799) [services] - registered service "eslint"
2021-01-01T06:53:11.841 INFO (pid:4799) [services] - registered service "pyright"
2021-01-01T06:59:31.454 INFO (pid:4907) [services] - Pyright Server state change: stopped => starting
2021-01-01T06:53:11.926 INFO (pid:4799) [plugin] - coc.nvim 0.0.80-cf0e8400a4 initialized with node: v15.5.0 after 316ms
2021-01-01T06:53:11.945 INFO (pid:4799) [language-client-index] - pyright started with 4920
2021-01-01T06:53:12.251 INFO (pid:4799) [services] - Pyright language server state change: starting => running
2021-01-01T06:53:12.260 INFO (pid:4799) [services] - service pyright started
2021-01-01T06:53:15.585 INFO (pid:4799) [attach] - receive notification: showInfo []
I have added pyrightconfig.json
on my venv root folder at /opt/
:
{
"include": [
"**/site-packages",
"**/cogs",
"**/core"
],
"exclude": [
"**/__pycache__"
],
"executionEnvironments": [
{
"root": "lib/python3.9/site-packages",
"pythonVersion": "3.9",
"pythonPlatform": "Linux"
}
],
"venvPath": "/opt",
"reportMissingImports": true,
"pythonVersion": "3.9",
"pythonPlatform": "Linux"
}
and here is my coc-settings.json
stored at ~/.config/nvim/
:
{
"python.pythonPath": "/usr/bin/python3.9",
"python.venvPath": "/opt/"
}
even with these settings, whenever I open any *.py
file, I get pyright showing warning about missing imports althought those packages are already present in my venv site-packages: /opt/lib/python3.9/site-packages
Is there anything I did wrong or I missed in these settings? I apologise for any inconvenience I’m still new with pyright, if someone can help me out I would be really grateful. 🙏🏼
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:15 (6 by maintainers)
Top GitHub Comments
@felippemr There is no setInterpreter command in coc-pyright.
It is recommended that you activate the virtual environment, then go to the project root and launch Vim/Neovim.
If you still cannot import correctly, place
pyrightconfig.json
in the project root and setttingvenvPath
andvenv
appropriately.Example: pyrightconfig.json
If the location of your virtual environment is
/path/to/projectroot/.venv
.I’m going to close this issue, open a new issue if you still has this error.