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

jupyter-run-repl is picking up wrong python #529

Open
justrajdeep opened this issue Mar 3, 2024 · 1 comment
Open

jupyter-run-repl is picking up wrong python #529

justrajdeep opened this issue Mar 3, 2024 · 1 comment

Comments

@justrajdeep
Copy link

justrajdeep commented Mar 3, 2024

Hi

I am trying to set up jupyter for my emacs

Since i am in an farm box i am using poetry to create python virtual environment.
I am using doom emacs as my emacs configuration.

org-babel-python-command is a variable defined in config.el.

Value
"python3"

org-babel-load-languages is a customizable variable defined in org.el.

Value
((emacs-lisp . t))

so i have created ~/bin/jupyter ~/bin/python and ~/bin/python3

which have something like this

#!/bin/bash

set -e

source ~/bin/scripts/emacs_python/.venv/bin/activate

~/bin/scripts/emacs_python/.venv/bin/jupyter $@

but when i am trying to run M-x jupyter-run-repl it is picking up some other python is getting picked up, i get

Launching python3 kernel...
jupyter--start-kernel-process: Kernel process exited:
/home/utils/meld-3.16.3/bin/python: No module named ipykernel_launcher

Process jupyter-kernel-python3 exited abnormally with code 1

This python is not what i want.

I have verified the following in my emacs

#+begin_src emacs-lisp
(shell-command "jupyter --paths")
#+end_src

Result:

config:
    /home/scratch.rmondal_mobile/home/bin/scripts/emacs_python/.venv/etc/jupyter
    /home/rmondal/.jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/scratch.rmondal_mobile/home/bin/scripts/emacs_python/.venv/share/jupyter
    /home/rmondal/.local/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/rmondal/.local/share/jupyter/runtime

And

#+begin_src emacs-lisp
 (jupyter-locate-python)
#+end_src

#+RESULTS:
: /home/scratch.rmondal_mobile/home/bin/scripts/emacs_python/.venv/bin/python3
#+begin_src emacs-lisp
(shell-command "jupyter kernelspec list")
#+end_src

Result:

Available kernels:
  python3    /home/scratch.rmondal_mobile/home/bin/scripts/emacs_python/.venv/share/jupyter/kernels/python3

#+begin_src emacs-lisp
   (shell-command "jupyter kernelspec list --json")
#+end_src

Result

{
  "kernelspecs": {
    "python3": {
      "resource_dir": "/home/scratch.rmondal_mobile/home/bin/scripts/emacs_python/.venv/share/jupyter/kernels/python3",
      "spec": {
        "argv": [
          "python",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3 (ipykernel)",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {
          "debugger": true
        }
      }
    }
  }
}

Please advice. TIA.

@justrajdeep
Copy link
Author

#306 (comment)

Helped me

#+begin_src emacs-lisp
 (advice-remove #'org-babel-do-load-languages #'ignore)
#+end_src

 #+begin_src emacs-lisp
(org-babel-do-load-languages
 'org-babel-load-languages
 '(
   (emacs-lisp . t)
   ;; (julia . t)
   (shell . t)
   (python . t)
   (jupyter . t)
))

#+end_src

which gives

org-babel-load-languages is a customizable variable defined in org.el.

Value
((jupyter-python . t)
 (emacs-lisp . t)
 (python . t)
 (jupyter . t))

Original Value
((emacs-lisp . t))

when i try to run M-x jupyter-run-repl i get

Launching python3 kernel...
Starting python3 kernel process...done
Launching python3 kernel...done
Requesting kernel info...
Loading /home/scratch.rmondal_mobile/home/doom_emacs/.local/straight/build-29.1/zmq/emacs-zmq (module)...
apply: Module could not be opened: "/home/scratch.rmondal_mobile/home/doom_emacs/.local/straight/build-29.1/zmq/emacs-zmq.so", "/lib64/libc.so.6: version `GLIBC_2.33' not found (required by /home/scratch.rmondal_mobile/home/doom_emacs/.local/straight/build-29.1/zmq/emacs-zmq.so)"

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

1 participant