syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.67k stars 4.89k forks source link

Python layer and autocompletion not working properly on Windows 10 #11245

Closed romanakmath closed 4 years ago

romanakmath commented 6 years ago

Hello,

I am new to spacemacs and I have the following problem. I can't get spacemacs to work with its python layer. When I write python into the spacemacs configuration layer and then go some python file, it doesn't show the completion suggestions, but instead: eldoc error: (file-missing Searching for program No such file or directory python) Do I have to extra install a python interpreter on my computer to get it to work or should it actually work automatically? The problem is also, that the code runs in the virtual environment on a remote machine, so if I install an interpreter on my machine it may not correspond to the interperter on the remote machine.

All I actually want and need is working autocompletion.

many thanks in advance for your help!

Compro-Prasad commented 6 years ago

There is autocompletion layer that you will have to enable in order to get completion.

romanakmath commented 6 years ago

The autocompletion layer is of course also activated, sorry for forgetting to mention it. Actually this is a persistent issue and occured after the spacemacs installation on both pcs I use.

Compro-Prasad commented 6 years ago

@Rareform Try using the develop branch.

antonalekseev commented 6 years ago

eldoc error: (file-missing Searching for program No such file or directory python)

The problem is also, that the code runs in the virtual environment on a remote machine, so if I install an interpreter on my machine it may not correspond to the interperter on the remote machine.

Do you actually have python interpreter in PATH within Emacs? Does M-: (getenv "PATH") contain path to bin/ of virtualenv you're using?

Compro-Prasad commented 6 years ago

@Rareform There are many things which we would like to know about like spacemacs, emacs and OS version, OS name, any errors from messages buffer, your spacemacs configuration, etc.

romanakmath commented 6 years ago

I am using current Windows 10 version, for emacs I am using a version with some precompiled libraries (I couldn't get pdftools to work otherwise) https://github.com/m-parashar/emax64 , the emacs version is 26.1 I don't know how to set up python interpreter on a remote machine. But if I install a python environment on windows (I tried WinPython and Anaconda) and add python to path the eldoc error disappears. Nevertheless unfortunately autocomplete still doesn't show anything with an interpreter set up. I will check for errors and report (I have the pc at my working place). The error occures with the default configuration file, I only added python and autocompletion words in the configuration.

Compro-Prasad commented 6 years ago

@Rareform Spacemacs branch? If you cloned it straight as is then it should probably be master branch. If it is develop then please specify the commit id/hash.

romanakmath commented 6 years ago

I guess it is a master branch. I used git clone https://github.com/syl20bnr/spacemacs "pathtoemax64"/.emacs.d to get it on my pc.

romanakmath commented 6 years ago

On the start of spacemacs the autocompletion layer seems to load normally: Loading c:/Users/krawtsrn/.emacs.d/layers/+completion/auto-completion/funcs.el (source)...done But I now see what could be the error, although I have no idea how to fix it.

When I try to start autocompletion with alt+x auto-complete I receive the following error: post command hook

Compro-Prasad commented 6 years ago

@Rareform It is M-x company-complete

romanakmath commented 6 years ago

Ok, this seems indeed to work!

How can I get suggestions for autocompletion of the functions of all modules used in the code? Do they have to be available in my interpreter which is described in the path? This would at least explain why for some common libraries such as numpy I get the autocompletion suggestions, but for others such as tensorflow which are not included in the interpreter I don't. It seems also to lag a little bit, is this normal? On occasions I get something like Cannot read anaconda-mode server response [2 times]

On other computer I also have somehow managed to get lights, which indicate numbers of errors and warnings: other completion mode

How do I activate them? In the configuration file of spacemacs I also get the descriptions of the functions the cursor is on, how can I get this to work also for my python code? autocomplete2

I know these are a lot of questions, but you are helping me and others a lot with the answers! Thank you.

Compro-Prasad commented 6 years ago

@Rareform Emacs is a new ecosystem for you thus the questions which are obvious. What I would recommend is drink a glass of information at a time. Too much of it might temporarily or permanently kill your craze in Emacs.

  1. I don't know much about anaconda. It handles all of the auto completion(and maybe error checking too) for Python. If you partially get the completions means it might be available in your virtualenv path or you might not have imported the module.
  2. Completion frontend is provided by company.
  3. Error checking frontend is provided by flycheck.
  4. The short description at the bottom is provided by eldoc. It is shown when you put the cursor between the parenthesis in Python.
  5. Sometimes multiple minor/major modes try to output things to the modeline which might hide the eldoc content.
  6. Almost every minor mode (also known as plugin) can be toggled by calling plugin-mode from M-x.