[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [SOLVED:HOWTO] (was: ob-ipyton ImportError: No module named 'jupyter

From: Uwe Brauer
Subject: [O] [SOLVED:HOWTO] (was: ob-ipyton ImportError: No module named 'jupyter_client')
Date: Tue, 03 Jul 2018 11:27:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>> "Uwe" == Uwe Brauer <address@hidden> writes:

I think I solved the issue. Here are some instructions which might be

 ob-ipython seems to work with python3 not 2.X

So the first thing is to run (Ubuntu/Debian)

* Installation of jupyter and the matlab_kernel

sudo apt-get install python3-setuptools

sudo -H python3 -m pip install jupyter

% there is a conflict with the pexpect package as shipped with

sudo apt-get remove python3-pexpect
sudo -H python3 -m pip install pexpect
sudo -H python3 -m pip install matlab_kernel

** Install the python API for matlab.
Cd $MATLABROOT/extern/engines/

sudo -H python3 setup.py install 

** Start the engine Run 

import matlab.engine
eng = matlab.engine.start_matlab()
Configure babel
#+BEGIN_SRC emacs-lisp
(setq org-confirm-babel-evaluate nil)   ;don't prompt me to confirm everytime I 
want to evaluate a block

;;; display/update images in the buffer after I evaluate
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)

(add-to-list 'org-src-lang-modes '("matlab" . matlab))
(setq python-shell-interpreter "python3")

;; set default headers for convenience
(setq org-babel-default-header-args:matlab
      '((:results . "output replace")
        (:session . "matlab")
        (:kernel . "matlab")
        (:exports . "code")
        (:cache .   "no")
        (:noweb . "no")
        (:hlines . "no")
        (:tangle . "no")))

(defalias 'org-babel-execute:matlab 'org-babel-execute:ipython)
(defalias 'org-babel-prep-session:matlab 'org-babel-prep-session:ipython)
(defalias 'org-babel-matlab-initiate-session 

Then use the following example
#+begin_src matlab :results output latex :exports results  :eval never-export 
:wrap latex
x = [1, 2, 3, 4, 5];
fprintf('|%d', x)

That is now really fast.


Uwe Brauer 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]