[Networkit] pip install fails with "cannot import name DEVNULL"

Ian ian.wood at anu.edu.au
Fri Feb 20 02:24:04 CET 2015


When I try to install networkit with pip, i get 

    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-18HYDO/networkit/setup.py", line 2, in <module>
        from setup_util import *
      File "setup_util.py", line 3, in <module>
        from subprocess import DEVNULL
    ImportError: cannot import name DEVNULL
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
    
      File "<string>", line 20, in <module>
    
      File "/tmp/pip-build-18HYDO/networkit/setup.py", line 2, in <module>
    
        from setup_util import *
    
      File "setup_util.py", line 3, in <module>
    
        from subprocess import DEVNULL
    
    ImportError: cannot import name DEVNULL

I had a look at the docs for the subprocess module, and it seems subprocess.DEVNULL is new in python 3, and doesn't exist in python 2.7

Instead, we could use os.devnull as per this SO answer. I'm a bit busy to setup a pull request on algohub, but adding "with open(os.devnull,'w') as DEVNULL:" before line 90 in setup_util.py and removing line 3 would do it, or a try statement around line 3 and a mechanism to close DEVNULL when alls done…

Cheers
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20150220/ef1e1fe5/attachment.html>


More information about the NetworKit mailing list