neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
574 stars 51 forks source link

Doesn't find virtual environment #101

Open blasco opened 5 years ago

blasco commented 5 years ago

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

Gee19 commented 5 years ago

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"
blasco commented 5 years ago

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

Screenshot_2019-10-19_20-51-13

maxmanders commented 4 years ago

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.

kevr commented 3 years ago

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.