From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eDOdEV50jmFQFgAAgWs5BA (envelope-from ) for ; Fri, 12 Nov 2021 15:04:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iI9EDV50jmHiCAAAB5/wlQ (envelope-from ) for ; Fri, 12 Nov 2021 14:04:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B6DED34F94 for ; Fri, 12 Nov 2021 15:04:13 +0100 (CET) Received: from localhost ([::1]:35520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlXA4-0006jO-VM for larch@yhetil.org; Fri, 12 Nov 2021 09:04:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlX99-0006jG-K7 for emacs-orgmode@gnu.org; Fri, 12 Nov 2021 09:03:15 -0500 Received: from ciao.gmane.io ([116.202.254.214]:48844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlX98-0006VD-30 for emacs-orgmode@gnu.org; Fri, 12 Nov 2021 09:03:15 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mlX8s-0005RB-S0 for emacs-orgmode@gnu.org; Fri, 12 Nov 2021 15:02:58 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-orgmode@gnu.org To: emacs-orgmode@gnu.org From: Uwe Brauer Subject: babel+matlab+python2.7+matlab_kernel ipython jupyter matlab: problem Date: Fri, 12 Nov 2021 15:02:49 +0100 Message-ID: <87v90xbhfa.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:ExsMAfB6DKs/H8JmOfkM5X4enXQ= Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1636725853; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=V2NS6rOC8Ymyx9oCFH6OHyfkRmD6pO3wG+P1prgyS1k=; b=N+H7i5ULbFlciLKmOzE2nGO3IGiMB8/NDZDs++ms5rPt0txOjfMLVON8T4HlAzGBAXVI2o RmDjSNkdO1e0V03zj+NGrGdEHjygzjgUCed9wQtJY+pRzto2X7N+bxwVodisH8lk+Q41sW 3zZOhb1wQoh5aycD268XRT1EuH0BSc/UaWgLHcAE2BWgkEqup1ZYTndGDRFgh/aN+5QWRG vTbL26iUjGa/aCtPp8tJZyvzCvrkr3iLbaesCFpMNlGQ9VrVkXutQp6TiTpN3maTDV5S9B qoh6b6H6k13up9nZhZSYMPr4m2oLW2LogF4TEmYWT7HVCtRbcDpC7ZDzaPO0+g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1636725853; a=rsa-sha256; cv=none; b=Efm9mG2Md+kxwu6Fxzk4zgDOD0YQZAiCXACYCxS3fqDXa3wAv7/PekqnmGmy4EJy2+5KZk gEAQiYS9hZGEyfJpALEG2FnzGPY0I8eiubxTyS+jfGh1rdc1e8HKvD2OnjaWoJzHH1dnjy GZOPlhBNkrw7J9RXS3RwOXb0bcNcBrB6igLgWY8thO/wyxlrZUYAJC3v1oL7sOyDCwrrBf pVqmfVMHTbwdcrjlkBFDye7UH13RhgRwWADdOzUDqU2IaR80Q6ivz5YqeSOKE8eniOxoji SlCwnqlxQAHgfuXhVa0L5IrBYatnAlyKBRNcheXS80Qd6Jc2uLWITtTVRzjxeg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.23 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=mat.ucm.es (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: B6DED34F94 X-Spam-Score: -2.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: sqcRizDZJtbU Hi I am on ubuntu 16.04 with python 3.5 and 2.7 in the past I have used successfully the matlab python kernel for 3.5 Using more or less this: sudo apt-get install python3-setuptools sudo -H python3 -m pip install jupyter 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/python sudo -H python3 setup.py install ** Start the engine Run /usr/bin/python3 in the python prompt: import matlab.engine eng = matlab.engine.start_matlab() the eng command needs some time to run. When finished run now #+BEGIN_SRC emacs-lisp (setq org-confirm-babel-evaluate nil) ;;; 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 "/usr/bin/python3") ;(setq python-shell-interpreter "/usr/bin/python2.7") ;; 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 However I am forced to use matlab 2019b, which is not longer compatible with python 3.5, but according to their documentation with 2.7, so I repeated the steps above using python-2.7 instead of 3.5 And of course ;(setq python-shell-interpreter "/usr/bin/python3") (setq python-shell-interpreter "/usr/bin/python2.7") But when I try to execute in an org file #+begin_src matlab :results output latex :exports results :eval never-export :wrap latex x = [1, 2, 3, 4, 5]; fprintf('|%d', x) #+end_src Emacs shows me that is he is working and working and finally I have to interrupt the process, I also don't see any error stack. Anybody has successfully used the above configuration with python 2.7? Thanks Uwe Brauer