I am trying to access the melpa packages but when typing:


emacs gets hung up at: "Contacting host: elpa.gnu.org:80"

I am completely new to emacs and fairly new to Linux and I have been stuck on this for a few hours.

I found this question on stackoverflow below:


and added:

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

but it did not help.

I also tried switching https to http but that did not help either.

Can someone please help? Any suggestions or references would be much appreciated. Below is a screen shot of my code.

enter image description here

  • Identical to stackoverflow.com/q/47686465/850781
    – sds
    Commented Dec 7, 2017 at 3:01
  • 1
    Screenshots of code are almost never useful. Please copy and paste the code into the question, and remove the image.
    – phils
    Commented Dec 7, 2017 at 4:01
  • 1
    Please do not post the same question to StackOverflow and emacs.SE. Choose one; delete the other. Thx.
    – Drew
    Commented Dec 7, 2017 at 4:02
  • 1
    Maybe you need to use a proxy to reach the package archive? Can you ping elpa.gnu.org from the command line?
    – phils
    Commented Dec 7, 2017 at 4:03
  • 1
    Are you behind a firewall that doesn't let you contact that host? Can you contact that host outside Emacs? Probably is not an Emacs problem if you can't.
    – Drew
    Commented Dec 7, 2017 at 4:03

2 Answers 2


Here are some alternatives for you in case you cannot access the official sites.


(setq package-archives '(("gnu"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
                         ("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))


(setq package-archives '(("gnu"   . "http://elpa.emacs-china.org/gnu/")
                         ("melpa" . "http://elpa.emacs-china.org/melpa/")))

choose one to replace your settings listed above.

You can try to open the sites in your browser to check which sites you can access.


I was not able to overcome this problem although I tried the solutions suggested here and there.

I ended up by installing emacs25 and this problem did not occur.

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.