Skip to content
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

latest Jupyter : REST API error: 404, "Not found" #500

Open
leclairm opened this issue Oct 13, 2023 · 5 comments
Open

latest Jupyter : REST API error: 404, "Not found" #500

leclairm opened this issue Oct 13, 2023 · 5 comments

Comments

@leclairm
Copy link

leclairm commented Oct 13, 2023

Hi,
First, thanks a lot for this very nice package which I had working out of the box with my previous anaconda distribution. I recently decided to switch from conda to mamba and use the conda-forge channel. There I got a more recent version of jupyter which fails with the following error from the messages buffer

Launching notebook process on port 8888...done
progn: Jupyter REST API error: 404, "Not found"

I'm running emacs from the master branch with native-comp and pgtk.
My emacs-jupyter config looks like this

(use-package simple-httpd)

(use-package jupyter
  :straight t
  :config
  (org-babel-do-load-languages 'org-babel-load-languages
                               (append org-babel-load-languages
                                       '((jupyter . t))))
  (setq jupyter-use-zmq nil)
  (org-babel-jupyter-override-src-block "python")
  )

And these are the results from jupyter --version in the working and failing cases

| package        | working | failing |
|----------------+---------+---------|
| IPython        |  8.15.0 |  8.16.1 |
| ipykernel      |  6.25.0 |  6.25.2 |
| ipywidgets     |   8.0.4 |   8.1.1 |
| jupyter_client |   7.4.9 |   8.4.0 |
| jupyter_core   |   5.3.0 |   5.4.0 |
| jupyter_server |  1.23.4 |   2.7.3 |
| jupyterlab     |   3.6.3 |   4.0.7 |
| nbclient       |  0.5.13 |   0.8.0 |
| nbconvert      |   6.5.4 |   7.9.2 |
| nbformat       |   5.9.2 |   5.9.2 |
| notebook       |   6.5.4 |   7.0.5 |
| qtconsole      |   5.4.2 |   5.4.4 |
| traitlets      |   5.7.1 |  5.11.2 |

Also I could not use zmq as emacs just crashes when I try to install it, not even use it (maybe native-comp related issue).

I could try to target another jupyter/ipython/ipykernel version but I'm not very knowledgeable about all the jupyter intricacies so I'd probably need a lot of attempts. Would you have any idea which package I should downgrade? Or maybe you're aware of what can be fixed on the emacs-jupyter side.

@leclairm
Copy link
Author

leclairm commented Oct 13, 2023

UPDATE

downgrading jupyter_server with mamba install jupyter_server=1.23.4 fixed the issue, with sometimes a timeout error when launching the kernel. I now get this from jupyter --version

IPython          : 8.16.1
ipykernel        : 6.25.2
ipywidgets       : 8.1.1
jupyter_client   : 8.4.0
jupyter_core     : 5.4.0
jupyter_server   : 1.23.4
jupyterlab       : 3.5.3
nbclient         : 0.8.0
nbconvert        : 7.9.2
nbformat         : 5.9.2
notebook         : 6.5.4
qtconsole        : 5.4.4
traitlets        : 5.9.0

@danielpopescu
Copy link

wonder if this is the issue: jupyter-server/jupyter_server#1047? Potential breaking change in jupter_server 2.x

@gmoutso
Copy link

gmoutso commented Jul 15, 2024

Do you want to check this fix? #542 (comment)

@nnicandro
Copy link
Collaborator

That fix has to do with the fact that jupyter_server conditionally adds a login endpoint depending on if the server uses authentication or not. It seems that Emacs-Jupyter should not try to login in cases where no authentication is needed. I guess if the xsrf cookie is already available without logging in or something like that.

@daanturo
Copy link

daanturo commented Sep 2, 2024

By inspecting the backtrace, I added this workaround:

(defun my-jupyter-api-http-request--ignore-login-error-a
    (func url endpoint method &rest data)
  (cond
   ((member endpoint '("login"))
    (ignore-error (jupyter-api-http-error)
      (apply func url endpoint method data)))
   (:else
    (apply func url endpoint method data))))
(advice-add
 #'jupyter-api-http-request
 :around #'my-jupyter-api-http-request--ignore-login-error-a)

It works for me now, but I hope the bug will be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants