title: Python Multiprocessing - Library import failed when calling a function in Windows OS
body: <p>I use the Python multiprocessing module to speed up a geoprocessing function in my script. To this end, I use OGR, OSR and GDAL libraries. Multiprocessing works fine in Linux OS. However, when I execute the script in Windows OS, the multiprocessing.Process command doesn't start any function. Instead, I get the following error message, indicating that the OGR, OSR, and GDAL libraries (they are distributed in one package) are not found:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "C:\Python27\ArcGIS10.4\lib\multiprocessing\forking.py", line 380, in main
      prepare(preparation_data)
    File "C:\Python27\ArcGIS10.4\lib\multiprocessing\forking.py", line 495, in prepare
      '__parents_main__', file, path_name, etc
    File "C:\Christian\Projects\2016-07 Geodesic Polygon Buffer\jo\Geodesic_Buffering_Areas18_2-Multicore.py", line 1, in &lt;module&gt;
      import multiprocessing, ogr, osr
    File "C:\Python27\ArcGIS10.4\lib\site-packages\ogr.py", line 2, in &lt;module&gt;
      from osgeo.gdal import deprecation_warn
    File "C:\Python27\ArcGIS10.4\lib\site-packages\osgeo\__init__.py", line 21, in&lt;module&gt;
      _gdal = swig_import_helper()
    File "C:\Python27\ArcGIS10.4\lib\site-packages\osgeo\__init__.py", line 17, inswig_import_helper
      _mod = imp.load_module('_gdal', fp, pathname, description)
  ImportError: DLL load failed: The specified procedure could not be found.
  </code></pre>
  
  <p>This only happens when a function is called from p.start(): </p>
  
  <pre><code>import multiprocessing, ogr, osr
  
  def func(abc):
      print abc
  
  if __name__ == '__main__':
      p = multiprocessing.Process(target = func, args=('xyz',))
      p.start() # This is where I get the error
      p.join()
  </code></pre>
  
  <p>When I run the script without importing the OGR and OSR libraries, func() is called from p.start() and I don't get any error messages. However, the import of both libraries works fine in the main section. The error message only shows up when multiprocessing calls a function.</p>
  
  <p>Edit: Importing the libraries works outside multiprocessing:</p>
  
  <pre><code>Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import ogr
  &gt;&gt;&gt; import osr
  &gt;&gt;&gt; import osgeo.gdal
  &gt;&gt;&gt; import multiprocessing
  &gt;&gt;&gt; import something
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named something
  &gt;&gt;&gt;
  </code></pre>
  
  <p>What is the reason for this error? Can this be related to forking?  How can I use multiprocessing in Windows OS with OGR, OSR and GDAL libraries?  </p>
  
  <p>I use Python 2.7.10 (32 bit) in Windows and Python 2.7.6 (64 bit) in Linux. </p>