Skip to content

Importing the astropy.table module prevents from setting a multiprocessing start method (caused by numcodecs in io.fits) #16351

@mboquien

Description

@mboquien

Description

Importing the astropy.table triggers an exception if one uses multiprocessing.set_start_method() afterwards

Expected behavior

Importing the astropy.table does not trigger an exception if one uses multiprocessing.set_start_method() afterwards

How to Reproduce

The following code reproduces the issue.

import multiprocessing as mp
import astropy.table

mp.set_start_method('spawn')

It generates the following backtrace

Traceback (most recent call last):
  File "/home/mederic/scratch/start_method/test.py", line 4, in <module>
    mp.set_start_method('spawn')
  File "/usr/lib/python3.12/multiprocessing/context.py", line 247, in set_start_method
    raise RuntimeError('context has already been set')
RuntimeError: context has already been set

Versions

Linux-6.8.7-arch1-1-x86_64-with-glibc2.39
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417]
astropy 6.0.0
Numpy 1.26.4
pyerfa 2.0.1.1
Scipy 1.13.0
Matplotlib 3.8.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions