Elpy: Neither easy_install nor pip found

Created on 23 Jan 2018  Â·  31Comments  Â·  Source: jorgenschaefer/elpy

When I type M-x elpy-config in emacs froze a seconds, then showed the following messages:
Neither easy_install nor pip found

Then I typed
sudo apt-get install python3-pip
sudo apt-get install python3-setuptools

The prompt showed the following messages:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip/python3-setuptools is already the newest version (8.1.1-2ubuntu0.4).
The following packages were automatically installed and are no longer required:
accountsservice gir1.2-glib-2.0
libaccountsservice0 libgirepository-1.0-1
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

So I think I already installed easy_install and pip in my Linux server
What should I do to fix this problem?

My python version is 3.5.2

Bug

Most helpful comment

Note that the Python interpreter may be named something other than python. So it is incorrect to hard-code python -m pip, instead it should use whatever is the correct Python interpreter (e.g. Jython or Python3 or etc.)

All 31 comments

After I install python-pip, it worked. But I don't quite get it. My python version 3.5.2 should I install pip3 only instead of pip?

Hello and thanks for the report! What's the output of python -m pip --help for you?

Usage:
/usr/bin/python -m pip [options]

Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion
help Show help for commands.

General Options:
-h, --help Show help.
--isolated Run pip in an isolated
mode, ignoring
environment variables
and user
configuration.
-v, --verbose Give more output.
Option is additive,
and can be used up to
3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log Path to a verbose
appending log.
--proxy Specify a proxy in the
form [user:passwd@]pro
xy.server:port.
--retries Maximum number of
retries each
connection should
attempt (default 5
times).
--timeout Set the socket timeout
(default 15 seconds).
--exists-action Default action when a
path already exists:
(s)witch, (i)gnore,
(w)ipe, (b)ackup.
--trusted-host Mark this host as
trusted, even though
it does not have valid
or any HTTPS.
--cert Path to alternate CA
bundle.
--client-cert Path to SSL client
certificate, a single
file containing the
private key and the
certificate in PEM
format.
--cache-dir

Store the cache data
in .
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically
check PyPI to
determine whether a
new version of pip is
available for
download. Implied with
--no-index.

I had the same issue as @Hugozys but added the following line in my emacs.d:
setq elpy-rpc-python-command "python3"

This allows M-x elpy-config to work. However, there are other issues, such as using ipython or elpy seeing that flake8 is indeed installed. I will write those up as separate issues when I have a moment.

Elpy uses python -m pip to call pip. I recommend using virtualenvs to use the correct python interpreter.

I am getting the same error now. It was working for me before and now it throws this error. Furthermore, it can't seem to find rope, autopep8, flake8 anymore. python -m pip works fine for me.

Edit: It works fine if I open emacs from the terminal. But fails when I open emacs directly.

Edit: It works fine if I open emacs from the terminal. But fails when I open emacs directly.

This indicates that you set up your environment only in the shell, not in wherever you start Emacs from. Try using the exec-path-from-shell package (or use virtualenvs and M-x pyvenv-activate).

This will become an issue in Debian in ~2020, or whenever Python 2 is dropped, or whenever depending on Python 2 becomes a release critical bug, unless PEP 394 is updated to use Python 3 as the default interpreter.

I plan to do something like configuring dh-make to run the self-tests using setq elpy-rpc-python-command "python3" during the transitional period. No rush, but it's on the horizon ;-)

P.S. I hope to have progressed far enough in my Python education to submit a set of patches for round 2 of "fixing self-tests on Debian's autopkgtest (which uses exclusively system packages) for a python3-only environment" if any work is necessary :-)

Hello, I have the same problem. Emacs does not find pip. I did everything suggested but it doesn't help. Is there anything else I can try?

I use:
Python 3.5.2
Ubuntu 16.04.5
Emacs 24.5.1

What's the output of which pip when it works, and the contents of exec-path in Emacs?

which pip gives:
/home/matthijs/.local/bin/pip

exec-path gives [no match] when I execute it in emacs after M-x.

exec-path gives [no match] when I execute it in emacs after M-x.

@mattbak00 exec-path is a variable. Either C-h v exec-path. Alternatively type exec-path into a scratch buffer, place point directly after it, and evaluate with C-x C-e.

@sten0 Thank you I wasn't aware of that.

