1

First of all, please excuse me if my question is stupid. However, I cannot solve the problem that I am getting.

I am going to begin a project on Python and wanted to use Emacs as default editor. I would like to first set up my environment in order to work efficiently. On previous projects, I used the existing environment but wanted to have my own on my local machine. I am on Mac OS 10.12.6.

I started by downloading Python2.7.10 and latest Emacs -- version 26.1. I read that Elpy was one of the best developing environment for Python and downloaded it.

Here is my .emacs file. It is located in my home directory (surely not optimal).

;; init.el --- Emacs configuration

;; INSTALL PACKAGES
;; --------------------------------------

(require 'package)

(add-to-list 'package-archives
       '("melpa" . "http://melpa.org/packages/") t)

(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))

(defvar myPackages
  '(better-defaults
     elpy ;; add elpy package
     material-theme))

(mapc #'(lambda (package)
    (unless (package-installed-p package)
      (package-install package)))
      myPackages)

;; BASIC CUSTOMIZATION
;; --------------------------------------

(setq inhibit-startup-message t) ;; hide the startup message
(load-theme 'material t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally


;; init.el ends here
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages
   (quote
    (python-environment elpygen py-autopep8 material-theme elpy better- 
   defaults))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(elpy-enable)

On Emacs, I would like to enable Elpy. Looking at the configuration, I get the following

Virtualenv........: None
RPC Python........: 2.7.10 (/usr/bin/python)
Interactive Python: python (/usr/bin/python)
Emacs.............: 26.1
Elpy..............: 1.24.0
Jedi..............: Not found
Rope..............: Not found
Autopep8..........: Not found
Yapf..............: Not found
Black.............: Not found
Syntax checker....: Not found (flake8)

...

The jedi package is not available. Completion and code navigation will
not work.

[run] easy_install --user jedi

...

I already installed Jedi, Rope, ..., with the following command

pip install jedi, rope

By clicking on "run", I get the following message:

Traceback (most recent call last):
  File "/usr/bin/easy_install-2.7", line 7, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

I tried what is done in this question: No module named pkg_ressources. I update my current version of pip, setuptools, distribute, ... but nothing works. Should I delete everything and start again (It might be dangerous, if everything is not deleted)?

I really don't know where to start. Reinstalling the setuptool package did not change anything.

Previously I had a Python3.x installed maybe it messed up the installation.

Any help is appreciated.

Thanks a lot.

Theo
  • 11
  • 5

1 Answers1

0

AFAIK the current recommendation is to install Jedi/Rope inside your virtual environment. For other requirements you might be able to get away with modifying your $PATH environment variable.

Chen Levy
  • 12,926
  • 16
  • 67
  • 86