use-package load some packages warning

Created on 5 Dec 2017  路  20Comments  路  Source: jwiegley/use-package

I load my color theme with:

(use-package spacemacs-theme
  :ensure t
  :init ; or :config
  (load-theme 'spacemacs-dark t)
  )

I get this warning:

Error (use-package): Cannot load spacemacs-theme

Even though the spacemacs-theme color theme is loaded after all. But get this warning.
I tried to re-install the spacemacs-theme package, and tried toggle debug on error.
and try to check out use-package upgrade news in Info. I found use-package has a NEWS.org in GitHub, but not in Info, I prefer an offline available Info in use-package Info personally. And seems it only contains one specific version like this one only has version 2.4 changes.
And this occurs not only on spacemacs-theme, also on other packages.

Error (use-package): Cannot load org-plus-contrib
Error (use-package): Cannot load diary

Here is my other configs:

(use-package org
  :load-path "~/Code/Emacs/org-mode/lisp/"
  :pin manual
  ;; :mode (("\\.org$" . org-mode))
  :config
  (use-package org-plus-contrib
    :load-path "~/Code/Emacs/org-mode/contrib/lisp/"
    :pin manual)
  )

(use-package diary
  :config
  (require 'diary-lib)
  (add-hook 'calendar-today-visible-hook 'calendar-mark-today)
  )

Maybe the (use-package foo :config ..) style is not allowed?
After check out NEWS.org, I also tried adding :ensure nil, warning does not disappear.
And thanks you for fixed a lot of issues and recently updating. Thanks a lot.

Most helpful comment

Ah! Try adding :no-require t to your use-package form.

All 20 comments

Not sure I'm right but maybe it's misinterpreting :ensure t as installing a package from a package repository named t, try changing it to just :ensure.

after today melpa update i get
Warning (use-package): Unrecognized keyword: :ensure [14 times]

See https://github.com/melpa/melpa/pull/5167#issuecomment-349214878:

Try adding (eval-when-compile (require 'use-package)) after (package-install 'use-package) like in my previous comment. It fixed it for me, but I don't know why.

yes it works, thanks

Did it fix the rest of this issue for you (in which case you may want to close it)?

yes

Cool, please close this

@nickmccurdy
I tried use just :ensure, still get this warning. And this only happens in just 3 of my lot of packages. This is weird, why not other packages pop this warning too?
And I also have:

(eval-when-compile
  (require 'use-package))

after my use-package install.

Maybe this is because spacemacs-theme does not has (provide 'spacemacs-theme) definition, so use-package don't recognize it? Also for org-plus-contrib doesn't have (provide 'org-plus-contrib) too.

Ah, that could be why. I wonder if the changes to deferring affect this.

Try (use-package "spacemacs-theme").

@drot Tried, does not work too. Thanks.

Can you copy the packages that are missing provide calls, add them, and package-install-file on each?

:ensure t will ensure that the package named by the use-package declaration is ensured.

@stardiviner Your use-package form expands to this, effectively:

(progn
      (use-package-ensure-elpa 'spacemacs-theme '(t) 'nil)
      (load-theme 'spacemacs-dark t)
      (require 'spacemacs-theme nil nil))

So the bug is likely in use-package-ensure-elpa. Would it be possible for you to debug that function further in your environment by inserting calls to message and then running it directly? I'm curious as to why it hasn't installed it.

Also, you'll note that you really should be using :config here, since :init forms occur before the package has been required (and so the theme should not actually be present yet).

@stardiviner @jwiegley I think the issue here is that there is no (require 'spacemacs-theme). See https://github.com/nashamri/spacemacs-theme/issues/42

@TrisMcC How do you mean? There's one in the expansion I showed just above.

Perhaps this is similar to an issue I had some time ago namely #454.

Ah! Try adding :no-require t to your use-package form.

@jwiegley @TrisMcC @all Aha, Thanks guys.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yevgnen picture Yevgnen  路  5Comments

komolovf picture komolovf  路  8Comments

alphapapa picture alphapapa  路  14Comments

kpbochenek picture kpbochenek  路  8Comments

jtecca picture jtecca  路  9Comments