emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: org/matlab the python kernel and a problem (python 2 vs 3)
Date: Thu, 12 Dec 2019 16:16:04 +0100	[thread overview]
Message-ID: <878snh377v.fsf@mat.ucm.es> (raw)



Hi

I am on Ubuntu 16.05 running either python 2.7 or 3.5.
I had matlab 2018b installed, and used the python engine to run matlab
commands from org file in a fast way.


I did, after installing the corresponding python3 modules, in the matlab
installation directory 

sudo -H python3 setup.py install 

I started the engine via 
/usr/bin/python3
in the python prompt:

import matlab.engine
eng = matlab.engine.start_matlab()

And for org I used 


  (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)

Worked like charm

However I had to upgrade to 2019b
then the installation via python 3.5 failed


OSError: MATLAB Engine for Python supports Python version 2.7, 3.6, and 3.7, but your version of Python is 3.5

So I used 2.7 and changed the org setting accordingly.

However when I tried to execute matlab code, emacs run forever and
nothing happened.

Did anybody got this to work with python2.7?

Thanks

Uwe Brauer  

                 reply	other threads:[~2019-12-12 15:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=878snh377v.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).