New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
virtual environment #1707
Comments
That is fine.
|
Hello, Yes, you are right. There was a typo in the path. With this fixed, elpy still chooses python 2.7.10 as the python executable. I have all packages installed in py3env virtual environment (including black and jupyter). Here is the output of elpy-config. Any thoughts? Elpy Configuration Emacs.............: 26.3 The black package is not available. Commands using this will not work. |
Elpy is using a dedicated virtualenv ( If you want the RPC to use python3, you will need to use Everything should work fine, but if you really want to use the dependencies installed in your virtualenv ( |
Thanks! |
Summary
Virtual environment is not activated in Emacs
Steps to reproduce
My configuration
I have a working virtual environment created by
$ virtualenv py3env
in ~\pythonVirtualEnv folder. I can activated the environment in bash via source /bin/activate.
I have the following in a my emacs initialization file
(use-package elpy
:ensure t
:defer t
:init
(advice-add 'python-mode :before 'elpy-enable))
In a fresh emacs instance which runs the above code at its initialization step, when I run
$ echo $PATH in
eshell I do not see the path of my virtual environment in my $PATH. When I run
(pyvenv-activate "/home/naveed/pythonVirtualEnv/py3env")
in my scratch buffer again and get the echo of $PATH, I don't see any changes.
When I run pyvenv-activate interactively, I see "/home/naveed/pythonVirtualEnv/py3env//bin" is added to $PATH (note the two / before bin). Same observation applies to exec-path variable.
My main problem is that the instance of python invoked in emacs is not the one specified by the virtual environment. By reading some of the discussions on this page, I believe the problem is with my path variables. I would appreciate your help.
OS
macOS Mojave
emacs: 26.3 (9.0) [installed via brew]
Result of
(elpy-config)
Emacs.............: 26.3
Elpy..............: 1.31.0
Virtualenv........: py3env (/home/naveed/pythonVirtualEnv/py3env)
Interactive Python: jupyter (not found)
RPC virtualenv....: elpy-rpc-venv (/Users/naveed/.virtualenvs/elpy-rpc-venv)
Python...........: python 2.7.10 (/Users/naveed/.virtualenvs/elpy-rpc-venv/bin/python)
Jedi.............: 0.15.1
Rope.............: 0.14.0
Autopep8.........: 1.4.4
Yapf.............: 0.28.0
Black............: Not found (19.3b0 available)
Syntax checker....: Not found (flake8)
Elpy configuration in my init.el
(use-package elpy
:ensure t
:defer t
:init
(advice-add 'python-mode :before 'elpy-enable))
The text was updated successfully, but these errors were encountered: