Why can't Emacs find counsel and swiper, even though they (as well as ivy) seem installed, and moreover Ivy mode is enabled, and seems to be working?

This is what I get when I try the following:

(package-installed-p 'ivy)

(package-installed-p 'counsel)

(package-installed-p 'swiper)

And I can also see the version information for Ivy:

(pkg-info-version-info 'ivy)
"0.11.0 (package: 20190412.840)"

But when I try to get version information for counsel, I get an error:

(pkg-info-version-info 'counsel)

Debugger entered--Lisp error: (error "Can’t find library counsel")
  signal(error ("Can’t find library counsel"))
  error("Can't find library %s" "counsel")
  eval((pkg-info-version-info 'counsel) nil)
  funcall-interactively(eval-print-last-sexp nil)
  call-interactively(eval-print-last-sexp nil nil)

Interestingly enough, if I visit the the packages list, counsel is listed as installed and I can get the following details:

counsel is an installed package.

     Status: Installed in ‘counsel-20190414.1926/’ (unsigned).
    Version: 20190414.1926
     Commit: 0e62f0d1f61b825ca5eb4b55e47ecb37b3e2834e
    Summary: Various completion functions using Ivy
   Requires: emacs-24.3, swiper-0.11.0
Required by: counsel-tramp-20190125.751
   Homepage: https://github.com/abo-abo/swiper
   Keywords: convenience matching tools 
Other versions: 20190414.1926 (melpa).

My Emacs version is:

"GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32)
 of 2018-06-19"

and I'm encountering this issue on MS Windows 10 (version 1607).

  • 1
    I can confirm that with same counsel version and GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) on archlinux I do get counsel version, if that's any reassurance... Commented Apr 15, 2019 at 14:41
  • 1
    Is it actually a case of Emacs not finding it? As far as I'm aware the function/command you're using there (pkg-info-version-info) is from pkg-info.el, which (as of 26.2 at least) isn't part of GNU Emacs.
    – davep
    Commented Apr 15, 2019 at 15:05
  • @davep you are correct, pkg-info isn't part of Emacs, I've installed it as a package. As can be seen in my answer below, package-initialize solved my problem. But, it's still a mystery to me why ivy was working whereas counsel and swiper didn't. If it's a matter of me having to explicitly initialize, then why was ivy working without that. Hence my confusion. Commented Apr 16, 2019 at 6:21
  • @EmreSevinç it is curious. It might be an idea to raise the issue with the package author.
    – davep
    Commented Apr 16, 2019 at 6:53

1 Answer 1


Adding the following to my .emacs seems to solve the problem:


But I'm a little bit confused, because 41.1 Packaging Basics says that

Whenever Emacs starts up, it automatically calls the function package-initialize to load installed packages.

Moreover, I had the same version of Emacs on a Linux machine, and I'm using the same Emacs configuration there without any problems, that is, without (package-initialize).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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