Discussion:
[conda] Using Jedi from Emacs in a Conda world
Skip Montanaro
2018-09-11 21:18:41 UTC
Permalink
I'm trying to get Jedi running in Emacs in a Conda environment. I
installed the jedi package into my Conda environment, and bunch of
elpa/melpa packages in Emacs (jedi, anaconda-mode, bunch of
dependencies).

Whenever I try to execute jedi:install-server it keeps telling me the
virtualenv command can't be found. I was using a non-Conda instance
of Emacs 25.1 That failed, so I installed the 25.3 Emacs package. I
get the same result. (I also tried 26.1, but didn't even get that far
- what happened to the mode line?)

Is there some magic necessary to get this to work when Conda is the
virtual environment manager?

Thx,

Skip Montanaro
--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+***@continuum.io.
To post to this group, send email to ***@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/CANc-5Ux%2BoepMNbR9s-uqG1PdiHAv%3DvJQ6MHE%3DWx%3DQpQdRhhatA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
Thomas Caswell
2018-09-12 13:15:40 UTC
Permalink
Skip,

I have this working, but it is a tad finicky. What I do is:

1) tell conda to put it's envs in ~/.virtualenvs (because I knew how to
configure conda better than pyvenv (and predecessors))
2) install pyvenv and elpy
3) have the following in my .emacs (some of which may redundant around
convincing IPython to not try to use prompt toolkit inside of the emacs
terminal emulator):

(setenv "IPY_TEST_SIMPLE_PROMPT" "1")

(pyvenv-workon "dd37")
(elpy-enable)
(setq python-shell-interpreter "jupyter"
python-shell-interpreter-args "console --simple-prompt")
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt")
(setq elpy-rpc-backend "jedi")
(add-to-list 'python-shell-completion-native-disabled-interpreters
"ipython")
(add-to-list 'python-shell-completion-native-disabled-interpreters
"jupyter")



Hope that helps!

Tom
Post by Skip Montanaro
I'm trying to get Jedi running in Emacs in a Conda environment. I
installed the jedi package into my Conda environment, and bunch of
elpa/melpa packages in Emacs (jedi, anaconda-mode, bunch of
dependencies).
Whenever I try to execute jedi:install-server it keeps telling me the
virtualenv command can't be found. I was using a non-Conda instance
of Emacs 25.1 That failed, so I installed the 25.3 Emacs package. I
get the same result. (I also tried 26.1, but didn't even get that far
- what happened to the mode line?)
Is there some magic necessary to get this to work when Conda is the
virtual environment manager?
Thx,
Skip Montanaro
--
You received this message because you are subscribed to the Google Groups
"conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/conda/CANc-5Ux%2BoepMNbR9s-uqG1PdiHAv%3DvJQ6MHE%3DWx%3DQpQdRhhatA%40mail.gmail.com
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+***@continuum.io.
To post to this group, send email to ***@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/CAA48SF8dZbFAbm%2B5nD04Ux9Gq-tJ%2BLBXwT7fH%3DKGScQdrnypyg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
Skip Montanaro
2018-09-14 20:10:47 UTC
Permalink
Post by Thomas Caswell
(pyvenv-workon "dd37")
(elpy-enable)
(setq python-shell-interpreter "jupyter"
python-shell-interpreter-args "console --simple-prompt")
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt")
(setq elpy-rpc-backend "jedi")
(add-to-list 'python-shell-completion-native-disabled-interpreters "ipython")
(add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter")
Thanks, Tom. It took me a little while and empty searches of Conda and
PyPI packages before I realized that elpy and pyvenv where Emacs Lisp
packages. :dope slap:

I added the following to my .emacs file:

(setenv "WORKON_HOME" "/path/to/my/conda/env")
(pyvenv-workon "python3")
(elpy-enable)
(setq elpy-rpc-backend "jedi")

(I'm not a Jupyter/iPython user.) That seems to have done the trick.
When visiting a .py file, I now have three new toolbar items to
explore: "Virtual Envs", "Elpy", and "YASnippet". Emacs hasn't crashed
yet, so it must all be working as expected. *

Skip

* Any other Emacs old-timers here who recall a time when pressing C-g
twice in quick succession was how you coaxed Emacs into dropping a
corefile? I can't recall if that was GNU Emacs or Gosling Emacs. I
think it was before Lucid Emacs came and went.
--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+***@continuum.io.
To post to this group, send email to ***@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/CANc-5UwARLLQm4CsmeHJQh68g%3D%3DkT2%3DMe-YHD778qoecX6Ho%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
Loading...