coc-python icon indicating copy to clipboard operation
coc-python copied to clipboard

Doesn't find virtual environment

Open blasco opened this issue 4 years ago • 4 comments

I've created a venv in ~/projects/my_project/test_venv with:

cd ~/projects/my_project python -m venv test_venv

I've tried setting:

python.venvFolders: ["/home/username/projects/my_project/test_venv"], python.venvPath: ["/home/username/projects/my_project/test_venv"],

in my cocconfig. But when I run the coccommand python.setIntepreter, the venv doesn't appear in the list. How is this supposed to work? Thank you in advance for the advice

blasco avatar Oct 05 '19 22:10 blasco

Try setting the python path in ~/projects/my_project/.vim/coc-settings.json, also confirm you aren't overriding it globally in ~/.config/nvim/coc-settings.json or ~/.vim/coc-settings.json

"python.pythonPath": "~/projects/my_project/test_venv/bin/python"

Gee19 avatar Oct 10 '19 04:10 Gee19

Now it appears when doing :CocCommand python.setInterpreter, but gives the following error when choosing it:

Screenshot_2019-10-19_20-51-13

blasco avatar Oct 19 '19 18:10 blasco

I've tried all manner of tweaks (both general, and hacky project-specific) in vimrc and coc-settings. No amount of pointing at venv (pipenv) specific paths seems to help - I still see pylint errors about packages that can't be found.

maxmanders avatar Nov 19 '19 10:11 maxmanders

I've tried all manner of tweaks (both general, and hacky project-specific) in vimrc and coc-settings. No amount of pointing at venv (pipenv) specific paths seems to help - I still see pylint errors about packages that can't be found.

In particular, these coc-settings.json keys helped me fix my linting issues:

"python.pythonPath": "/path/to/my/virtualenv/bin/python"

"python.globalModuleInstallation": true

You should mess around more, because these settings actually do fix the issues for users.

kevr avatar Dec 19 '20 02:12 kevr