0

I have a problem with emacs downloading packages and would appreciate some pointers on how this could be tracked/solved.

disclaimers first: I'm a complete noob at emacs, so if something looks/sounds stupid, it most likely is, please let me know.

Note that I'm running this behind a proxy set-up at $work.

I'm trying to set-up an emacs install to use ENSIME for Scala development. On the getting started page they have a sample init.el that is causing me problems:

;; global variables
(setq
 inhibit-startup-screen t
 create-lockfiles nil
 make-backup-files nil
 column-number-mode t
 scroll-error-top-bottom t
 show-paren-delay 0.5
 use-package-always-ensure t
 sentence-end-double-space nil)

;; buffer local variables
(setq-default
 indent-tabs-mode nil
 tab-width 4
 c-basic-offset 4)

;; modes
(electric-indent-mode 0)

;; global keybindings
(global-unset-key (kbd "C-z"))

;; the package manager
(require 'package)
(setq
 package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                    ("org" . "http://orgmode.org/elpa/")
                    ("melpa" . "http://melpa.org/packages/")
                    ("melpa-stable" . "http://stable.melpa.org/packages/"))
 package-archive-priorities '(("melpa-stable" . 1)))

(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)

(use-package ensime
  :ensure t
  :pin melpa-stable)

When running emacs --debug-init I get the following error:

Debugger entered--Lisp error: (error "Package `use-package-' is unavailable")
signal(error ("Package `use-package-' is unavailable"))
error("Package `%s-%s' is unavailable" use-package "")
package-compute-transaction(nil ((use-package)))
package-install(use-package)
(progn (package-refresh-contents) (package-install (quote use-package)))
(if (not package-archive-contents) (progn (package-refresh-contents) (package-install ($
eval-buffer(#<buffer  *load*> nil "/home/ubuntu/.emacs.d/init.el" nil t)  ; Reading at $
load-with-code-conversion("/home/ubuntu/.emacs.d/init.el" "/home/ubuntu/.emacs.d/init.e$
load("/home/ubuntu/.emacs.d/init" t t)
#[0 "^H\205\262^@ \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312Q\202;^@\313\3$
command-line()
normal-top-level()

What I understand from this error is that use-package is not available/installed. Which is weird.

If I do: M-x package-refresh-contents I get this:

Loading 00debian-vars...done
Importing package-keyring.gpg...done
Using a proxy for http...
Contacting host: elpa.gnu.org:80 [2 times]
Failed to download `gnu' archive.
Contacting host: orgmode.org:80 [2 times]
Failed to download `org' archive.
Contacting host: melpa.org:80 [2 times]
Failed to download `melpa' archive.
Contacting host: stable.melpa.org:80 [2 times]
Failed to download `melpa-stable' archive.
For information about GNU Emacs and the GNU system, type C-h C-a.

So it seems that emacs understands that it is behind a proxy, but for some reason it fails the download.

How would I go about finding out the root cause of this and fixing it?

  • I use (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) – bertfred Dec 15 '16 at 13:26
  • I think I tried all possible combinations of installing a package on the internet :( Anyways, it seems that in my case the problem is not in actually installing a package, but in accessing the different package repositories. It seems the proxy screws up my config, but I'm not sure how to fix that. – Denis Rosca Dec 15 '16 at 13:37
  • 1
    I'm voting to close this question as off-topic because it was based on a misunderstanding by the OP. – Drew Dec 15 '16 at 14:58
0

Never mind, it seems that I've messed up my proxy config on the machine.

I had

$http_proxy=proxy.company.lan:1234
$https_proxy=proxy.company.lan:1234

but didn't have:

$no_proxy=company.lan

It seems this was causing emacs to fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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