0

Anyone know how to actually enable auto imports? I've tried in the pref's auto-import settings, cleared my project cache and restarted but I never get any auto import prompts!

On mac, running latest pyCharm CE version.

this is not simply a matter of enabling the setting; that setting is enabled in the preferences but still I get no suggestions for auto-imports

ie import requests gets me nothing no popup, no suggestion to import it etc.

Tony
  • 8,681
  • 7
  • 36
  • 55
  • Have you set the Python interpreter for the project? Auto-imports are project specific so they depend on the interpreter (it'll be different between Python versions, depends on the installed libraries, etc...) – bad_coder Apr 28 '22 at 23:11
  • yes venv interpreter is setup for the project. – Tony Apr 28 '22 at 23:20
  • Reading your question I'm unsure if you mean [auto-import](https://www.jetbrains.com/help/pycharm/creating-and-optimizing-imports.html) or [auto-complete](https://www.jetbrains.com/help/pycharm/auto-completing-code.html). Also, what number is your PyCharm version? This is hard to explain, but the library's you're trying to import from have to be written in Python if they're compiled then you need to have the stub files installed for them. Does autocomplete and autoimport work with standard library modules after you have the interpreter installed? Does your Python environment have stub files? – bad_coder Apr 28 '22 at 23:35

1 Answers1

0

You can simply follow these steps:

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click Editor | General | Auto Import.
  2. In the Python section, configure automatic imports:
    • Select Show import popup to automatically display an import popup when tying the name of a class that lacks an import statement.
    • Select one of the Preferred import style options to define the way an import statement to be generated.

Let me know how it goes!

Aly Mobarak
  • 356
  • 2
  • 17