Question

I'm having a problem getting my local variables autocompleted. This is a very basic functionality which I'm sure it should support. When I'm starting to write a variable name which was already declared, and press TAB (this is the default shortcut), I get nothing. Is this a bug?

Was it helpful?

Solution

(Spyder dev here) Spyder does complete local variables but to have this functionality you need to install a library called rope. You can do it by running this command in a terminal

pip install rope

If you use Python 3 this command needs to be

pip install rope_py3k

Besides, code completion on the Editor works now with both Ctrl+Space and with Tab.

Edit: Updated answer for the Spyder version 2.3.0.

OTHER TIPS

Another hint:

If you want to customize the shortcut (for example, your 'ctrl+space' is already occupied), try

Tools--Preferences--Keyboard shortcuts--code completion

you can change it to whatever you want

Idoda, I made a little guide to install Python for scientific computing on Ubuntu or Debian from their repositories. I tested correctly using Python 3 on Ubuntu 14.04 LTS.

It summarizes as follows. First, install the interpreter and the package manager:

sudo apt-get install python3 python3-pip 

Now install the Spyder's IDE:

sudo apt-get install spyder3

Thanks to Carlos Cordoba's advice, if you want to enjoy the autocomplete execute:

sudo pip3 install rope_py3k

Finally, open Spider and check if the autocomplete works rightly.

In my case, with the command conda install spyder, the installation process prompted me with the following...

The following NEW packages will be INSTALLED:

rope:   0.10.5-py36_0 conda-forge
spyder: 3.1.4-py36_0  conda-forge

Proceed ([y]/n)? y

I want to point out that my anaconda installation is for python 3. After this auto-completion was working. I'm utilizing OS X El Capitan.

Usually, ctrl+space is set to code completion in Tools -> Preferences -> Keyboard shortcuts -> code completion We have the option to change it to another shortcut.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top