Skip to content

freeze_support() error #3

@sara-wennersten

Description

@sara-wennersten

### Code that I run:

mkdir -p /Users/sarawennersten/imputation_accuracy_calculator-master
cd /Users/sarawennersten/imputation_accuracy_calculator-master
python3 Compare_imputation_to_WGS.py --ga chr1_merged.vcf.gz --imputed chr1.dose.vcf.gz --wgs chr1_genotypes.vcf.gz

### Files that I used (in both vcf.gz and vcf.gz.tbi formats)

  • pre-imputation file: chr1_merged
  • post-imputation file: chr1.dose
  • whole genome sequencing data (1000GP_Phase3): chr1_genotypes

### Error that shows up: (my apologies for the length - this series repeats over and over and doesn't stop until I exit the terminal...perhaps an issue with iteration?):

Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Processing chunk: 1 Max rows per chunk: 10000
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Processing  264 imputed samples
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Processing  264 imputed samples
Namespace(ga=['chr1_merged.vcf.gz'], wgs=['chr1_genotypes.vcf.gz'], imputed=['chr1.dose.vcf.gz'], ref='', max_total_rows=10000, max_per_core=1000, min_per_core=100, sout='', vout='', xmode='False')
10000 1000 100
Processing  264 imputed samples
Processing chunk: 1 Max rows per chunk: 10000
Processing chunk: 1 Max rows per chunk: 10000
Processing chunk: 1 Max rows per chunk: 10000
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/sarawennersten/imputation_accuracy_calculator-master/Compare_imputation_to_WGS.py", line 1233, in <module>
    main()
  File "/Users/sarawennersten/imputation_accuracy_calculator-master/Compare_imputation_to_WGS.py", line 1224, in main
    results = load_file_chunks(my_ncores)
  File "/Users/sarawennersten/imputation_accuracy_calculator-master/Compare_imputation_to_WGS.py", line 727, in load_file_chunks
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
Processing chunk: 1 Max rows per chunk: 10000
    _fixup_main_from_path(data['init_main_from_path'])
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/sarawennersten/imputation_accuracy_calculator-master/Compare_imputation_to_WGS.py", line 1233, in <module>
    main()
  File "/Users/sarawennersten/imputation_accuracy_calculator-master/Compare_imputation_to_WGS.py", line 1224, in main
    results = load_file_chunks(my_ncores)
  File "/Users/sarawennersten/imputation_accuracy_calculator-master/Compare_imputation_to_WGS.py", line 727, in load_file_chunks
    pool = mp.Pool(ncores)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 119, in Pool
    pool = mp.Pool(ncores)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 212, in __init__
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 212, in __init__
    self._repopulate_pool()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 303, in _repopulate_pool
    self._repopulate_pool()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 326, in _repopulate_pool_static
    w.start()
    self._popen = self._Popen(self)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
    return Popen(process_obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    self._popen = self._Popen(self)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
    super().__init__(process_obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
    return Popen(process_obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
    self._launch(process_obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 42, in _launch
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
    self._launch(process_obj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    _check_not_importing_main()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
    raise RuntimeError('''
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.
    _check_not_importing_main()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions