From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: org/matlab the python kernel and a problem (python 2 vs 3) Date: Thu, 12 Dec 2019 16:16:04 +0100 Message-ID: <878snh377v.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52361) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifQCM-0003DQ-7p for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 10:16:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifQCL-0008GO-86 for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 10:16:14 -0500 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:50438 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifQCK-0008Ar-Vv for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 10:16:13 -0500 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1ifQCI-000LW2-K4 for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 16:16:10 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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