Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem interacting with ob-julia #37

Closed
1 of 2 tasks
nico202 opened this issue Jul 10, 2018 · 8 comments
Closed
1 of 2 tasks

Problem interacting with ob-julia #37

nico202 opened this issue Jul 10, 2018 · 8 comments

Comments

@nico202
Copy link

nico202 commented Jul 10, 2018

Checklist

  • [-] I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Actual Behavior

uuid created in the results, message:

executing Bash code block...
error in process sentinel: async-handle-result: Symbol’s value as variable is void: inferior-julia-program-name

Steps to Reproduce

Install ob-async + ob-julia
(I'm trubleshooting it and I'll provide better info here)

edit: the problem is ob-julia not ess

@ertwro
Copy link

ertwro commented Jul 12, 2018

I have the same problem. It seems to be specific to Julia. What I did was to call Julia in org-babel before requiring ob-async and then load the rest of the languages, which make the rest of the languages functional with :async and julia functional without it. Also, make sure you are doing it after wherever you have (require 'org) :

(org-babel-do-load-languages
'org-babel-load-languages
'(
(julia . t)
))
(require 'ob-async)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(org . t)
(shell . t) ;; was (sh . t)
(ipython . t)
(python . t)
(latex . t)
(ditaa . t)
(js . t)
(R . t)
))

I hope we find a solution to this.

@nico202 nico202 changed the title Problem interacting with ess Problem interacting with ob-julia Jul 12, 2018
@astahlman
Copy link
Owner

If one of you can attach a gist of your troubleshooting.org results then I'll be happy to take a look

@ertwro
Copy link

ertwro commented Jul 17, 2018

Sure.

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
    Each section below is filled in and includes sufficient detail to reproduce the issue
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Should produce an output. As it does without :async in the src_block inputs

Actual Behavior

Got:
error in process sentinel: async-handle-result: Symbol’s value as variable is void: inferior-julia-program-name
error in process sentinel: Symbol’s value as variable is void: inferior-julia-program-name

Steps to Reproduce

  • Emacs-lisp code
    (symbol-file 'ob-async-org-babel-execute-src-block)
    (message "PID: %s\nEmacs version: %s\norg version: %s\nPath to org: %s" (emacs-pid) (emacs-version) (org-version) (symbol-file 'org-version))
    (setq async-debug t)

  • Julia SRC block
    #+BEGIN_SRC julia :async :results value drawer
    1 + 354
    #+END_SRC

  • Results

Emacs version: GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-29
org version: 9.1.13
Path to org: /home/ertwro/.emacs.d/elpa/develop/org-plus-contrib-20180709/org.elc
progn: Search failed: "Transmitting sexp {{{\\([^}]+\\)}}}"
Code block evaluation complete.
executing Julia code block...
Transmitting sexp {{{'(lambda nil
(setq exec-path '("/home/ertwro/.pyenv/shims" "/home/ertwro/.pyenv/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin" "/sbin" "/bin" "/snap/bin" "/usr/lib/x86_64-linux-gnu/emacs/26.1/x86_64-linux-gnu"))
.
.
.
(package-initialize)
(org-babel-do-load-languages 'org-babel-load-languages
'((emacs-lisp . t)
(org . t)
(shell . t)
(ipython . t)
(python . t)
(latex . t)
(julia . t)
(ditaa . t)
(js . t)
(R . t)))
(let
((default-directory "/home/ertwro/org/"))
(org-babel-execute:julia "1 + 354"
'((:colname-names)
(:rowname-names)
(:result-params "replace" "value" "drawer")
(:result-type . value)
(:results . "replace value drawer")
(:exports . "code")
(:session . "none")
(:cache . "no")
(:noweb . "no")
(:hlines . "no")
(:tangle . "no")
(:async)))))
}}}
error in process sentinel: async-handle-result: Symbol’s value as variable is void: inferior-julia-program-name
error in process sentinel: Symbol’s value as variable is void: inferior-julia-program-name

Troubleshooting Artifacts

Here's a gist with a copy of my troubleshooting.org
https://gist.github.com/ertwro/4e1fde4ddcd989ad7e3277df8b7f611a


P.S.

I don't know if you are aware, but there's a project by John Kitchin called org-ref and scimax that adds features like being able to check the code while is being executed by clicking on the hash and also to kill it while taking you to where the process was killed or to the error. Although his is only Python-specific.
Those could be great additions to async
http://kitchingroup.cheme.cmu.edu/blog/2016/11/09/New-and-improved-asynchronous-org-babel-python-blocks/

@nico202
Copy link
Author

nico202 commented Jul 17, 2018

@ertwro (following your OT) this is the kind of help I hoped he would give to this project when I mentioned him here: #1

@astahlman
Copy link
Owner

error in process sentinel: async-handle-result: Symbol’s value as variable is void: inferior-julia-program-name

Where does inferior-julia-program-name normally (i.e., when you aren't using ob-async) get defined? It needs to be in some code path that it is triggered by evaluating init.el - otherwise it won't be defined in the Emacs subprocess that is launched by async.

@ertwro
Copy link

ertwro commented Jul 22, 2018

I replied to this in my gist. I'll copy here what I replied a couple of days ago:

Is defined at my init.el That's the reason it recognizes R and the rest of the languages when Julia is commented out or loaded before ob-async. I checked ess-site.el from the GitHub master and elpa-develop and found that the (ess-require 'ess) is no longer set there and requires directly Julia and the other languages without passing through ess.el. The old version of ess-site.el does contain a call to ess-custom.el. Which I try to use in this form, in my init.el:
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ess/")
(load "ess-site")
(require 'ess-site)
(require 'ess)

Even with "M-x Customize-variable inferior-julia-program-name" set to /opt/ or from /usr/local it makes no difference. I've downloaded several versions of Julia and recompiled emacs with different versions of ess.
The behavior is the same. R works fine with :async as do the other languages, that if Julia is commented out or loaded before ob-async.

astahlman added a commit that referenced this issue Aug 6, 2018
Add a hook that runs before the src block is executed. This hook enables
users to perform package-specific initialization that would normally be
handled in `init.el`. See
#37 for a motivating
example.
@astahlman
Copy link
Owner

astahlman commented Aug 6, 2018

@ertwro Sorry about that - I knew I had replied to this comment at some point, but then I couldn't find my own response!

I've just installed Julia and was able to reproduce your issue. It seems org-babel-execute:julia requires inferior-julia-program-name to be defined. I'd forgotten that the Emacs subprocess launched by the async library does not load init.el, so defining the variable in init.el has no effect.

This type of issue has come up before - see jwiegley/emacs-async#73. I've gone ahead and added a new hook, as suggested in that issue. The hook will be run before async execution of a src block. Once #40 is merged, you can use the hook to set inferior-julia-program-name, like so:

  (add-hook 'ob-async-pre-execute-src-block-hook
            '(lambda ()
               (setq inferior-julia-program-name "/usr/local/bin/julia")))

astahlman added a commit that referenced this issue Aug 16, 2018
* Add a pre-execute hook

Add a hook that runs before the src block is executed. This hook enables
users to perform package-specific initialization that would normally be
handled in `init.el`. See
#37 for a motivating
example.
@astahlman
Copy link
Owner

Merged #40 and documented the new hook in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants