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?
5 Answers
(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.
-
Great! just finished seeing your youtube video, great work guys! I think spyder is great, would really appriciate if you could support more types in the variable explorer, such as pandas series and dataframes, multi dimensional arrays and so on.– idodaAug 5, 2013 at 8:24
-
I'm glad you saw and enjoyed my video! Dataframes and Series in the variable explorer are also planned for a future release, I just need to find the time to do it :) Aug 5, 2013 at 14:40
-
Take a look at this issue. It has some starting code and ideas from which you can start off. If you questions or need orientation, please write there. I really hope you can help us with this :) Aug 20, 2013 at 13:48
-
-
I'm on a Mac. How do I make sure when doing pip install I'm really installing it for Spyder? Right now my pip comes from miniconda (Python 3) which will just say
Requirement already satisfied
.– huggieJan 27, 2014 at 11:55
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
-
Another option (available only in the upcoming
2.3
version) is that you can use theTab
key to do code completions in the Editor Jun 29, 2014 at 0:27
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.