Increase inotify watches

_$: cat /proc/sys/fs/inotify/max_user_watches
10240

a) Temporarily

_$: sysctl fs.inotify.max_user_watches=16384

b) Permanently

/etc/sysctl.conf:
-----------------
...
fs.inotify.max_user_watches=16384
_$: sysctl -p /etc/sysctl.conf

Check it has indeed changed:

_$: cat /proc/sys/fs/inotify/max_user_watches
16384

Increase inotify instances

a) Temporarily

_$: sysctl fs.inotify.max_user_instances=9126

Alternatively, you can also do this:

_$: sudo sh -c "echo '9126' > /proc/sys/fs/inotify/max_user_instances"

b) Permanently

/etc/sysctl.conf:
-----------------
...
fs.inotify.max_user_instances=16384
_$: sysctl -p /etc/sysctl.conf

Check it has indeed changed:

_$: cat /proc/sys/fs/inotify/max_user_instances
16384

Create inotify watches

To check that we have not reached the maximum we can try to manually create inotify watches:

_$: inotifywatch -v /home/<user>/code/[...]/file.py
Establishing watches...
Total of 1 watches.
Finished establishing watches, now collecting statistics.

# Use [Ctrl + C]
^CNo events occurred.

Had we reached the maximum, the output will be similar to this:

_$: inotifywatch -v /home/<user>/code/[...]/file.py
Couldn't initialize inotify.  Are you running Linux 2.6.13 or later,
and was the CONFIG_INOTIFY option enabled when your kernel was
compiled?  If so, something mysterious has gone wrong.