How to install NodeBox for the console

I am working on OS X Mavericks and want to use NodeBox modules in Python scripts.

The message on how to install modules for the console dates back to 2009 and does not work anymore, as it relates to version 1.9.x (current 3.0.40). Also, the source of SVN is no more. Sources are available on GitHub.

Project cloning and launch:

ant run 

all i get is the build of the desktop version.

How to correctly install and run updated NodeBox modules in Python scripts?

+7
python python-module nodebox
source share
1 answer

As stated in the documents here in section 2. Installing the NodeBox module :

If you want to use NodeBox from the command line, you will have to install it. We currently recommend using Subversion to grab a copy:

svn co http://dev.nodebox.net/svn/nodebox/trunk/ nodebox
...
cd src
python setup.py install

we must establish the usual path from the source, but, as you say, the procedure is quite outdated. The source apparently moved from SVN to GitHub at https://github.com/nodebox/nodebox-pyobjc , as indicated in the download page and change the structure of the source package.

Let me grab the source and try to set it:

 $ git clone https://github.com/nodebox/nodebox-pyobjc.git $ cd nodebox-pyobjc $ python nodebox/setup.py install Traceback (most recent call last): File "nodebox/setup.py", line 17, in <module> import nodebox ImportError: No module named nodebox 

So setup.py needs to import the nodebox package, add the project root directory to the Python path so that the node package is found and try again:

 $ export PYTHONPATH=$PYTHONPATH:. $ python nodebox/setup.py install ... clang: error: no such file or directory: 'nodebox/ext/cGeo.c' clang: error: no input files error: command 'clang' failed with exit status 1 

Now it turns out that some lib paths in setup.py are wrong, nobody probably used this for a while while the libs were moving, but we can fix it:

 # ext_modules = [ # Extension('cGeo', ['nodebox/ext/cGeo.c']), # Extension('cPathmatics', ['nodebox/ext/cPathmatics.c']), # Extension('cPolymagic', ['nodebox/ext/gpc.c', 'nodebox/ext/cPolymagic.m'], extra_link_args=['-framework', 'AppKit', '-framework', 'Foundation']) # ] ext_modules = [ Extension('cGeo', ['libs/cGeo/cGeo.c']), Extension('cPathmatics', ['libs/pathmatics/pathmatics.c']), Extension('cPolymagic', ['libs/polymagic/gpc.c', 'libs/polymagic/polymagic.m'], extra_link_args=['-framework', 'AppKit', '-framework', 'Foundation']) ] 

Try again:

 $ python nodebox/setup.py install ... running install_egg_info Writing <python>/lib/python2.7/site-packages/NodeBox-1.9.7rc2-py2.7.egg-info $ pip list ... NodeBox (1.9.7rc2) ... 

Now the package has been successfully installed, and we can use it:

 $ python >>> import nodebox >>> dir(nodebox) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__', 'get_version'] >>> nodebox.__version__ '1.9.7rc2' 

In addition, you still have to manually install some dependencies in order for everything to work correctly, as indicated in setup.py itself:

 # We require some dependencies: # - PyObjC # - psyco # - py2app # - cPathMatics (included in the "libs" folder) # - polymagic (included in the "libs" folder) # - Numeric (included in the "libs" folder) # - Numpy (installable using "easy_install numpy") 

I have already created a pull request with fixed setup.py lib settings, see here .

Tested on OS X Mavericks (system version: OS X 10.9.3 (13D65), kernel version: Darwin 13.2.0) using Homebrew Python 2.7.6.

+2
source share

All Articles