python 2.7 - How to properly install a NumPy ufunc? -


i trying install example ufunc scipy docs when run python setup.py build or python setup.py install few warnings deprecated numpy api.

when run python setup.py install output:

$ python setup.py install running install running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompileroptions running build_src build_src building extension "npufunc_directory.npufunc" sources build_src: building npy-pkg config files running build_ext customize unixccompiler customize unixccompiler using build_ext building 'npufunc_directory.npufunc' extension compiling c sources c compiler: gcc -fno-strict-aliasing -ggdb -o2 -pipe -wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.x86_64/build=/usr/src/debug/python-2.7.8-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.x86_64/src/python-2.7.8=/usr/src/debug/python-2.7.8-1 -dndebug -g -fwrapv -o3 -wall -wstrict-prototypes creating build creating build/temp.cygwin-1.7.32-x86_64-2.7 compile options: '-i/usr/lib/python2.7/site-packages/numpy/core/include -i/usr/include/python2.7 -c' gcc: single_type_logit.c in file included /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,              single_type_logit.c:3: /usr/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "using deprecated numpy api, disable #defining npy_no_deprecated_api npy_1_7_api_version" [-wcpp] #warning "using deprecated numpy api, disable #defining npy_no_deprecated_api npy_1_7_api_version" creating build/lib.cygwin-1.7.32-x86_64-2.7 creating build/lib.cygwin-1.7.32-x86_64-2.7/npufunc_directory gcc -shared -wl,--enable-auto-image-base -l. build/temp.cygwin-1.7.32-x86_64-2.7/single_type_logit.o -l/usr/lib/python2.7/config -l/usr/lib -lpython2.7 -o build/lib.cygwin-1.7.32-x86_64-2.7/npufunc_directory/npufunc.dll running scons running install_lib copying build/lib.cygwin-1.7.32-x86_64-2.7/npufunc_directory/npufunc.dll -> /usr/lib/python2.7/site-packages/npufunc_directory running install_egg_info removing /usr/lib/python2.7/site-packages/npufunc_directory-0.0.0-py2.7.egg-info writing /usr/lib/python2.7/site-packages/npufunc_directory-0.0.0-py2.7.egg-info running install_clib customize unixccompiler 

running python setup.py build produces:

$ python setup.py build running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building extension "npufunc_directory.npufunc" sources build_src: building npy-pkg config files running build_ext customize unixccompiler customize unixccompiler using build_ext running scons 

if try import module get:

traceback (most recent call last):   file "<pyshell#0>", line 1, in <module>     import npufunc importerror: no module named npufunc 

does know how make work?

according documentation "the __init__.py files required make python treat directories containing packages". setup.py in numpy documentation not create file, python not import ignores directory.

solution: add empty __init__.py file in /usr/local/lib/python2.7/dist-packages/npufunc_directory directory, example sudo touch __init__.py try:

>>> npufunc_directory import npufunc >>> npufunc.logit(.5) 0.0 

alternatively, add import npufunc __init__.py , can do:

>>> import npufunc_directory >>> npufunc_directory.npufunc.logit(0.5) 0.0 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -