23

I'm running Emacs 24.4 for Windows (installed through Chocolatey) and trying to install CIDER.

When I run M-x package-install [RET] cider [RET], I get [No match]. When I run M-x package-refresh-contents [RET], it hangs on Contacting host: elpa.gnu.org:80.

~/.emacs.d is populated with the GitHub repo recommended by braveclojure.com (here). I've reinstalled Emacs and I'm still getting the same problem.

12
  • How long have you waited for Emacs to contact GNU ELPA?
    – Chris
    Mar 17, 2015 at 2:44
  • Not that long... about 3 minutes. Should it take longer? When I run M-x package-list-contents [RET], it only runs for a few seconds. Mar 17, 2015 at 2:52
  • It shouldn't take that long, but it's a network operation so there are lots of opportunities for delay or failure. I've occasionally had trouble contacting GNU ELPA, but cancelling and retrying tends to work for me. Is there anything interesting in *Messages*? Since you're on Windows it's possible that you're missing some libraries. I've never used Chocolately, but the official GNU binaries work pretty well.
    – Chris
    Mar 17, 2015 at 12:35
  • @Chris Chocolatey gets it from the official website (but extracts it for you and all that), so it's the latest version. Messages shows nothing weird, and canceling and retrying doesn't help.... Someone mentioned that elpa.gnu.org:80 is sometimes too busy due to the massive amount of requests and that it can be down for a day or two, but I don't understand why it works then, say, for M-x package-refresh-contents. Mar 17, 2015 at 15:19
  • 1
    @MartinCleaver, I have added an answer summarizing the outcome of the chat.
    – Chris
    Apr 27, 2015 at 14:34

6 Answers 6

21

I had this same problem on emacs ELPA wiki they say to set un ELPA you have to modify the emacs init file located at ~/.emacs or _emacs or ~/.emacs.d/init.el for me it was ~/.emacs-live.el since I have this version.

I just updated that file with the following:

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                     ("marmalade" . "http://marmalade-repo.org/packages/")
                     ("melpa" . "http://melpa.org/packages/")))

Seems that I needed the configuration from where ELPA is going to look for packages.

After that i just ran M-x package-refresh-contents [RET] and M-x package-install [RET] cider [RET] that installed cider.


3
  • 1
    Fixed my issue on first try. Question is, why is this needed? Why doesn't it work by default?
    – Donovan
    Jul 17, 2015 at 23:59
  • I have emacs v24.5 and it only worked when I added the package-archives to init.el. I also had to restart emacs for it to work. Sep 22, 2015 at 11:06
  • 2
    Due to a bug in the SSL, you need to set marmalade to http not https. [ed] Unfortunately, if you don't do that first time round, it persists with an error saying that marmalade-repo.org:443 doesn't work, and I haven't found a way to nullify that yet. Oct 2, 2015 at 10:36
3

This guide fixed it for me: http://www.lonecpluspluscoder.com/2015/08/adding-tls-support-to-emacs-24-5-on-windows/

Basically go to: http://sourceforge.net/projects/ezwinports/files/, grab the gnutls library and just uncompress the archive at the root of your Emacs directory.

Afterwards, doing list-packages became near-instant for me. Using Emacs 24.5.1.

2
  • On msys2 issuing pacman -S mingw64/mingw-w64-x86_64-gnutls solved the problem.
    – Emily L.
    Apr 27, 2016 at 7:09
  • this did not 100% fix the problem, but it did stop emacs from hanging at this point and cause it to deliver useful error messages (which helped identify the issue). I 100% recommend anyone using emacs on windows install this patch (and be sure to copy over the existing files when doing so).
    – ricardo
    Jun 3, 2020 at 6:00
2

I had the same problem with Emacs 24 in Ubuntu 16.04 and nothing seemed to solve the problem. Finally, installing Emacs 25 solved the problem.

New Emacs packages are available here

sudo add-apt-repository ppa:kelleyk/emacs
sudo apt-get update
apt-get install emacs27

The problem is that the ELPA package signing key has expired. A new Emacs version will include a new key. Note that currently (2020 Oct) there is Emacs 27 available for Ubuntu 16.04.

Also make sure that you use https urls (and not plain http).

Another possibility may be to install new keys to an older Emacs version.

Windows binaries may also be available somewhere.

1

Other than setting up your package archives, like a previous answer mentions (FWIW I'm using HTTPS directly)

(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
                         ("marmalade" . "https://marmalade-repo.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")))

one might encounter another problem but with the same symptom of getting stuck at "Contacting host" due to running gpg in batch mode to verify the packages, but needing some input. You can disable that via

(setq package-check-signature nil)
0

Stack Overflow sometimes deletes chats. Fortunately it seems like I've still got access to a read-only version of the transcript.

From my perspective we didn't get a satisfactory answer. Here are the highlights:

  1. We determined that the variable package-archives contained only GNU ELPA.

  2. After discovering this, the OP wrote

    I edited the package.el file. It works!

  3. I suggested that editing a core Emacs Lisp file is not a good solution, but didn't hear anything back from the OP.

    Since the referenced init.el file tries to add MELPA, I think there's something else going on. Perhaps the .emacs.d/ directory is in the wrong location, for example.

Editing package.el is certainly not a good solution. Doing more work to determine why the config isn't being properly loaded would be a good approach.

1
  • The underlying problem seems to be that the mechanism is being broken by some unidentified bug or missing facility. It is hanging for me at Contacting host: elpa.gnu.org:80 using GNU's emacs-24.4-bin-i686-pc-mingw32.zip freshly downloaded and installed under Windows 7. When I try the same M-x package-refresh-contents command in Emacs 24.4.1 under Ubuntu 15.04 it works perfectly. Oct 2, 2015 at 13:56
0

I have faced this issue on Emacs 24.5.1.
I searched here in SO and outside SO, nothing worked for me. I had to circumvent the problem by installing a newer version of Emacs: emacs25.

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.