title: Wikipedia extractor problem ValueError: cannot find context for 'fork'
body: <p>My aim is to get plain text (without links, tags, parameters and other trash, only articles text) from wikipedia xml dumps (<a href="https://dumps.wikimedia.org/backup-index.html" rel="nofollow noreferrer">https://dumps.wikimedia.org/backup-index.html</a>). I found WikiExtractor python script on GitHub (<a href="https://github.com/attardi/wikiextractor" rel="nofollow noreferrer">https://github.com/attardi/wikiextractor</a>). After downloaing and installing it (i use PyCharm IDE, Windows 10) i tried to get it started with</p>
  <p><code>wikiextractor -cb 250K -o extracted D:\Wiki_dumps\ruwiktionary-20211120-pages-articles-multistream.xml.bz2</code></p>
  <p>but then (after preprocessing) i got following error</p>
  <blockquote>
  <p>raise ValueError('cannot find context for %r' % method) from None
  ValueError: cannot find context for 'fork'</p>
  </blockquote>
  <p>I tried to change the parameter in the following function from &quot;fork&quot; to &quot;spawn&quot; (advice from the internet)</p>
  <p><code>Process = get_context(&quot;fork&quot;).Process</code></p>
  <p>but this only leads to</p>
  <blockquote>
  <p>TypeError: cannot pickle '_io.BufferedWriter' object</p>
  </blockquote>
  <p>I have no idea how to fix it or what it might be related to</p>
  <p>Here is full stack trace:</p>
  <blockquote>
  <p>INFO: Preprocessing 'D:\Wiki_dumps\ruwiktionary-20211120-pages-articles-multistream.xml.bz2' to collect template definitions: this may take some time.</p>
  <p>INFO: Preprocessed 100000 pages</p>
  <p>...</p>
  <p>INFO: Preprocessed 2300000 pages</p>
  <p>INFO: Loaded 36839 templates in 209.9s</p>
  <p>INFO: Starting page extraction from D:\Wiki_dumps\ruwiktionary-20211120-pages-articles-multistream.xml.bz2.</p>
  <p>Traceback (most recent call last):</p>
  <p>File &quot;C:\Users\Shurup\AppData\Local\Programs\Python\Python310\lib\runpy.py&quot;, line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,</p>
  <p>File &quot;C:\Users\Shurup\AppData\Local\Programs\Python\Python310\lib\runpy.py&quot;, line 86, in _run_code
  exec(code, run_globals)</p>
  <p>File &quot;C:\Users\Shurup\PycharmProjects\pythonProject\venv\Scripts\wikiextractor.exe_<em>main</em>_.py&quot;, line 7, in </p>
  <p>File &quot;c:\users\shurup\pycharmprojects\pythonproject\venv\lib\site-packages\wikiextractor\WikiExtractor.py&quot;, line 640, in main
  process_dump(input_file, args.templates, output_path, file_size,</p>
  <p>File &quot;c:\users\shurup\pycharmprojects\pythonproject\venv\lib\site-packages\wikiextractor\WikiExtractor.py&quot;, line 359, in process_dump
  Process = get_context(&quot;fork&quot;).Process</p>
  <p>File &quot;C:\Users\Shurup\AppData\Local\Programs\Python\Python310\lib\multiprocessing\context.py&quot;, line 239, in get_context
  return super().get_context(method)</p>
  <p>File &quot;C:\Users\Shurup\AppData\Local\Programs\Python\Python310\lib\multiprocessing\context.py&quot;, line 193, in get_context
  raise ValueError('cannot find context for %r' % method) from None</p>
  <p>ValueError: cannot find context for 'fork'</p>
  </blockquote>
  <p>Here is stack trace with &quot;spawn&quot; instead of &quot;fork&quot; parameter</p>
  <p><a href="https://i.stack.imgur.com/ZxiSO.jpg" rel="nofollow noreferrer">&quot;spawn&quot; parameter stack trace</a></p>