emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: [SOLVED:HOWTO] (was: ob-ipyton ImportError: No module named 'jupyter_client')
Date: Tue, 03 Jul 2018 11:27:39 +0200	[thread overview]
Message-ID: <878t6soeic.fsf@mat.ucm.es> (raw)
In-Reply-To: 87y3eszu4d.fsf@mat.ucm.es

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

>>> "Uwe" == Uwe Brauer <oub@mat.ucm.es> 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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

      reply	other threads:[~2018-07-03  9:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03  6:54 ob-ipyton ImportError: No module named 'jupyter_client' Uwe Brauer
2018-07-03  9:27 ` Uwe Brauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878t6soeic.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).