exec-path gives:
"/home/matthijs/bin" "/home/matthijs/.local/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin" "/sbin" "/bin" "/usr/games" "/usr/local/games" "/snap/bin" "/usr/lib/emacs/25.2/x86_64-linux-gnu"

Please ignore my previous post. I upgraded to Ubuntu 18.04.1, which upgraded emacs to version 25.2.2. This removed elpy and I can't reinstall it sadly. So my previous post is with version 25 and no elpy installed. I tried to install emacs 24 but sadly i can't make it work.

Note that the Python interpreter may be named something other than python. So it is incorrect to hard-code python -m pip, instead it should use whatever is the correct Python interpreter (e.g. Jython or Python3 or etc.)

Elpy uses elpy-rpc-python-command.

@mattbak00

Ubuntu 18.04.1 should be new enough that this package should work:
http://ftp.debian.org/debian/pool/main/e/elpy/elpa-elpy_1.24.0-1_all.deb

After installing it you'll need to run sudo apt install -f to pull in dependencies. Note that it does not install components necessary for Python 2 support and is Python 3 only. See /usr/share/doc/elpa-elpy/README.Debian for documentation of the customisations. Also note that the following are suggested dependencies and will not be automatically installed: python3-autopep8, yapf3, python3-pip, python3-jupyter-console

Please let me know whether or not the package works for you, and please update this bug with the output from (elpy-config).

@bfinney-commoncode Hi Ben!

@mattbak00 P.S. that Debian package has only been tested with emacs25

@mattbak00, did you ever get it to work?

@sten0 no I never got it to work, after trying it a few times I just gave up. Thank you for helping thought!

Hi

I am on Debian we are in 2020 and I have this problem.

I don't understand what I am expecting to do to resolve this issue.
I have a virtualenv, python3 is installed and python2 is the default pythoin.
I am on a virtualenv with python3 and it works as expected until today.
I have done nothing just reopenned my project, make some reformat and sudenly I have this message "Install yapf/autopep8 to format code." when I try to reformat files. (it worked first).

Wen I try to open elpy-config I have this error:
"elpy-insert--pip-button-value-create: Neither easy_install nor pip found"

I have changed pyvenv-activate to absolute path in my .dir-locals.el in my project directory.

