Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't PyCharm's autocomplete working for libraries I install?

Tags:

python

pycharm

PyCharm's autocomplete isn't working for installed libraries. I have the following code:

from boto.emr.connection import EmrConnection conn = EmrConnection(aws_keys.access_key_id, aws_keys.secret_key) 

I want the editor to tell me what methods I have available to me when I press Ctrl+Space.

The boto library is installed in my environment, but it doesn't seem to be detected by PyCharm. How can I set this up correctly?

like image 656
Mo. Avatar asked Feb 23 '15 15:02

Mo.


People also ask

Why isn't PyCharm's autocomplete working for libraries I install?

You need to go into the project settings and configure the interpreter to point at the virtualenv. PyCharm will then index the interpreter and allow you to autocomplete. The virtualenv may be auto-detected in the dropdown menu on the left.

How do I enable auto complete in PyCharm?

Go to Settings / Preferences | Editor | General | Postfix Completion and select the Enable postfix completion checkbox.


1 Answers

You've installed the 3rd-party library into a virtualenv, but PyCharm doesn't know about that by default. If nothing is specified, it will choose the system Python install as the interpreter. You need to go into the project settings and configure the interpreter to point at the virtualenv. PyCharm will then index the interpreter and allow you to autocomplete.

Project interpreter settings

The virtualenv may be auto-detected in the dropdown menu on the left. If it is not, click the gear to the right, click "Add local", and select /path/to/virtualenv/bin/python (or \Path\to\virtualenv\Scripts\python.exe on Windows).

like image 102
davidism Avatar answered Sep 26 '22 00:09

davidism