With the following init file, emacs chokes on the first line:

bash-4.3$ pwd

bash-4.3$ cat init.el 
(require 'use-package)
(use-package package)

bash-4.3$ emacs --version | head -n 1
GNU Emacs 24.4.1

However, when I run emacs 'normally' (with this init file) and perform the require manually, it succeeds. Why would this happen? What can I do to fix it that won't have me changing load-paths every time I update use-package?

It is interesting to note that, by specifying the load manually, no errors are reported:

bash-4.3$ emacs --batch -L init.el

However, starting emacs interactively shows the issue.

  • Not clear. You are changing the recipe on the fly here, so it's hard to answer you. And now you mention that you are updating library use-package? So this is not the ordinary use-package.el? Where is it? For require to work, the library needs to be in your load-path - that's the problem, AFAICT.
    – Drew
    Commented Oct 26, 2014 at 18:10
  • @Drew I'm sorry if I was unclear; I have in the past been seemingly forced to update load-paths by hand when I update packages with package.el. (Org goes from version 20140101 to 20140201, for instance.) I obviously do not want to be updating my initialization file every time one of these updates occurs. This is the ordinary use-package.el, just thinking ahead to when it will be updated upstream :) Commented Oct 26, 2014 at 18:15
  • Agreed, this is a duplicate. Unfortunately, I can't vote yet. Commented Oct 26, 2014 at 18:23

2 Answers 2


It is package.el (with package-initialize) that adds the subdirectories of .emacs.d/elpa to your load path; these are not loaded automatically. Since use-package is in this directory, emacs doesn't see it until it encounters (package-initialize).

(require 'use-package)

It would appear that (package-initialize) is called sometime after the initialization file has been loaded. More information on the initialization sequence can be found in the manual:

@Drew pointed out in a comment that

… now that there is package-enable-at-startup, with t as the default value, package-initialize does get called after loading your init file.


Library use-package.el is not in your load-path.

The -l command-line option expects a file name, not a library name. You need to use option -L.


  • 1
    True, but this doesn't really answer the question. Start emacs interactively, then. Commented Oct 26, 2014 at 17:57
  • How does it not answer the question? Did you try using -L and specifying the directory for use-package.el? Or did you try specifying the absolute file name for it with -l?
    – Drew
    Commented Oct 26, 2014 at 18:03
  • The question wasn't truly about --batch usage, it was about interactive usage. It's absolutely true that use-package.el isn't in my load-path when it processes require, but why does my load-path change before and after emacs processes my init file? Shouldn't it be calling normal-top-level-add-subdirs-to-load-path before it processes my initialization file, or is that done with package-initialize? Commented Oct 26, 2014 at 18:08
  • It is done with package-initialize (as you have since found out). Or by updating load-path in your init file or using command-line option -L or in other code you load. Emacs doesn't guess where some library you require might be located. That's what load-path is for.
    – Drew
    Commented Oct 26, 2014 at 18:12
  • 1
    OK, yes, now that there is package-enable-at-startup, with t as the default value, package-initialize does get called after loading your init file. But you can also call it yourself, in the init file.
    – Drew
    Commented Oct 26, 2014 at 18:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.