Oh SNAP!
For years, I have been using NetworkX and hadn’t found any good substitute which has fast execution as CPP with rapid development as python. SNAP is a powerful tool which is aimed to be built this direction. For researches in network science, it provides tools to do general purpose and high performance system for analysis and manipulation of large networks.
Installing SNAP-python in Linux, Mac OS X and Windows is given here in this website.
Sometimes when you are working on a library that is still under development it is better to use virtualenv. A Virtual Environment, put simply, is an isolated working copy of Python which allows you to work on a specific project without worry of affecting other projects. For more details about virtualenv please take a look at this.
I faced certain problems with virtualenv and SNAP with Mac OS X 10.9.3. After reading few manuals on shared libraries, I could resolve this.
Here is the problem I faced:
1 2 3 |
|
So I thought of writing a step by step blog to help users to install SNAP successfully with virtualenv.
To create a virtualenv directory :
1
|
|
Change your working directory to snap. Activate virtualenv and then install numpy, graphviz.
1 2 3 4 |
|
Install gnuplot with homebrew. Download and install python extension for gnuplot within the virtualenv snap. Now comes the last step of downloading and installing SNAP.py library. Download SNAP repository from the website and place it in the working directoy (snap/).
1 2 3 |
|
Execute the following lines in python or in ipython.
1
|
|
If you are getting the any errors related to PyThreadState_Get, then do the following.
1
|
|
install_name_tool is used in Mac OS X to change dynamic shared library install names. Now try to run the snap example files. Voila! It should work.