After that elpy-config work as before, so I have installed yapf which was one on my user dir (until now I used a virtualenv in elpy but tools used by elpy was in my $HOME/.local, I don't know why but it worked like this).

Now when try to reformat a file from the project elpy continues to complain about yapf is not installed.

This is the output from elpy-config in my project:

Elpy Configuration

Emacs.............: 26.1
Elpy..............: 1.34.0
Virtualenv........: api_bo (/home/mik/dev/pyenv/api_bo)
Interactive Python: python3 3.7.3 (/home/mik/dev/pyenv/api_bo/bin/python3)
RPC virtualenv....: api_bo (/home/mik/dev/pyenv/api_bo)
 Python...........: python3 3.7.3 (/home/mik/dev/pyenv/api_bo/bin/python3)
 Jedi.............: 0.17.2
 Rope.............: Not found (0.17.0 available)
 Autopep8.........: 1.5.3
 Yapf.............: 0.30.0
 Black............: 19.10b0
Syntax checker....: flake8 (/home/mik/.local/bin/flake8)

When I am not on a virttuialenv I have this configuration:

Emacs.............: 26.1
Elpy..............: 1.34.0
Virtualenv........: None
Interactive Python: python3 3.7.3 (/usr/bin/python3)
RPC virtualenv....: usr (/usr)
 Python...........: python3 3.7.3 (/usr/bin/python3)
 Jedi.............: 0.17.2
 Rope.............: 0.17.0
 Autopep8.........: Not found (1.5.3 available)
 Yapf.............: Not found (0.30.0 available)
 Black............: 19.10b0
Syntax checker....: flake8 (/home/mik/.local/bin/flake8)
````

the dir-locals.el in my project:

((nil . ((mik-web-mode-engine . "django")))
(python-mode (pyvenv-activate . "/home/mik/dev/pyenv/api_bo"))
(mhtml-mode . ((mode . web))))
```

For information about GNU Emacs and the GNU system, type C-h C-a.
[yas] Prepared just-in-time loading of snippets successfully.
python3 -m pip install black: finished.
python3 -m pip install jedi: finished.
Install yapf/autopep8 to format code.
python3 -m pip install yapf: finished.
python3 -m pip install autopep8: finished.
Install yapf/autopep8 to format code.
Mark set

The Messages buffer after:
1 set a fresh env,

  1. install yapf and autopep8 from elpy-config
  2. run elpy-format-code on a file from the project

we see the install of the 2 packages and the inconsistent error message just after.

Hi @MikHulk

>

I am on Debian we are in 2020 and I have this problem.

I don't understand what I am expecting to do to resolve this issue.
I have a virtualenv, python3 is installed and python2 is the default pythoin.
I am on a virtualenv with python3 and it works as expected until today.
I have done nothing just reopenned my project, make some reformat and sudenly I have this message "Install yapf/autopep8 to format code." when I try to reformat files. (it worked first).

Are you using Elpy from git, MELPA, or Debian? While it's officially
unsupported, I report success with 1.34.0-2 from testing installed to
buster. If you're using the Debian package, please consult
/usr/share/doc/elpa-elpy/README.Debian

P.S. if the problem is with the Debian package, please report bugs to
bugs.debian.org. My primary focus is a package that works out of the
box, and it's probable that virtualenv handling can be improved, even if
that just means better documentation.
P.P.S. installing the same package from apt and from MELPA can trigger
obscure bugs.

Regards,
Nicholas

Hello Nicholas!

Thanks for your reply. I am using Elpy 20200527.2021 from melpa. Emacs(26.1) Python3.7, and Virtualenv come from apt. After a complete reinstallation of my virtualenv, it seems to work.

Regards

Mik

I'm also having this issue on Ubuntu 20.04. Packages installed with apt are:

  • emacs
  • python3
  • python3-pip
  • python3-virtualenv

elpy was installed from melpa (I assume, I can't see it in the package list).

Here are the messages:

Elpy is creating the RPC virtualenv (’/home/anshul/.emacs.d/elpy/rpc-venv’)
Automatically install the RPC dependencies from PyPI (needed for completion, autoformatting and documentation) ? (y or n) y
Elpy is installing the RPC dependencies...
Done
elpy-insert--pip-button-value-create: Neither easy_install nor pip found

When I source ~/.emacs.d/elpy/rpc-venv/bin/activate then pip seems to work fine, so I'm not sure what the issue is.

Hi MikHulk,

MikHulk notifications@github.com writes:

Hello Nicholas!

Thanks for your reply. I am using Elpy 20200527.2021 from melpa. Emacs(26.1) Python3.7, and Virtualenv come from apt. After a complete reinstallation of my virtualenv, it seems to work.

Sorry for the delay replying, I missed the notification. I suspect that
your virtualenvs were created with an Elpy version that installed Elpy's
deps to each virtualenv, and then once you upgraded to a more recent
version of Elpy--where there is a dedicated virtualenv for Elpy's
deps--it stopped functioning.

@galaunay, is there any way to be more defensive against this transition
case, or has it been so long since the change that it's not worth it?
For the record, it doesn't affect the Debian package, which uses system
libs installed to /usr for everything (by default).

Cheers,
Nicholas

Hi Anshul,

Anshul Sirur notifications@github.com writes:

I'm also having this issue on Ubuntu 20.04. Packages installed with apt are:

  • emacs
  • python3
  • python3-pip
  • python3-virtualenv

elpy was installed from melpa (I assume, I can't see it in the package list).

Here are the messages:

Elpy is creating the RPC virtualenv (’/home/anshul/.emacs.d/elpy/rpc-venv’)
Automatically install the RPC dependencies from PyPI (needed for completion, autoformatting and documentation) ? (y or n) y
Elpy is installing the RPC dependencies...
Done
elpy-insert--pip-button-value-create: Neither easy_install nor pip found

Have you tried MikHulk's workaround?

By the way, I'm curious why you chose not to use the elpa-elpy package ;-)

Thanks,
Nicholas

Hi @sten0 !

No problem. Thanks for your answer. I did not have the problem anymore. Just sometimes on specific file on my project it is like as I have not set virtualenv and elpy switch on my local pytohn install into $HOME/.local.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kapilsh picture kapilsh  Â·  3Comments

dschrempf picture dschrempf  Â·  6Comments

chechoRP picture chechoRP  Â·  5Comments

CSRaghunandan picture CSRaghunandan  Â·  5Comments

Valber picture Valber  Â·  4Comments