33

When I launch PyCharm it starts scanning files to index background task and hangs for ~1 hour/forever. From time to time it finishes and proceeds with updating indices task. It lasts for ~3 hours/forever. While these processes are running it is very hard to use PyCharm and even some other programs. PyCharm starts from ~200MB and took ~1GB of memory at the end of these tasks.

On my laptop, which is much worse. PyCharm launches in 30 seconds and ready to work. I'm working on the same project on my PC/Laptop.

I'm using Windows 64 bit. PyCharm 4.0.5

P.S. I don't have symlinks to exclude in my Project Structure.

enter image description here

bad_coder
  • 8,684
  • 19
  • 37
  • 59
Hacking Node
  • 392
  • 1
  • 3
  • 9

6 Answers6

51

My project contained a folder that had like 100k files/folders inside. This was making indexing way too slow.

To fix this, exclude the folder from Project structure in PyCharm.

File - Settings - Project: yourprojectname - Project Structure - Right click on folder and press "Excluded"
Jaanus
  • 15,613
  • 45
  • 143
  • 198
  • 2
    I had a virtualenv folder of only 5000 files and that was even causing this behavior. – fred271828 May 05 '17 at 19:45
  • 1
    Haha, awesome. I had a symlink to a folder with a symlink and... yeah, circular reference! Boooom! Haha. Now it works again. – Atcold Jun 13 '17 at 15:34
15

I just tried the following:

In PyCharm, go to the "File" on the left top, then select "invalidate caches/restart...", and press "Invalidate and restart".

After that, it can finish scanning in a short period without hanging anymore.

vdmit
  • 45
  • 5
Choi
  • 339
  • 3
  • 6
7

I've already answered this question on Stackoverflow, so I'll just copy and paste... I had the same problem and "File | Invalidate Caches/Restart" had not helped because Pycharm didn't respond at all. I found ".Pycharm50" directory in my home directory -- it contains configuration files. After its removal Pycharm launched as if you've just downloaded it, everything still goes well.

  • 2
    Worked beautifully! Name of hidden directory may vary depending on release and whether it is Community or Professional Edition. – Ron Kalian Feb 12 '20 at 17:06
3

Late answer but this may help other people in the future. For me this issue was fixed by raising the inotify watches limit. After raising it as described on jetbrains their website (https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit) it worked properly.

  1. Add the following line to either /etc/sysctl.conf file or a new *.conf file (e.g. idea.conf) under /etc/sysctl.d/ directory:

fs.inotify.max_user_watches = 524288

  1. Then run this command to apply the change:

sudo sysctl -p --system

Community
  • 1
  • 1
  • I did this while it was scanning (and taking ages) - once I `sysctl`'d I saw the progress bar shoot to 100%. Debian 8. – cpb2 Jul 02 '18 at 19:26
1

I ended up going to the .idea folder of the project and deleting it in order to keep it from hanging when it starts. Then made any appropriate changes to keep it from indexing unnecessary files.

BrokenRobot
  • 927
  • 2
  • 16
  • 34
-2

Deleting and reinstalling Pycharm 4.0.5 fixed this for me.

W.P. McNeill
  • 14,911
  • 10
  • 67
  • 100
  • 1
    I'm sure there is always a better solution instead of restarting, removing and so on my dear friend. Jaanus' answer is one of the solutions – Mojtaba Yousefi Sep 01 '16 at 07:13