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

org-babel doesn't load correctly #3439

Closed
CestDiego opened this issue Oct 17, 2015 · 9 comments
Closed

org-babel doesn't load correctly #3439

CestDiego opened this issue Oct 17, 2015 · 9 comments

Comments

@CestDiego
Copy link
Contributor

When trying to eval a python source block I get that I have not defined a babel execute for python, but then I go to my config and I try to execute this:

    (org-babel-do-load-languages
     'org-babel-load-languages
     '((R . t)
       (emacs-lisp . t)
       (python . t)
       (sh . t)
       (haskell . t)
       (js . t)
       (latex . t)
       (gnuplot . t)
       (C . t)
       (sql . t)
       (ditaa . t)
       ))

and I get this backtrace:

Debugger entered--Lisp error: (void-variable org-babel-safe-header-args)
  (append org-babel-safe-header-args (quote (:width :height :bg :units :pointsize :antialias :quality :compression :res :type :family :title :fonts :version :paper :encoding :pagecentre :colormodel :useDingbats :horizontal)))
  (defconst ob-R-safe-header-args (append org-babel-safe-header-args (quote (:width :height :bg :units :pointsize :antialias :quality :compression :res :type :family :title :fonts :version :paper :encoding :pagecentre :colormodel :useDingbats :horizontal))) ("/home/jarvis/.emacs.d/elpa/org-20151005/ob-R.elc" . 995))
  require(ob-R)
  #[(pair) "�A\303�@!�\211�\203�\304\305\306    P!!\202%\307\305\310    P!!\210\307\305\311 P!!*\207" [pair lang active symbol-name require intern "ob-" fmakunbound "org-babel-execute:" "org-babel-expand-body:"] 5]((R . t))
  mapc(#[(pair) "�A\303�@!�\211�\203�\304\305\306   P!!\202%\307\305\310    P!!\210\307\305\311 P!!*\207" [pair lang active symbol-name require intern "ob-" fmakunbound "org-babel-execute:" "org-babel-expand-body:"] 5] ((R . t) (emacs-lisp . t) (python . t) (sh . t) (haskell . t) (js . t) (latex . t) (gnuplot . t) (C . t) (sql . t) (ditaa . t)))
  org-babel-do-load-languages(org-babel-load-languages ((R . t) (emacs-lisp . t) (python . t) (sh . t) (haskell . t) (js . t) (latex . t) (gnuplot . t) (C . t) (sql . t) (ditaa . t)))
  eval((org-babel-do-load-languages (quote org-babel-load-languages) (quote ((R . t) (emacs-lisp . t) (python . t) (sh . t) (haskell . t) (js . t) (latex . t) (gnuplot . t) (C . t) (sql . t) (ditaa . t)))) nil)
  eval-last-sexp-1(nil)
  #[257 "�\204�\303�!\207   �\303�!\n)B\211A    =\204�\211A�\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422445 "P"](nil)
  ad-Advice-eval-last-sexp(#[257 "�\204�\303�!\207  �\303�!\n)B\211A    =\204�\211A�\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422445 "P"] nil)
  apply(ad-Advice-eval-last-sexp #[257 "�\204�\303�!\207    �\303�!\n)B\211A    =\204�\211A�\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422445 "P"] nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
@robbyoconnor
Copy link
Contributor

👀

@izahn
Copy link
Contributor

izahn commented Oct 18, 2015

@CestDiego The error is coming from ob-R.el, which is not needed for python.

    (org-babel-do-load-languages
     'org-babel-load-languages
     '((python . t)))

(or even easier, just (require 'ob-python)) should be enough to get python code blocks working.

As for the actual bug encountered, it looks similar to a known problem in org-mode. See https://www.mail-archive.com/emacs-orgmode@gnu.org/msg98888.html and https://www.mail-archive.com/emacs-orgmode@gnu.org/msg98762.html. Make sure your packages are up to date. If packages are up to date reinstalling org-plus-contrib might fix it. FWIW, I have org-babel configured in .spacemacs by adding

    (eval-after-load 'org
      (lambda()
        (require 'ess-site)
        (require 'ob-R)
        (require 'ob-emacs-lisp)
        (require 'ob-latex)
        (require 'octave)
        (require 'ob-python)
        (require 'ob-sql)
        (require 'ob-shell)
        (require 'ob-sqlite)
        (require 'ob-julia)
        (require 'ob-perl)
        (require 'ob-org)
        (require 'ob-awk)
        (require 'ob-sed)
        (require 'ob-css)
        (require 'ob-js)
        (require 'ob-stata)
        (setq org-export-babel-evaluate nil)
        (setq org-startup-indented t)
        ;; increase imenu depth to include third level headings
        (setq org-imenu-depth 3)
        ;; Set sensible mode for editing dot files
        (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))
        ;; Update images from babel code blocks automatically
        (add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
        (setq org-src-fontify-natively t)
        (setq org-src-tab-acts-natively t)
        (setq org-confirm-babel-evaluate nil)))

to the dotspacemacs/user-init section. (You may or may not want all my setting of course). This works correctly for me on both the master and develop branches.

@zilongshanren
Copy link
Contributor

@CestDiego
Open ob-R.el and do byte-compile-file to recompile the ob-R.el and the problems is gone.

@CestDiego
Copy link
Contributor Author

@zilongshanren this didn't fix it :(

@liangwang
Copy link

Try my workaround at the end of #3314.

@CestDiego
Copy link
Contributor Author

I did this now:

added (org-babel :location local)
and

(defun org-cestdiego/init-org-babel ()
  (use-package org-babel
    :init
    (org-babel-do-load-languages
     'org-babel-load-languages
     '((R . t)
       (emacs-lisp . t)
       (python . t)
       (sh . t)
       (haskell . t)
       (js . t)
       (latex . t)
       (gnuplot . t)
       (C . t)
       (sql . t)
       (ditaa . t)
       ))
    ))

To my private layer, and now it works, thank you @liangwang for the solving of the error.

@paynito
Copy link

paynito commented Sep 28, 2016

per @zilongshanren 👍
cd ~/.emacs.d/elpa/org-20160926 ; rm ob-R.elc
caveats:
change the date in the folder name.

@jackkamm
Copy link
Contributor

I have this problem as well, on OSX and Archlinux, emacs 24 and 25, and it is due to ob-R.elc.
The solutions given by @zilongshanren and @paynito both worked for me.
Calling
spacemacs/recompile-elpa
also works to fix the problem.

@TheBB
Copy link
Collaborator

TheBB commented Nov 4, 2016

Closing in favor of #4618

@TheBB TheBB closed this as completed Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants