New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installation issue: python is built without curses module #34872
Comments
No idea how to solve this, I don't encounter this same issue on my system so I don't know how to reproduce it. I feel like we've seen bug reports like this in the past, not sure if we resolved any of those. |
@adamjstewart So your spack-built python can import curses without issues? What version of spack was it built with and what version of python is it? Maybe I can circumvent it by using a different version. I find it surprising that you can't reproduce the behavior, since we've seen it on three different machines now. |
|
Thanks—I'm grasping at straws here, but maybe Mac vs. Linux/Ubuntu makes a difference here? Does one of the devs have access to a Linux machine to test if the behavior is reproducible? |
I can reproduce Let me tell you this: Python's build system is an absolute atrocity. @adamjstewart do you know why we use |
Woah! setup.py is removed in cpython. They've come to senses! |
Bisected to python/cpython@81dca70 I think we shouldn't fix this issue here. If you follow the horrible setup.py logic you'll find that the curses library is added if it's not dynamically linked to readline, which Spack does. |
@haampie Thanks for looking into this. So the answer is that in python 3.12 the spack install should work as expected? Do you have a suggested workaround for the meantime until 3.12 is released? I'm not sure everyone would be happy running production code on alpha versions of python... Is linking an external, working python installation to spack a sensible workaround? |
Could we add a dependency on static readline? |
I agree that waiting for a 3.12 release isn't a sufficient fix. |
3.12 removes Does Spack have the ability to patch CPython's source code before building it? If so, I'd suggest patching to add a https://github.com/python/cpython/blob/3.9/setup.py#L972 is the logic for locating ncurses. The logic ought to be hitting https://github.com/python/cpython/blob/3.9/setup.py#L1107 for this to be missing so it's not as simple as "readline was present". Do we have ncurses available in the build environment? :) |
Yes, we can patch statically (apply a
Yes, Spack's Python package depends on both readline and ncurses when the readline module is requested (by default). I'll try adding this patch. |
How is this different from setting
We don't want to crash just because tkinter isn't being built. |
/me nods. PYTHONSTRICTEXTENSIONBUILD's checks happen after the build, but I guess it achieves the same goals as the patch I suggested. :) |
If I'm following the discussion correctly, then the patch idea is shelved again (because it would just let the build fail without solving the problem?) and the only solution on the table for the time being is to
|
I closed the issue because https://github.com/python/cpython/blob/5e52778b1a2a86fe89578b957b1898d165a350fe/setup.py#L1107 we hit this branch, so it's expected that the _curses module is missing. |
Which is ultimately due to python/cpython#51633. I haven't had the time yet to comb through the issue and see if there's relevant information for our problem. |
If I had to guess it's ncurses providing two ABI-incompatible libraries; same set of symbols, but one expects Our ncurses package looks questionable, cause it builds both interfaces. Note that even if we fix our curses/readline packages, things could still break when using external readline or ncurses. |
I did a little more digging. So, Extra confusion, libtinfo.a and libtinfow.a don't provide the same set of symbols, for example
which was reported in this thread, where they also talk about Python troubles with curses: https://lists.gnu.org/archive/html/bug-ncurses/2018-02/msg00045.html. In any case, they promote using one Again, it doesn't really help us if we support both external and spack curses / readline 😩 |
@haampie I took a look at
Notice the line Have you tried fudging with these |
Indeed, adding the following brief patch to
@haampie Can you double-check? Edit: See PR in #35092. |
Can anyone else test #35092? |
Steps to reproduce the issue
I tested the following combinations, which all resulted in the same behavior:
python@3.10.8 ^ncurses@6.3
python@3.8.10 ^ncurses@6.3
python@3.8.10 ^ncurses@6.2
The concretizations, as reported by
spack spec -I python@...
, are as follows:Error message
No errors are reported during the build process itself (but see below), but the curses module is quasi-tacitly not built, such that
spack load python; python -c "import curses"
exits withHowever, inspection of the build log (starting at line 1257) reveals the following:
despite lines 707 through 712 stating:
Information on your system
Also tested using
0.20.0.dev0 (c3e61664cfa5e9d989f8c9b7854fd4296858a8b0)
.Additional information
spack-build-env.txt
spack-build-out.txt
The regular system installation of python has no problem importing and using the curses and readline modules, of course.
As an additional check, I copied the tarball from one of the spack staging directories and successfully built python from that by specifying
LDFLAGS
andCPPFLAGS
to point to the system installations ofncurses
(andreadline
, because I was wondering if the latter led to conflicts, which it apparently did not in the fully manual install).Package maintainers: @adamjstewart @pradyunsg @scheibelp @skosukhin
General information
spack debug report
and reported the version of Spack/Python/Platformspack maintainers <name-of-the-package>
and @mentioned any maintainersThe text was updated successfully, but these errors were encountered: