FileNotFoundError: 6 leaked semaphore objects to cleanup at shutdown

Viewed 1149

In simply creating a pool I received the following (endlessly looping error). Please note this is not the same problem as shown here as I haven't attempted to load any data. Paths abbreviated:

import multiprocessing
pool = multiprocessing.Pool()

FileNotFoundError: [Errno 2] No such file or directory: '/path/<input>'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/homebrew/anaconda3/envs/path/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/opt/homebrew/anaconda3/envs/path/python3.9/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/opt/homebrew/anaconda3/envs/path/python3.9/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/opt/homebrew/anaconda3/envs/path/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/opt/homebrew/anaconda3/envs/path/python3.9/multiprocessing/spawn.py", line 267, in run_path
    code, fname = _get_code_from_file(run_name, path_name)
  File "/opt/homebrew/anaconda3/envs/path/python3.9/multiprocessing/spawn.py", line 237, in _get_code_from_file
    with io.open_code(decoded_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/path/<input>'
/path/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 6 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
1 Answers

Oddly enough, you're not doing anything wrong. Downgrade to python 3.7 and the exact same code should work fine. See thread here.

Related