How to configure eglot to detect automatically the current running Python virtual environment? #1334
Replies: 1 comment
-
This means it's probably not seeing the But you probably don't want to do that.
Eglot absolutely does not have an Python interpreter. In fact Eglot know next to 0 about Python or any language. But if you want Eglot (and generally Emacs) to work correctly for Python projects that depend on a virtual environment, my recommendation is to use something like https://github.com/porterjamesj/virtualenvwrapper.el. After installing it, I use |
Beta Was this translation helpful? Give feedback.
-
Hello
I use
Emacs 29.1
andPython 3.12.0
. So far, I have been usingelpy
in Emacs for Python development but given the project is no more maintained by its main developer, I switched toeglot/LSP
and currently I am learning how to configure my environment. By watching a few YouTube tutorials and also instructions available in the documentation of Python LSP Server, I managed to make work most of the things that I need on a daily basis.However, I think that
eglot
has its own Python interpreter (or maybe even a virtual environment as I still don't know in details how it functions). For example, I have a running virtual environment in my terminal based on Python 3.12.0. Within the very same terminal running this virtual environment, I run Emacs in background. But if I start a Python process inside Emacs, it runs on Python 3.9. Therefore, it seems to me that eglot ignores my current running virtual environment.I would like to know whethere there is any configuration to add to my Emacs init file to force eglot to take into account the current running Python virtual environment as the only and single environment (and also interpreter) for Python.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions