#31160 closed enhancement (fixed)

Remove strict requirement for libreadline when building python3

Reported by: mkoeppe Owned by:
Priority: blocker Milestone: sage-9.4
Component: build Keywords:
Cc: dimpase, jhpalmieri Merged in:
Authors: Matthias Koeppe Reviewers: Dima Pasechnik, Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 6df6144 (Commits, GitHub, GitLab) Commit: 6df6144cd06af7691315a78550e1e1ff57f09820
Dependencies: Stopgaps:

Status badges

Description (last modified by mkoeppe)

Given that IPython is using prompt_toolkit for terminal interactions, we can probably remove the hard requirement for readline from the build of python3.

This would eliminate the build failures that we see reported occasionally related to ncurses/readline ("undefined symbol: UP", #31267).

Change History (23)

comment:1 Changed 15 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Moving this ticket to 9.4, as it seems unlikely that it will be merged in 9.3, which is in the release candidate stage

comment:2 Changed 13 months ago by mkoeppe

  • Description modified (diff)
  • Priority changed from minor to major

comment:3 Changed 13 months ago by mkoeppe

  • Branch set to u/mkoeppe/remove_strict_requirement_for_libreadline_when_building_python3

comment:4 Changed 13 months ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Commit set to de25ce550477a3c8efeb4e50c1b9c230c3908bbd
  • Status changed from new to needs_review

New commits:

de25ce5build/pkgs/python3/spkg-build.in, spkg-configure.m4: Do not check for the readline module

comment:5 Changed 12 months ago by dimpase

Does this mean we potentially will build Python without readline support (if this is possible at all)

comment:6 Changed 12 months ago by mkoeppe

Yes

comment:7 Changed 12 months ago by dimpase

  • Reviewers set to Dima Pasechnik
  • Status changed from needs_review to positive_review

OK

comment:8 Changed 12 months ago by mkoeppe

Thanks.

comment:9 Changed 12 months ago by tscrim

I think because of this I am now no longer able to build R:

checking for rl_callback_read_char in -lreadline... no
configure: error: --with-readline=yes (default) and headers/libs are not available

I couldn't get past the Python3 build without this ticket.

comment:10 Changed 12 months ago by mkoeppe

It is unlikely that this is connected. R does not use Python. If R does not build, you can use ./configure --disable-r to disable it.

comment:11 Changed 12 months ago by tscrim

Ah, okay. Thank you. Sorry for the noise.

comment:12 Changed 12 months ago by tscrim

Perhaps this is related?

uqtscrim@SMP-36PQ8T2:~/sage-build$ ./sage -t src/sage/algebras/weyl_algebra.py 
too few successful tests, not using stored timings
Running doctests with ID 2021-06-28-16-35-50-d69fb13c.
Git branch: public/new_fmatrix-30423
Using --optional=build,debian,dochtml,pip,sage,sage_spkg
Doctesting 1 file.
Traceback (most recent call last):
  File "/home/uqtscrim/sage-build/src/bin/sage-runtests", line 144, in <module>
    err = DC.run()
  File "/home/uqtscrim/sage-build/local/lib/python3.9/site-packages/sage/doctest/control.py", line 1207, in run
    self.run_doctests()
  File "/home/uqtscrim/sage-build/local/lib/python3.9/site-packages/sage/doctest/control.py", line 904, in run_doctests
    self.dispatcher = DocTestDispatcher(self)
  File "/home/uqtscrim/sage-build/local/lib/python3.9/site-packages/sage/doctest/forker.py", line 1658, in __init__
    init_sage(controller)
  File "/home/uqtscrim/sage-build/local/lib/python3.9/site-packages/sage/doctest/forker.py", line 234, in init_sage
    import readline
ModuleNotFoundError: No module named 'readline'

comment:13 Changed 12 months ago by mkoeppe

Yes, this one is...

comment:14 Changed 12 months ago by mkoeppe

  • Status changed from positive_review to needs_work

comment:15 Changed 12 months ago by git

  • Commit changed from de25ce550477a3c8efeb4e50c1b9c230c3908bbd to 6df6144cd06af7691315a78550e1e1ff57f09820

Branch pushed to git repo; I updated commit sha1. New commits:

6df6144src/sage/doctest/forker.py: Do not crash if readline cannot be imported

comment:16 Changed 12 months ago by mkoeppe

Try with this fix please

comment:17 Changed 12 months ago by mkoeppe

  • Status changed from needs_work to needs_review

comment:18 follow-up: Changed 12 months ago by tscrim

  • Reviewers changed from Dima Pasechnik to Dima Pasechnik, Travis Scrimshaw

This now fixes the doctester. Thank you. Although now I am wondering why we even need that import there. Can't we just remove it, especially considering #32073?

comment:19 in reply to: ↑ 18 Changed 12 months ago by tscrim

Replying to tscrim:

Can't we just remove it, especially considering #32073?

I guess we need to check that we don't have a regression to #14289.

comment:20 Changed 12 months ago by mkoeppe

I commented out this import, and it does not seem to make a difference with current versions of Python and macOS.

However, I haven't really used sage -t --debug before and I don't really understand its interface (sometimes I'm getting pdb prompts, sometimes sage prompts?), so it is quite possible that I am missing something

comment:21 Changed 12 months ago by tscrim

  • Priority changed from major to blocker
  • Status changed from needs_review to positive_review

I think since this is needed in order for me to build Sage (hence, the blocker upgrade) and this makes the situation no worse for a secondary feature, we can just leave it in for now. Although that is equally a reason to just simply comment that one line with leaving a note...but perhaps best for a followup.

comment:22 Changed 12 months ago by mkoeppe

Thanks. I agree.

comment:23 Changed 12 months ago by vbraun

  • Branch changed from u/mkoeppe/remove_strict_requirement_for_libreadline_when_building_python3 to 6df6144cd06af7691315a78550e1e1ff57f09820
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.