emacs-orgmode
[Top][All Lists]
Advanced

[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:
Hi

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

 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
  Debian/Ubuntu.

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.
MATLABROOT=/usr/local/MATLAB/R2016b
Cd $MATLABROOT/extern/engines/

sudo -H python3 setup.py install 

** Start the engine Run 

Python3 
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 
'org-babel-ipython-initiate-session)
#+END_SRC


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)
#+end_src


That is now really fast.

Regards

Uwe Brauer 

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


reply via email to

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