Github messages for voidlinux
 help / color / mirror / Atom feed
From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [ISSUE] [CLOSED] numpy headers symlink breaks using numpy in a venv
Date: Wed, 09 Mar 2022 21:33:53 +0100	[thread overview]
Message-ID: <20220309203353.ZNsxq_zoRPd2mG-x5vK49Q1PswlGSmH-QhliCC_m6-c@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-36062@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 2021 bytes --]

Closed issue by tornaria on void-packages repository

https://github.com/void-linux/void-packages/issues/36062

Description:
For some (unspecified) reason the numpy template contains this in its `post_install()`:
```
	# create compat symlinks for .h files
	vmkdir ${py3_inc}
	ln -sfr ${DESTDIR}/${py3_sitelib}/numpy/core/include/numpy \
		${DESTDIR}/${py3_inc}
```

This creates a symlink `/usr/include/python3.10/numpy -> ../../lib/python3.10/site-packages/numpy/core/include/numpy`

In effect this means that whenever one uses `-I/usr/include/python3.10` to add python headers, one is also adding system numpy headers.

The problem arises when one uses a different version of numpy installed in a venv. To compile against numpy headers one would add `-I$VENV/lib/python3.10/site-packages/numpy/core/include` to use those headers. However, when the `CFLAGS` has something like `-I/usr/include/python3.10 -I$VENV/lib/python3.10/site-packages/numpy/core/include` the symlink installed in the python include dir will take precedence.

This gives a runtime error, e.g. when system numpy is 1.22 (as in void) and venv numpy is 1.21 (as in sagemath) since those versions are binary-incompatible (the numpy.ndarray structure changed size).

A workaround is to ensure the numpy include dir always comes before the python include dir, but the issue is bound to resurface since controlling the order of stuff placed on CFLAGS is kind of difficult.

As a concrete example: sage-9.5 (current release) used to build ok on void linux but after numpy upgraded to 1.22 it no longer builds (this does NOT affect our template for sagemath -- we don't use a venv). See: https://trac.sagemath.org/ticket/33473.

Arguably, nothing else than python headers should be installed in `/usr/include/python3.10`; installing headers from other packages  there is forcing the use of a particular version of the package.

Note: debian/ubuntu also adds this symlink. I didn't find other distros that do  (I only looked at a few).

      parent reply	other threads:[~2022-03-09 20:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09 15:05 [ISSUE] " tornaria
2022-03-09 15:06 ` tornaria
2022-03-09 16:27 ` tornaria
2022-03-09 17:28 ` tornaria
2022-03-09 18:39 ` ahesford
2022-03-09 20:33 ` ahesford [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220309203353.ZNsxq_zoRPd2mG-x5vK49Q1PswlGSmH-QhliCC_m6-c@z \
    --to=ahesford@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).