emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org/matlab the python kernel and a problem (python 2 vs 3)
@ 2019-12-12 15:16 Uwe Brauer
  0 siblings, 0 replies; only message in thread
From: Uwe Brauer @ 2019-12-12 15:16 UTC (permalink / raw)
  To: emacs-orgmode



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  

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-12 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-12 15:16 org/matlab the python kernel and a problem (python 2 vs 3) Uwe Brauer

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