How to properly install a NumPy ufunc? How to properly install a NumPy ufunc? numpy numpy

How to properly install a NumPy ufunc?


According to the documentation "The __init__.py files are required to make Python treat the directories as containing packages". The setup.py in the Numpy documentation does not create this file, so Python does not import anything as it ignores this directory.

Solution: just add an empty __init__.py file in the /usr/local/lib/python2.7/dist-packages/npufunc_directory directory, for example with sudo touch __init__.py Then try:

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

Alternatively, add import npufunc to the __init__.py and then you can do:

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