I'm trying to get Emacs to start ipython from Anaconda.
I have two systems which are not identical so figured setting symbolic links in
~/bin/ipython as I have
~/bin/ pre-pended to my
$PATH would do the trick. It works on one system no problem but on the other no joy.
~/.emacs.d/settings/python-settings.el (sourced from
;; PYTHON CONFIGURATION ;; -------------------------------------- (elpy-enable) ;; Set ipython as the default interpreter (setq python-shell-interpreter "~/bin/ipython" python-shell-interpreter-interactive-args "-i --simple-prompt") ;; use flycheck not flymake with elpy (when (require 'flycheck nil t) (setq elpy-modules (delq 'elpy-module-flymake elpy-modules)) (add-hook 'elpy-mode-hook 'flycheck-mode)) ;; Try to add pylint rules https://emacs.stackexchange.com/a/41048/10100 (add-hook 'python-mode-hook (lambda () (setq flycheck-python-pylint-executable "~/.local/bin/pylint") (setq flycheck-pylintrc "~/.emacs.d/settings/.pylintrc"))) ;; enable autopep8 formatting on save (require 'py-autopep8) (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
When I try to run
M-x run-python I get...
Searching for program: No such file or directory, \~/bin/ipython
..and yet at a terminal it is found and works...
$ which ipython /firstname.lastname@example.org/bin/ipython $ ls -l ~/bin/ipython lrwxrwxrwx 1 neil.shephard domain users 77 Aug 7 09:51 /email@example.com/bin/ipython -> /firstname.lastname@example.org/share/anaconda3/bin/ipython3 $ ipython Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51) Type 'copyright', 'credits' or 'license' for more information IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help. In :
It looks like the
~ is escaped and not interpreted correctly so I've tried with both an explicit path to the target of the symbolic link with...
(setq python-shell-interpreter "/email@example.com/share/anaconda3/bin/ipython" python-shell-interpreter-interactive-args "-i --simple-prompt")
...which results in...
/usr/bin/emacs: /home/slackline\@mywork.com/share/anaconda3/bin/ipython: No such file or directory Process Python exited abnormally with code 127
...and the following under
Warning (python): Python shell prompts cannot be detected. If your emacs session hangs when starting python shells recover with ‘keyboard-quit’ and then try fixing the interactive flag for your interpreter by adjusting the ‘python-shell-interpreter-interactive-arg’ or add regexps matching shell prompts in the directory-local friendly vars: + ‘python-shell-prompt-regexp’ + ‘python-shell-prompt-block-regexp’ + ‘python-shell-prompt-output-regexp’ Or alternatively in: + ‘python-shell-prompt-input-regexps’ + ‘python-shell-prompt-output-regexps’
...which is a bit closer but iPython isn't starting under Emacs. I suspect it may have something to do with the weird
@ in the path of my home directory but am unsure why
"~/bin/ipython" is not correctly recognised under Emacs when it is from the command line.
Any suggestions as to whats going on and how to resolve them would be very welcome.