[Cython] Suggested action for "Python.h not found"

Elizabeth A. Fischer elizabeth.fischer at columbia.edu
Thu Jun 9 01:37:00 EDT 2016


>
> Or maybe by default it can just point the user to an Installation Page
> which explains in detail what needs to be done to get those headers for
> various systems ?


I think having this information on an installation instruction page is
definitely a good idea.  I don't think it makes sense to put in every
single error message that users should consult the installation
instructions; that should be a given.

This would help so that non-developers can use cython based packages easily


It is my belief that non-developers should not be manually building
software.  Nor should developers be doing that; if you're saying
"./configure" yourself, it's like programming assembly code.

There are many ways to install Cython without manually building:

* Use your Linux distro's Cython, if you're happy with that.  This is often
not ideal.  Because the Linux distro you're using, or forced to use by your
IT department, doesn't contain the compilers / Python / etc. needed for
your project.  Or upgrading your Linux ends up breaking your applications
that depend on it.  Best choice is to not depend on your distro for
software you really care about.

* If you're on a Mac, install with MacPorts.

* If you're on Linux (and maybe Mac too), install with Spack.  This can be
as easy as typing:
         spack install py-cython

https://github.com/llnl/spack

Spack gives you complete control over your compiler.  This is important if
you're  building Python extensions, especially C++-based extensions, which
must be built with the same compilers use to build Python.

I use Spack to build my complete software stack: the application software I
work on requires about 50 dependencies to build, and another ~20 Python
dependencies to analyze the output.  That includes the full Numpy/Scipy
stack.  Spack makes it easy for me to use consistent compiler and libraries
for Python and my libraries.  I've had success making Spack-based install
instructions that others (non-developers) can follow and get my software
stack installed on their systems:
    https://github.com/citibeth/icebin


--- Elizabeth


On Wed, Jun 8, 2016 at 1:25 PM, Robert Bradshaw <robertwb at gmail.com> wrote:

> +1, want to submit a pull request?
>
> On Tue, Jun 7, 2016 at 11:28 PM, Abdeali Kothari
> <abdealikothari at gmail.com> wrote:
> > Hi,
> >
> > Currently, when a user installs cython, if the Python headers are not
> found,
> > an error message saying "Python.h: no such file or directory" is shown
> > (Example: https://justpaste.it/v0gz). Would it be possible to suggest an
> > action to install the headers ?
> >
> > I found http://trac.cython.org/ticket/247 which is quite old, and makes
> the
> > error message easier to find, but doesn't recommend a solution.
> >
> > `sys.platform`, `platform.linux_distribution` or `distro`[1] can be used
> to
> > find which OS, platform, etc is and use that to suggest a command like:
> >
> >     if sys.version_info < (3, ) and sys.platform.startswith("linux") and
> > platform.linux_distribution()[0] in ("ubuntu", "debian"):
> >         print("Python headers were not found. On Debian/Ubuntu, `sudo
> > apt-get install python-dev` should install the Python headers.")
> >
> >     elif sys.version_info < (3, ) and sys.platform.startswith("linux")
> and
> > platform.linux_distribution()[0] in ("ubuntu", "debian"):
> >         print("Python headers were not found. On Debian/Ubuntu, `sudo
> > apt-get install python3-dev` should install the Python3 headers.")
> >
> > This would help so that non-developers can use cython based packages
> easily
> > as it provides helpful instructions on what to do. Currently, you
> > essentially search for the error message and go to one of the
> forums/blogs
> > explaining what can be done.
> >
> > Or maybe by default it can just point the user to an Installation Page
> which
> > explains in detail what needs to be done to get those headers for various
> > systems ?
> >
> > [1] - https://pypi.python.org/pypi/distro
> >
> > _______________________________________________
> > cython-devel mailing list
> > cython-devel at python.org
> > https://mail.python.org/mailman/listinfo/cython-devel
> >
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160609/f3ed4c69/attachment.html>


More information about the cython-devel mailing list