msg109109 - (view) |
Author: Giuseppe Ottaviano (ot) |
Date: 2010-07-02 13:43 |
With a fresh install from python-2.7rc2.amd64.msi (rc1 is also affected) multiprocessing gives the following error: Python 2.7rc2 (r27rc2:82154, Jun 22 2010, 21:22:29) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import multiprocessing >>> multiprocessing.Pool() Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\multiprocessing\__init__.py", line 227, in Pool return Pool(processes, initializer, initargs, maxtasksperchild) File "C:\Python27\lib\multiprocessing\pool.py", line 89, in __init__ self._setup_queues() File "C:\Python27\lib\multiprocessing\pool.py", line 181, in _setup_queues from .queues import SimpleQueue File "C:\Python27\lib\multiprocessing\queues.py", line 22, in from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition File "C:\Python27\lib\multiprocessing\synchronize.py", line 22, in from multiprocessing.forking import assert_spawning, Popen File "C:\Python27\lib\multiprocessing\forking.py", line 158, in from ._multiprocessing import win32, Connection, PipeConnection ImportError: No module named _multiprocessing I noticed that _multiprocessing.lib is not in Lib/multiprocessing/ but in libs/, so I don't know why there is a relative import here. Changing all the occurrences to from _multiprocessing import ... everything works fine. |
|
|
msg109125 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2010-07-02 20:05 |
Martin, any ideas? |
|
|
msg109163 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2010-07-03 08:37 |
Here is the problem: there is no module multiprocessing._multiprocessing; _multiprocessing is a global module. However, multiprocessing/__init__.py imports _multiprocessing, providing multiprocessing._multiprocessing as a valid attribute. sys.modules['multiprocessing._multiprocessing'] is None. Now, on Windows, for some reason, from ._multiprocessing import win32 is used. In 2.6, this used to work. In 2.7, due to r81380, it stopped working (i.e. if I revert r81380, it works again). Adding Brett to the nosy list, as he made this change. |
|
|
msg109164 - (view) |
Author: Paul Moore (paul.moore) *  |
Date: 2010-07-03 08:43 |
Martin's analysis (and the description of the commit he refers to) indicates that the correct fix is Cuiseppe's suggestion to change the relative imports to absolute: from _multiprocessing import ... as the previous code was only working because, as a result of the bug fixed in r81380, from ._multiprocessing was falling back to this form anyway. |
|
|
msg109165 - (view) |
Author: Paul Moore (paul.moore) *  |
Date: 2010-07-03 08:58 |
Here's a patch implementing the suggested change. test_multiprocessing passes. I am just running the full test suite now. |
|
|
msg109169 - (view) |
Author: Paul Moore (paul.moore) *  |
Date: 2010-07-03 09:21 |
Full test suite also looks OK. |
|
|
msg109178 - (view) |
Author: Jesse Noller (jnoller) *  |
Date: 2010-07-03 12:15 |
the patch looks good to me - unless someone beats me to it, I'm going to commit it shortly to fix 2.7 |
|
|
msg109180 - (view) |
Author: Jesse Noller (jnoller) *  |
Date: 2010-07-03 12:26 |
Pushed it in r82489 - worked for me on Linux and OS/X. Please let me know if anything else comes up. |
|
|