How can I make auto-complete work with ELPY in emacs? - autocomplete

I am trying to configure my emacs for python programming. Elpy auto-complete suggestion is not working at all in all instances. Any suggestions?
Here is my elpy-config...
Elpy Configuration
Emacs.............: 26.3
Elpy..............: 1.31.0
Virtualenv........: None
Interactive Python: python 3.7.4 (/Users/mdmorshed/.pyenv/shims/python)
RPC virtualenv....: rpc-venv (/Users/mdmorshed/.emacs.d/elpy/rpc-venv)
Python...........: python 3.7.4 (/Users/mdmorshed/.emacs.d/elpy/rpc-venv/bin/python)
Jedi.............: 0.15.1
Rope.............: 0.14.0
Autopep8.........: 1.4.4
Yapf.............: 0.28.0
Black............: 19.3b0
Syntax checker....: flake8 (/usr/local/bin/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'.

Elpy is suppose to provide auto-completion out-of-the-box. As your elpy-config seems fine, I would suggest reporting the issue in Elpy repository here.

Related

Spacemacs Deletes Packages After Installation. How do i midigate this

I am using spacemacs and I am attempting to install packages with M-x "package install $package-name". The particular package I am trying to install is SLY, A newer implementation of The SLIME REPL for Common Lisp. When I Install the package when I start up spacemacs it works fine. However when exiting spacemacs it somehow gets deleted. After googling this issue I found this page https://develop.spacemacs.org/doc/FAQ.html. I followed the instructions and changed my .spacemacs config. I added the line dotspacemacs-install-packages 'used-but-keep-unused. What am I doing wrong.
You should add your personal packages to dotspacemacs-additional-packages

Setting up Emacs Elpy with Poetry

How can I configure Elpy to use dev dependencies like Black, Jedi, and flake8 that are installed in a Poetry project virtual environment rather than those that are installed systemwide?
Use the poetry.el Emacs package with poetry-tracking-mode enabled by add-hooking it to elpy-mode-hook. Elpy will automatically detect the Poetry virtual environment and check for those dev tools in that environment.
Jan 2021 update: I've since stopped using Elpy and switched to lsp-mode and lsp-python-ms - it's a far better development experience. The only caveat is that it can only discover virtualenvs local to the project, so Poetry has to be configured to create venvs locally (poetry config virtualenvs.in-project true).
If you use emacs -nw, then another option is
Install virtualenvwrapper in poetry project. That is run poetry add -D virtualenvwrapper.
Install elpy dependencies you need. M-x elpy-config' to find dependencies. So poetry add -D jedi rope autopep8 yapf black flake8`. This can also be done when elpy prompts you, but then it will probably install as a normal dependency and not just dev dependency.
Add (setq elpy-rpc-virtualenv-path 'current) so that elpy uses the poetry virtual env for Virtualenv, Interactive Python, RPC virtual env.
Launch emacs through poetry poetry run emacs -nw
You need to do this for each poetry project. There should be way to install some of these globally in pyenv and have poetry and the project virtual env pick it up. However, doing it for each project keeps dependencies isolated, even for dev stuff.

elpy with Winpython: how to configure?

I'm trying to setup elpy for emacs on my windows system, on which I'm using Winpython 3.4.3.
I have installed all the dependencies such as rope, flake8, etc... using pip. When I type M-x elpy-config in emacs, I get "Neither easy_install nor pip found".
If I run (executable-find "python") then I get the correct path to my Winpython installation.
What might be the problem?
On Windows 7 with Emacs 24.5 and Python 2.7 it worked for me to include the actual directory containing pip (Scripts) in the exec-path; using M-x customize-variable exec-path. Apparently, including just the directory of the python executable was not enough.

Web-mode does not load in emacs

I'm pretty new to emacs and I'm currently trying to configure it properly for my needs, but I can't make it load web-mode at all.
So, this is what I've done:
Downloaded web-mode.el from GitHub
Made sure the file is located in the correct directory: ~/.emacs.d/web-mode.el
Used the installation instructions from the official page
My .emacs file now looks like this
Issue:
When I'm trying to edit any of the file types specified in the .emacs file, it only runs the default modes. PHP Abbrev for PHP etc... I'm not receiving any error messages and when I'm running --debug-init it does not give any output.
Emacs version: GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.18.9) of 2012-03-01 on sl6.fnal.gov
OS: Scientific Linux
Does anyone know how I can troubleshoot this further, or have solved similar issues?
You should let el-get install it for you. El-get is a package manager for emacs. It can install packages from github, emacswiki, elpa, an url, … http://wikemacs.org/index.php/El-get
It's very handy, you can update scripts easily, it manages dependencies, it lets you discover many stuff, you can easily share your config accross machines, etc.
Emacs 24 has package.el or ELPA by default. One can install it on emacs 23, but my experience isn't conclusive so I'd advise sticking with el-get, which is great.

Can't make emacs to load the correct virtualenv

I wan't to compile python project in emacs. This project is running in a virtualenvwrapper environment. So i found a emacs plugin called virtualenvwrapper and use M-x work-on to choose virtualenv. After i have done this, the python interpreter and shell has been set to the correct python env, but when i compile emacs with M-x compile, it still can't found all the packages installed in python env.
I found this issue may be caused by zsh. After i change the default shell to bash in terminal. virtualenv works fine. Is it a bug of zsh or i haven't configured zsh with the right way.