millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 123 forks source link

Issues trying to get elpy to work correctly with emacs-ipython-notebook: #806

Closed zeta-00 closed 3 years ago

zeta-00 commented 3 years ago

Hello there, Looking at the faq section of this repo: https://github.com/millejoh/emacs-ipython-notebook#faq , It says that elpy is the official supported module for emacs-ipython-notebook, but I'm having trouble getting elpy to work with ein. Here's the link to the issue that I'm having, thanks in advance for the help!

https://www.reddit.com/r/emacs/comments/pe7c24/im_having_trouble_getting_the_elpy_python/

And, here's the elpy error that was thrown, and the .emacs config for ein :

Note: I'm currently running python version 3.9.6, but I don't think that has anything to do with this issue? I'm guessing that my issue has to do with this .emacs config?

` ein: [info] ein:jupyter-process-lines: jupyter exited with status 1

ein: [info] Login to http://127.0.0.1:8888 complete.

error in process sentinel: ein:insert-read-only: Wrong type argument: number-or-marker-p, t

error in process sentinel: Wrong type argument: number-or-marker-p, t `

`

;;-------------------------------------------------

(use-package company

:defer t)

;;-------------------------------------------------

(use-package ein

:defer t

:config

(add-hook 'ein:notebook-mode-hook 'jedi:setup)

(add-hook 'ein:connect-mode-hook 'ein:jedi-setup)

(setq ein:polymode t)

(setq ein:use-auto-complete t)

(setq ein:use-smartrep t)

:custom

(ein:completion-backend 'ein:use-ac-backend)

(ein:completion-backend 'ein:ac-jedi-backend)

;; (ein:completion-backend 'ein:use-jedi-backend)

(ein:completion-backend 'ein:use-company-backend)

;; (setq ein:polymode t)

;; (setq ein:use-auto-complete t)

;; (setq ein:use-smartrep t)

;; (add-hook 'find-file-hook 'ein:maybe-open-file-as-notebook)

(ein:completion-backend 'ein:use-ac-backend)

(ein:complete-on-dot t)

(ein:truncate-long-cell-output t)

(ein:auto-save-on-execute t)

;; (ein:auto-black-on-execute t)

(ein:output-area-inlined-images t) ;; not necessary in older versions

(ein:slice-image t)

;; '

)

;;-------------------------------------------------

(use-package websocket

:defer t)

;;-------------------------------------------------

(use-package request

:defer t)

;;-------------------------------------------------

;; polymode, an extensible framework for multiple major modes:

(use-package polymode

:defer t)

;;-------------------------------------------------

(use-package markdown-mode

:defer t)

;;-------------------------------------------------

;; polymode for markdown-mode:

(use-package poly-markdown

:defer t)

;;-------------------------------------------------

(use-package python-mode

:defer t

:config

;; emacs calculates line offset:

(setq python-indent-guess-indent-offset t)

;; silence warnings while emacs calculates the line offset:

(setq python-indent-guess-indent-offset-verbose nil))

;;-------------------------------------------------

(use-package jedi

:defer t

:hook

(python-mode . jedi:setup)

:config

(setq jedi:complete-on-dot t))

;; M-x jedi:install-server in Emacs.

;; jedi dependencies:

(use-package epc

:defer t)

(use-package deferred

:defer t)

(use-package python-environment

:defer t)

(use-package auto-complete

:defer t

:config

(ac-config-default))

(use-package popup

:defer t)

;;-------------------------------------------------

(use-package elpy

:defer t

:config

(elpy-enable)

(elpy-company-backend)

(elpy-get-info-from-shell)

(setq python-shell-interpreter "ipython"

python-shell-interpreter-args "-i --simple-prompt"))

;; force autocompletion of elpy:

;; M-TAB (elpy-company-backend)

;; documentation on completions from shell:

;; elpy-get-info-from-shell (Customize Option)

;; This activates fallback completion candidates

;; for cases when the static code analysis fails.

;; Note for MacOS users: In some configurations,

;; display artifacts (lines of ^G s) can appear in the shell.

;; This can be fixed by prepending -c exec('import(\'readline\')')

;; to python-shell-interpeter-args

;; (e.g. (setq python-shell-interpreter-args "-c exec('import(\'readline\')') -i")

;; for python)

;;-------------------------------------------------

(use-package smartrep

:defer t)

;;-------------------------------------------------

;;-------------------------------------------------

;;-------------------------------------------------

`

dickmao commented 3 years ago

And, here's the elpy error that was thrown, and the .emacs config for ein :

error in process sentinel: ein:insert-read-only: 
Wrong type argument: number-or-marker-p, t

That is an EIN error, not an elpy error. Alas, tracking this down requires some programming ability like M-: (setq debug-on-error t) to pull a backtrace. Perhaps something like that is within your reach since #708. Otherwise, as I said in https://github.com/millejoh/emacs-ipython-notebook/issues/775#issuecomment-767047821 , you might be happier with a notebook interface that just works.