neoclide / coc-python

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

Failed to detect/use Conda env python #89

Open number5 opened 5 years ago

number5 commented 5 years ago

Expected:

What happened:

Steps to reproduce:

Possible related https://github.com/microsoft/vscode-python/issues/4434

physicistgeng commented 5 years ago

same issue, anyone can fix this?

deto commented 5 years ago

Similar issue, but working very strange for me. I have conda installed in two places on my system, but only one is on the path. Yet, somehow the python interpreter from the other install is being set as the default. This is not the interpreter that running python will launch (again, not on my path) and so I'm not even sure how coc-python (or vscode-python) is finding it.

I'd advocate for the default behavior being to use whatever interpreter is in front on the path.

Edit: Actually looks like the rules are defined here:

https://github.com/neoclide/coc-python/blob/a5ae8d6bf781ee00ceeef14bb129180c13415ff4/src/interpreter/autoSelection/index.ts

Though I'm still not sure why mine was being selected this way. I don't have an interpreter in my coc-settings.json files and I don't have a workspace set up (no .vscode directory where I'm working). Seems to point to either a bad interpreter being cached (does the cache persist across closing/opening nvim?) or maybe a poor setting for the globally preferred interpreter (where is this defined?)

astier commented 4 years ago

I would also prefer if coc-python would use the interpreter of the currently activated conda environment. Maybe a setting could be useful which could be set to define if one prefers the conda-interpreter or the interpreter which is set by coc.

znculee commented 4 years ago

Duplicated with https://github.com/neoclide/coc-python/issues/55