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

Ian ian.wood at anu.edu.au
Fri Feb 20 08:17:04 CET 2015


I played around some more, actually managed to install with python 2.7.3 (Ubuntu 12.04) and import in python, but attempting the example in the user guide I wasn't able to import the graph info (exception below if you're interested).

I'm guessing that the current version of NetworkIt simply isn't compatible with python 2.7.  If that's already in the docs, I missed it..
Anyway, I'm done for the day, 
Tomorrow python 3 (:
Cheers
Ian


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-778fab29eb40> in <module>()
----> 1 G = readGraph("/home/drevicko/Downloads/PGPgiantcompo.graph", Format.METIS)

/scratch/bin/NetworKit/networkit/graphio.pyc in readGraph(path, fileformat, **kwargs)
    105                         commentPrefix and continuous are optional
    106 	"""
--> 107         reader = getReader(fileformat,**kwargs)
    108 
    109 

/scratch/bin/NetworKit/networkit/graphio.pyc in getReader(fileformat, **kwargs)
     74                         Format.METIS:                   METISGraphReader(),
     75                         Format.GraphML:                 GraphMLReader(),
---> 76                         Format.SNAP:                    EdgeListReader('\t',0,'#',False),
     77                         Format.EdgeListCommaOne:        EdgeListReader(',',1,),
     78                         Format.EdgeListSpaceOne:        EdgeListReader(' ',1),

/scratch/bin/NetworKit/_NetworKit.so in _NetworKit.EdgeListReader.__cinit__ (networkit/_NetworKit.cpp:14345)()

TypeError: an integer is required


On 20/02/2015, at 1:15 PM, Ian <ian.wood at anu.edu.au> wrote:

> OK, it's proving difficult to install with pip (as opposed to pip3, which I've not tried yet - will it be available to python 2.7 if I install with pip3??)
> 
> Anyway, I cloned the repo and fixed the DEVNULL problem below, installed gcc and g++ 4.8 (from the ubuntu-toolchain-r/test ppa for Ubuntu), installed SCons (which I had to install with pip --egg … due to a bug which is fixed but not in the current version on pip), but now when I install from my networkit clone, it freezes. htop shows no activity in the pip process.. I'll leave it trying over lunch, but I'm not hopefull.
> 
> 
> On 20/02/2015, at 12:24 PM, Ian <ian.wood at anu.edu.au> wrote:
> 
>> 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/0afac601/attachment.html>


More information about the NetworKit mailing list