emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* R session error (org-babel)
@ 2024-03-05 14:12 Esteban Venialgo
  2024-03-06  6:21 ` William Denton
  2024-03-06 10:42 ` Ihor Radchenko
  0 siblings, 2 replies; 6+ messages in thread
From: Esteban Venialgo @ 2024-03-05 14:12 UTC (permalink / raw)
  To: emacs-orgmode

hi Org-people,

I'm a newbie with org-babel, but I think I'm facing a bug for R code execution. Basically, I have a simple code for testing:

#+begin_src R :session test
  A = 1
#+end_src

I get a lisp error when I try to export this code to latex. Also, if I remove the session name "test", the code will run in the second attempt. I'm using Emacs version 28.2 and org-mode version 9.6.17. The lisp error log is bellow:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  org-babel-R-initiate-session("test" ((:colname-names) (:rowname-names) (:result-params "silent" "replace") (:result-type . value) (:results . "silent") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")))
  org-babel-execute:R("A = 1" ((:colname-names) (:rowname-names) (:result-params "silent" "replace") (:result-type . value) (:results . "silent") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")))
  org-babel-execute-src-block(nil ("R" "A = 1" ((:colname-names) (:rowname-names) (:result-params "silent" "replace") (:result-type . value) (:results . "silent") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:session . "test")) "" nil 1 "(ref:%s)"))
  org-babel-exp-results(("R" "A = 1" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")) "" nil 1 "(ref:%s)") block silent)
  #f(compiled-function (info type) #<bytecode 0x1236972de089e4fb>)(("R" "A = 1" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")) "" nil 1 "(ref:%s)") block)
  org-babel-exp-do-export(("R" "A = 1" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "test") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")) "" nil 1 "(ref:%s)") block nil)
  org-babel-exp-src-block((src-block (:language "R" :switches nil :parameters ":session test" :begin 1 :end 47 :number-lines nil :preserve-indent nil :retain-labels t :use-labels t :label-fmt nil :value "  A = 1\n" :post-blank 0 :post-affiliated 1 :mode top-comment :granularity element :cached t :parent (section (:begin 1 :end 47 :contents-begin 1 :contents-end 47 :robust-begin 1 :robust-end 45 :post-blank 0 :post-affiliated 1 :mode first-section :granularity element :cached t :parent (org-data (:begin 1 :contents-begin 1 :contents-end 47 :end 47 :robust-begin 3 :robust-end 45 :post-blank 0 :post-affiliated 1 :path "/home/esteban/test.org" :mode org-data :CATEGORY "test" :cached t)))))))
  org-babel-exp-process-buffer()
  org-export-as(latex nil nil nil (:output-file "test.tex"))
  org-export-to-file(latex "test.tex" nil nil nil nil nil org-latex-compile)
  org-latex-export-to-pdf(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch record nil)
  command-execute(org-export-dispatch record)
  counsel-M-x-action("org-export-dispatch")
  ivy-call()
  ivy-read("M-x " [ess-create-temp-buffer table--measure-max-width vc-src-responsible-p calendar-forward-week tramp-sudoedit-file-name-handler tramp-completion-handle-file-name-all-completions Set\ Slice make-mode-line-mouse-map table-source-caption-history Reduce\ To:\ to\ Cc: ido-prev-match help-follow-symbol ess-long+replacement japanese-hiragana-two-byte gnus-article-nndoc-name org-export-before-processing-functions rng-parse-validate-file senator-eldoc-use-color speedbar-file-regexp ess-keyword-face org-table--descriptor-line Rnw-mode message-expand-name-databases info--manual-names 0 nnoo-map-functions gnus-try-warping-via-registry compilation-error-list displ-string *table--cell-kill-paragraph :odt-styles-file vc-annotate all-packs org-table-get-range vc-bzr-shelve-menu rng-match-infer-start-tag-namespace 0 org-agenda-regexp-filter-preset gnus-summary-limit-to-marks org-agenda-menu-show-matcher hs-toggle-hiding 0 article-fill-long-lines smime-buffer-as-string-region org-get-org-file check-declare Info-breadcrumbs counsel--async-filter bibtex-text-in-string ! ...] :predicate #f(compiled-function (sym) #<bytecode 0x1118fc3e44c23476>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)
  
    Thanks for your help, tetumetal


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R session error (org-babel)
  2024-03-05 14:12 R session error (org-babel) Esteban Venialgo
@ 2024-03-06  6:21 ` William Denton
  2024-03-06 10:58   ` Esteban Venialgo
  2024-03-06 10:42 ` Ihor Radchenko
  1 sibling, 1 reply; 6+ messages in thread
From: William Denton @ 2024-03-06  6:21 UTC (permalink / raw)
  To: Esteban Venialgo; +Cc: emacs-orgmode

On Tuesday, March 5th, 2024 at 09:12, Esteban Venialgo <tetumetal@posteo.net> wrote:

> I'm a newbie with org-babel, but I think I'm facing a bug for R code execution. Basically, I have a simple code for testing:
> 
> #+begin_src R :session test
> A = 1
> #+end_src
> 
> I get a lisp error when I try to export this code to latex. Also, if I remove the session name "test", the code will run in the second attempt. I'm using Emacs version 28.2 and org-mode version 9.6.17.

I can't help understand the error message, but I did try the R sample and have no problem running it and exporting it.  I suspect it might be something about your local setup.  Could you try starting with =emacs -Q= and loading in Org and enough else to run the R snippet?  How to get started with that is here:

https://orgmode.org/manual/Feedback.html

It doesn't cover getting R working, but we can help with that.  I can look for a snippet of code if you need one.

Cheers,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R session error (org-babel)
  2024-03-05 14:12 R session error (org-babel) Esteban Venialgo
  2024-03-06  6:21 ` William Denton
@ 2024-03-06 10:42 ` Ihor Radchenko
  1 sibling, 0 replies; 6+ messages in thread
From: Ihor Radchenko @ 2024-03-06 10:42 UTC (permalink / raw)
  To: Esteban Venialgo; +Cc: emacs-orgmode

Esteban Venialgo <tetumetal@posteo.net> writes:

> hi Org-people,
>
> I'm a newbie with org-babel, but I think I'm facing a bug for R code execution. Basically, I have a simple code for testing:
> ...
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   org-babel-R-initiate-session...

As William pointed, it does look like some mis-configuration of ESS.
However, I am concerned about the obscurity of the error.
May you try testing with the latest development version of Org mode? (I
do hope that the error is less cryptic there)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R session error (org-babel)
  2024-03-06  6:21 ` William Denton
@ 2024-03-06 10:58   ` Esteban Venialgo
  2024-03-07  0:30     ` William Denton
  0 siblings, 1 reply; 6+ messages in thread
From: Esteban Venialgo @ 2024-03-06 10:58 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

hi Bill,

I tried the =emacs -Q=, and still get the same problem. Before exporting the code, I ran this lisp from the scratch pad:

;; enable language support for R
(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (shell . t)
   (latex . t)
   (emacs-lisp . nil)))

(setq load-path '("~/.emacs.d/lisp/" "/etc/emacs" "/usr/share/emacs/site-lisp" "/usr/share/emacs/site-lisp/auctex" "/usr/share/emacs/site-lisp/auto-complete" "/usr/share/emacs/site-lisp/color-theme" "/usr/share/emacs/site-lisp/company-mode" "/usr/share/emacs/site-lisp/counsel" "/usr/share/emacs/site-lisp/dictionary" "/usr/share/emacs/site-lisp/elpy" "/usr/share/emacs/site-lisp/ess" "/usr/share/emacs/site-lisp/highlight-indentation" "/usr/share/emacs/site-lisp/ivy" "/usr/share/emacs/site-lisp/lua-mode" "/usr/share/emacs/site-lisp/matlab" "/usr/share/emacs/site-lisp/org-mode" "/usr/share/emacs/site-lisp/popup" "/usr/share/emacs/site-lisp/python-mode" "/usr/share/emacs/site-lisp/pyvenv" "/usr/share/emacs/site-lisp/s" "/usr/share/emacs/site-lisp/site-gentoo.d" "/usr/share/emacs/site-lisp/swiper" "/usr/share/emacs/site-lisp/which-key" "/usr/share/emacs/site-lisp/xclip" "/usr/share/emacs/site-lisp/yasnippet" "/usr/share/emacs/site-lisp/color-theme/themes" "/usr/share/emacs/29.2/lisp" "/usr/share/emacs/29.2/lisp/vc" "/usr/share/emacs/29.2/lisp/use-package" "/usr/share/emacs/29.2/lisp/url" "/usr/share/emacs/29.2/lisp/textmodes" "/usr/share/emacs/29.2/lisp/progmodes" "/usr/share/emacs/29.2/lisp/play" "/usr/share/emacs/29.2/lisp/org" "/usr/share/emacs/29.2/lisp/nxml" "/usr/share/emacs/29.2/lisp/net" "/usr/share/emacs/29.2/lisp/mh-e" "/usr/share/emacs/29.2/lisp/mail" "/usr/share/emacs/29.2/lisp/leim" "/usr/share/emacs/29.2/lisp/language" "/usr/share/emacs/29.2/lisp/international" "/usr/share/emacs/29.2/lisp/image" "/usr/share/emacs/29.2/lisp/gnus" "/usr/share/emacs/29.2/lisp/eshell" "/usr/share/emacs/29.2/lisp/erc" "/usr/share/emacs/29.2/lisp/emulation" "/usr/share/emacs/29.2/lisp/emacs-lisp" "/usr/share/emacs/29.2/lisp/cedet" "/usr/share/emacs/29.2/lisp/calendar" "/usr/share/emacs/29.2/lisp/calc" "/usr/share/emacs/29.2/lisp/obsolete"))

btw, what emacs version are you using? and OS? Also, when you exported the code, did you set up org-babel-load-languages to run R?

My system details are:
Gentoo Linux
I tried GNU Emacs 29.2 and 28.2
org-mode version 9.6.17

   Thanks for your help, 





On 2024-03-06 06:21:10, William Denton wrote:
> On Tuesday, March 5th, 2024 at 09:12, Esteban Venialgo <tetumetal@posteo.net> wrote:
> 
> > I'm a newbie with org-babel, but I think I'm facing a bug for R code execution. Basically, I have a simple code for testing:
> > 
> > #+begin_src R :session test
> > A = 1
> > #+end_src
> > 
> > I get a lisp error when I try to export this code to latex. Also, if I remove the session name "test", the code will run in the second attempt. I'm using Emacs version 28.2 and org-mode version 9.6.17.
> 
> I can't help understand the error message, but I did try the R sample and have no problem running it and exporting it.  I suspect it might be something about your local setup.  Could you try starting with =emacs -Q= and loading in Org and enough else to run the R snippet?  How to get started with that is here:
> 
> https://orgmode.org/manual/Feedback.html
> 
> It doesn't cover getting R working, but we can help with that.  I can look for a snippet of code if you need one.
> 
> Cheers,
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R session error (org-babel)
  2024-03-06 10:58   ` Esteban Venialgo
@ 2024-03-07  0:30     ` William Denton
  2024-03-19 15:45       ` Esteban Venialgo
  0 siblings, 1 reply; 6+ messages in thread
From: William Denton @ 2024-03-07  0:30 UTC (permalink / raw)
  To: Esteban Venialgo; +Cc: emacs-orgmode

On Wednesday, March 6th, 2024 at 05:56, Esteban Venialgo <tetumetal@posteo.net> wrote:

> I tried the =emacs -Q=, and still get the same problem. Before exporting the code, I ran this lisp from the scratch pad:
> 
> ;; enable language support for R
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((R . t)
> (shell . t)
> (latex . t)
> (emacs-lisp . nil)))

Hmm! It does work for me.  I'm on Ubuntu 22.04, running Emacs and Org from the development tree (so 30.0.50 and 9.7-pre).

I ran =emacs -Q= (and also =make repro= from in the Org source tree, which is another useful tool for testing), and executed these lines in a scratch buffer:

# -----
(org-babel-do-load-languages 'org-babel-load-languages '(
     (R . t)
     (shell . t)
     ))
(add-to-list 'load-path "~/.emacs.d/elpa/ess-20240229.2054") 
(require 'ess-r-mode)
# -----

We're the same up to ESS.  (I had to check the version number on ESS to get the path right, but that's the latest release installed.)  Looking back, did you not mention using ESS?  I've never used R in Emacs without it.  If you weren't using ESS, what happens if you install it and use it? 

Just for the sake of documentation: then I made an r.org file with the snippet and ran it, and it worked:

# ----
#+begin_src R :session test
  A <- 1
#+end_src
#----


Cheers,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R session error (org-babel)
  2024-03-07  0:30     ` William Denton
@ 2024-03-19 15:45       ` Esteban Venialgo
  0 siblings, 0 replies; 6+ messages in thread
From: Esteban Venialgo @ 2024-03-19 15:45 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

hi William and Ihor,

Apologies for the late answer. I did some test on ESS and indeed that was the problem:

I was using: org version 9.6.17 and ess-version: 18.10.2. But, after I updated Gentoo (last weekend), the R code export worked fine! The current ESS version is: 24.01.1 and the org-version is the same.

   Thanks a lot for your help, Tetumetal

On 2024-03-07 00:30:03, William Denton wrote:
> On Wednesday, March 6th, 2024 at 05:56, Esteban Venialgo <tetumetal@posteo.net> wrote:
> 
> > I tried the =emacs -Q=, and still get the same problem. Before exporting the code, I ran this lisp from the scratch pad:
> > 
> > ;; enable language support for R
> > (org-babel-do-load-languages
> > 'org-babel-load-languages
> > '((R . t)
> > (shell . t)
> > (latex . t)
> > (emacs-lisp . nil)))
> 
> Hmm! It does work for me.  I'm on Ubuntu 22.04, running Emacs and Org from the development tree (so 30.0.50 and 9.7-pre).
> 
> I ran =emacs -Q= (and also =make repro= from in the Org source tree, which is another useful tool for testing), and executed these lines in a scratch buffer:
> 
> # -----
> (org-babel-do-load-languages 'org-babel-load-languages '(
>      (R . t)
>      (shell . t)
>      ))
> (add-to-list 'load-path "~/.emacs.d/elpa/ess-20240229.2054") 
> (require 'ess-r-mode)
> # -----
> 
> We're the same up to ESS.  (I had to check the version number on ESS to get the path right, but that's the latest release installed.)  Looking back, did you not mention using ESS?  I've never used R in Emacs without it.  If you weren't using ESS, what happens if you install it and use it? 
> 
> Just for the sake of documentation: then I made an r.org file with the snippet and ran it, and it worked:
> 
> # ----
> #+begin_src R :session test
>   A <- 1
> #+end_src
> #----
> 
> 
> Cheers,
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-19 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 14:12 R session error (org-babel) Esteban Venialgo
2024-03-06  6:21 ` William Denton
2024-03-06 10:58   ` Esteban Venialgo
2024-03-07  0:30     ` William Denton
2024-03-19 15:45       ` Esteban Venialgo
2024-03-06 10:42 ` Ihor Radchenko

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