Closed IamGianluca closed 4 years ago
I have the same problem, it can't automatically activate the virtual environment related to your project now. If you want to do that, you need to specify python.venvPath
or python.venvFolders
(If these don't work, you even need to specify python.pythonPath
), which is not convenient for me.
I chose another way. And I don't want the virtual environment of the project to be placed outside the project (that is not very manageable for me when debugging are needed...)
In fact, you can let poetry
generate virtualenv folder(.venv/
) in your project folder, and it works well. As the poetry
doc says:
$ poetry config virtualenvs.in-project true --local # remove "--local" will set global
https://python-poetry.org/docs/configuration/#virtualenvsin-project-boolean
Thank you @StrayDragon, it works!
What I've done is ad the poetry venv location to the coc settings json file,
"python.venvPath": "~/Library/Caches/pypoetry/virtualenvs/"
(note that this is on a mac, your location can be different)
and then I could select the correct env with :CocCommand python.setInterpreter
I still thing this coc-python should correctly handle all of this with proper poetry integration, or maybe ad it's defaults to the default configuration, or have a poetry flag that would try to use poetry to figure out the correct venv.
This problem is tracked by this issue on the original repository.
One of the development team mentioned a workaround there.
Hi,
How can I tell
coc-python
that I want to use the virtual environment created bypoetry
for a specific project?I've tried to set the parameter
python.poetryPath
incoc-settings.json
but it doesn't seem to do anything. Below is a copy of mycoc-settings.json
for this specific Python project.