[gdal-dev] Gdal2tiles, Python 3.9 and multiprocessing

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Nov 9 03:42:09 PST 2021


Hi,

Have a look at this gis.stackexchange question https://gis.stackexchange.com/questions/415925/error-in-gdal2tiles-with-processes.
Question is about using gdal2tiles with QGIS but the issue is reproduced also with OSGeo4w. Is there something changed in multiprocessing between Python versions 3.7 and 3.9, or is something else failing with errors:

RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\Scripts\gdal2tiles.py", line 11, in <module>
    sys.exit(main(sys.argv))
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\site-packages\osgeo_utils\gdal2tiles.py", line 3257, in main
    multi_threaded_tiling(input_file, output_folder, options)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\site-packages\osgeo_utils\gdal2tiles.py", line 3206, in multi_threaded_tiling
    pool = Pool(processes=nb_processes)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\multiprocessing\context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\multiprocessing\pool.py", line 212, in __init__
    self._repopulate_pool()

-Jukka Rahkonen-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211109/56dd0528/attachment.html>


More information about the gdal-dev mailing list