Why is the Run option disabled on PyCharm?

Pycharm

Pycharm Problem Overview


I observed that on a new project the Run option is disabled and I expected to be able to run a script without having to manually add a configuration for it.

Pycharm Solutions


Solution 1 - Pycharm

If you're creating a project from existing source: and If the existing source directory contains a lot of data/files:

  • the Run option (and others, assumably) are disabled until PyCharm is finished indexing the contents in the project. You'll see a progress bar in the lower-right-hand corner.

You can speed this up by right-clicking on folders and selecting "Mark directory as..." -> "Excluded" if they aren't to be indexed.

Solution 2 - Pycharm

Right click inside your main file & then you get Run option!

Solution 3 - Pycharm

You can't run without a configuration, however temporary configuration can be created automatically if you use Run context menu option in the script editor.

Solution 4 - Pycharm

I solved it just by right clicking on the .py file and clicking 'run'. After this the run button appeared enabled!

Solution 5 - Pycharm

If the project folder contains a lot of files then the indexing process can take a long time. So you might need to wait before the Run button appears.

Solution 6 - Pycharm

Select drop down menu to the left of the run button at the top right, select Edit configurations, expand defaults on the left, select whatever you were working on (if python, select python). Then click OK. Dialogue will close. Make sure the file that you want to run is on top. Hit ctrl+shift+F10 to run. The run button should be enabled again.

Solution 7 - Pycharm

It is possible that when you have newly setup your pycharm environment, it starts to index the scripts. You will see something like Indexing... at the bottom of the window. Once it is complete you can right click and select Run.

Solution 8 - Pycharm

  1. Select your file name in drop down menu on top right corner.
  2. Then go to edit configurations.
  3. Next the Run/Debug Configurations dialog box will be open.
  4. Then under execution, uncheck Run with Python console
  5. Apply> Ok

Then you will get the Run window again.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsorinView Question on Stackoverflow
Solution 1 - PycharmJordan StefanelliView Answer on Stackoverflow
Solution 2 - PycharmN RandhawaView Answer on Stackoverflow
Solution 3 - PycharmCrazyCoderView Answer on Stackoverflow
Solution 4 - PycharmJoão RaffsView Answer on Stackoverflow
Solution 5 - PycharmquestView Answer on Stackoverflow
Solution 6 - PycharmMcrave20View Answer on Stackoverflow
Solution 7 - PycharmSwadhikarView Answer on Stackoverflow
Solution 8 - Pycharmuser16023399View Answer on Stackoverflow