Title: multiprocessing build fails on AIX - /dev/urandom (or equivalent) not found
Type: compile error Stage: needs patch
Components: Build, Extension Modules Versions: Python 3.1, Python 2.6
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jnoller Nosy List: davidnarayan, jnoller, srid
Priority: normal Keywords: patch

Created on 2009-08-04 19:27 by srid, last changed 2010-10-29 16:04 by jnoller. This issue is now closed.

File name Uploaded Description Edit
multiprocessing-urandom-fallback.patch davidnarayan, 2009-12-03 13:17 Patch that includes a fallback to the 'random' module if os.urandom() is not available.
Messages (9)
msg91270 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-08-04 19:27
./Modules/ld_so_aix cc_r -qlanglvl=ansi -bI:Modules/python.exp build/
_multiprocessing/multiprocessing.o build/temp
rocessing/socket_connection.o build/temp.aix-5.1-2.6/home/apy/rrun/
erpc-apyee26-rrun/python/Modules/_multiprocessing/semaphore.o -o build/
*** WARNING: importing extension "_multiprocessing" failed with <type 
'exceptions.NotImplementedError'>: /dev/u
random (or equivalent) not found
msg91319 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-08-05 13:13
Without access to an AIX machine, and even with it (I'm not an AIX guy by 
any stretch) it's going to be virtually impossible for me to fix this. A 
patch would be appreciated.
msg91343 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-08-06 01:18
I suppose multiprocessing invokes `os.random` somewhere. And os.random 
fails on AIX for obvious reasons:

>>> os.urandom(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/srid/ActivePythonEE-", line 755, in urandom
    raise NotImplementedError("/dev/urandom (or equivalent) not found")
NotImplementedError: /dev/urandom (or equivalent) not found

Why should multiprocessing require `urandom` at all? Can't it fallback 
to os.random, if os.urandom is unavailable?

except NotImplementedError:
    urandom = os.urandom
    urandom = os.random
msg95930 - (view) Author: David Narayan (davidnarayan) Date: 2009-12-03 13:17
This is a patch that I have used on AIX. The idea for this patch came
from This patch was created against Python 2.6.4.
msg101590 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-03-23 18:38
This also breaks pydoc on AIX (Python 2.6.5).

help> modules pydoc

Here is a list of matching modules.  Enter any module name to get more help.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/qatest/APy/lib/python2.6/", line 438, in __call__
    return*args, **kwds)
  File "/home/qatest/APy/lib/python2.6/", line 1722, in __call__
  File "/home/qatest/APy/lib/python2.6/", line 1740, in interact
  File "/home/qatest/APy/lib/python2.6/", line 1760, in help
  File "/home/qatest/APy/lib/python2.6/", line 1865, in listmodules
  File "/home/qatest/APy/lib/python2.6/", line 1965, in apropos
    ModuleScanner().run(callback, key)
  File "/home/qatest/APy/lib/python2.6/", line 1930, in run
    for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
  File "/home/qatest/APy/lib/python2.6/", line 110, in walk_packages
  File "/home/qatest/APy/lib/python2.6/multiprocessing/", line 63, in <module>
    from multiprocessing.process import Process, current_process, active_children
  File "/home/qatest/APy/lib/python2.6/multiprocessing/", line 286, in <module>
    _current_process = _MainProcess()
  File "/home/qatest/APy/lib/python2.6/multiprocessing/", line 283, in __init__
    self._authkey = AuthenticationString(os.urandom(32))
  File "/home/qatest/APy/lib/python2.6/", line 756, in urandom
    raise NotImplementedError("/dev/urandom (or equivalent) not found")
NotImplementedError: /dev/urandom (or equivalent) not found
msg105832 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-05-15 22:04
Looks like this has been fixed, at least on Python trunk (2.7).
msg119554 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2010-10-25 14:18
Sridhar can you confirm if this is still a problem on 3.2?
msg119911 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-10-29 15:54
No, this is not an issue for me on Python 3.2 and AIX 5.1.
msg119913 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2010-10-29 16:04
Closing per Sridhar
Date User Action Args
2010-10-29 16:04:04jnollersetstatus: open -> closed

messages: + msg119913
2010-10-29 15:54:46sridsetmessages: + msg119911
versions: - Python 2.7, Python 3.2
2010-10-25 14:18:41jnollersetmessages: + msg119554
2010-05-15 22:04:36sridsetmessages: + msg105832
2010-03-23 18:38:45sridsetmessages: + msg101590
2009-12-03 13:17:44davidnarayansetfiles: + multiprocessing-urandom-fallback.patch

nosy: + davidnarayan
messages: + msg95930

keywords: + patch
2009-08-06 01:18:43sridsetmessages: + msg91343
2009-08-05 13:13:25jnollersetmessages: + msg91319
2009-08-05 10:17:13pitrousetversions: + Python 3.1, Python 2.7, Python 3.2
nosy: + jnoller

priority: normal
assignee: jnoller
stage: needs patch
2009-08-04 19:27:31sridcreate