"EMFILE: too many open files" error shows up when you open a project or do some operation in a project

If you have too many items such as dataframes, charts etc. in the project, you may see the EMFILE: too many open files error when you open a project or do some operation in a project.

You can restart the Exploratory Desktop, open the project, and remove unnecessary items from the project to avoid this problem. If restarting the Exploratory Desktop doesn’t fix it, please try restarting the OS and starting the Exploratory Desktop.

If you still see the problem, you can increase limits for the maximum number of open files in your operating system.

Mac OS

Step 1: Check the Current Limits

You can start by checking the current limits for the maximum number of open files.

  1. Open Terminal.
  2. Check the current limits:
    ulimit -n
    sysctl kern.maxfiles
    sysctl kern.maxfilesperproc
    

Step 2: Increase the Limits

You can update the system files to increase the limits.

  1. Edit the /etc/sysctl.conf file:

    • Open the file for editing (create it if it doesn’t exist):
      sudo nano /etc/sysctl.conf
      
    • Add the following lines to set the maximum number of open files. For example:
      kern.maxfiles=65536
      kern.maxfilesperproc=65536
      
  2. Edit the Profile

    • Open the /etc/profile file (or /etc/zprofile if you’re using Zsh):
      sudo nano /etc/profile
      
    • Add the ulimit command at the bottom. For example:
      ulimit -n 65536
      
    • Save and close the file.

Step 3: Reboot the System

Reboot your Mac to apply the changes. After rebooting, open a terminal and verify the changes:

ulimit -n

Windows

In Windows, there is no direct configuration for the limits for the maximum number of open files. But, you can update the desktop heap size that indirectly influences how many file handles a process can open. Note that this operation directly updates the system configuration. Please do it carefully.

Step 1: Open the Registry Editor

  • Press Win + R, type regedit, and press Enter.

Step 2: Navigate to the Registry Key

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems

Step 3: Increase the Limits

  • In the right pane, locate the Windows string value.
  • Double-click it to edit.
  • Look for a part of the value that looks like SharedSection=1024,20480,768. This represents heap sizes for desktop objects.
  • Increase the second and third values. Do not set too large values. (e.g., SharedSection=1024,30720,1024).

Step 4: Reboot the System

  • After making changes, reboot your computer to apply them.
1 Like