Reputation: 1437
OSX 10.13.4 emacs: 25.3 (9.0) python 3.5.2
I ma having problems with elpy auto-complete in emcas. Essentially, elpy gets stuck on the dot (for example: numpy.
) and does not suggest any possible completion. If I press on any key, i see a message: 'No completion found
user-error: Cannot complete at point' although all required packages are duly installed. I am suspecting this may be due to the configuration:
Elpy Configuration
Virtualenv........: None
RPC Python........: 3.5.2 (/usr/local/bin/python3)
Interactive Python: /usr/local/bin/python3 (/usr/local/bin/python3)
Emacs.............: 25.3.1
Elpy..............: 1.19.0
Jedi..............: 0.12.0
Rope..............: 0.10.7
Autopep8..........: 1.3.5
Yapf..............: 0.21.0
Syntax checker....: Not found (flake8)
You have not activated a virtual env. While Elpy supports this, it is
often a good idea to work inside a virtual env. You can use M-x
pyvenv-activate or M-x pyvenv-workon to activate a virtual env.
The directory ~/.local/bin/ is not in your PATH. As there is no active
virtualenv, installing Python packages locally will place executables
in that directory, so Emacs won't find them. If you are missing some
commands, do add this directory to your PATH -- and then do
`elpy-rpc-restart'.
The configured syntax checker could not be found. Elpy uses this
program to provide syntax checks of your programs, so you might want
to install one. Elpy by default uses flake8.
However, when trying to set the path with: 'PATH=$PATH:/.local/bin/' in the terminal does solve the problem.
How can I solve this please?
Upvotes: 2
Views: 895
Reputation: 545
The simplest solution to this problem is to use: https://github.com/purcell/exec-path-from-shell package. It'll setup the path inside Emacs fixing your issue. If you don't want to install this package you can put the following snippet in your .emacs
.
(let ((path (shell-command-to-string "$SHELL -cl \"printf %s \\\"\\\$PATH\\\"\"")))
(setenv "PATH" path)
(setq exec-path (split-string path path-separator)))
The above should work on any shell that's sh
compatible. I would recommend using the exec-path-from-shell
is easy to setup, and does the right thing regardless of what shell you're using.
Keep in mind that both approaches will get the $PATH
from the shell, so make sure that your PATH
is setup as you want it in your $HOME/.bashrc
assuming you're using bash. Something like: export PATH=$HOME/.local/bin:$PATH
should do it.
Upvotes: 1