Ask Your Question

Building Sage 8.9 from source fails

asked 2019-10-11 13:06:28 +0200

Szabolcs gravatar image

updated 2019-10-11 19:35:28 +0200

tmonteil gravatar image

I am trying to build Sage 8.9 from source on Linux (Ubuntu 16.04, gcc 6). It fails. I could build Sage 8.8 on the same machine without problems.

It says that python2 and python3 failed to build, and suggests to look at the log files. The log files contain:

ImportError: No module named readline
readline module failed to import


ModuleNotFoundError: No module named 'readline'
readline module failed to import

Has anyone experienced the same and is there a simple solution?

Unfortunately, I do not have root access myself, thus I can't quickly try to install the readline dev package.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-10-13 13:11:40 +0200

To use system's readline on on Ubuntu 16.04, one needs to install libncurses5-dev and libreadline-dev (16.04 has a bug: the former is not a dependency of the latter, even though by right it should be)

As far as building Sage's readline goes, unfortunately we have not figured out yet what exactly goes wrong with building Sage's readline on 16.04. As a workaround, in the file build/pkgs/readline/patches/0002-ltinfo.patch replace the line



+   SHLIB_LIBS='-ltinfo -lncurses'

This shoud give a working readline built by Sage (hopefully)

edit flag offensive delete link more

answered 2019-10-11 13:41:15 +0200

tmonteil gravatar image

updated 2019-10-11 14:00:27 +0200

It seems related to

Could you please try to:

  1. remove SAGE_DIR/build/pkgs/readline/spkg-configure.m4
  2. run make configure
  3. run ./configure
  4. recompile Sage

and then tell us what it does ?

Also, could you please tell us the output of (in a terminal):

ls /lib/x86_64-linux-gnu/libreadline*
edit flag offensive delete link more


make configure would say make: 'configure' is up to date. even if I start with a clean source tree. Did I miss anything in the build instructions? I now deleted configure, did make configure, ./configure, and now waiting for the build to finish ...

Szabolcs gravatar imageSzabolcs ( 2019-10-11 17:37:57 +0200 )edit

It fails with the same message.

The output of ls /lib/x86_64-linux-gnu/libreadline* is

/lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/

Szabolcs gravatar imageSzabolcs ( 2019-10-11 17:48:57 +0200 )edit

Checking the log file more carefully revealed this line:

*** WARNING: renaming "readline" since importing it failed: /home/szhorvat/sage-8.9/local/lib/ undefined symbol: UP

Szabolcs gravatar imageSzabolcs ( 2019-10-11 17:57:00 +0200 )edit

this is a symptome of underlinking in readline. In its infinite wisdom readline's devs refuse to fix this old bug; it needs to be linked with libtinfo or other suchlike library, and it keeps resufacings in various forms...

Dima gravatar imageDima ( 2019-10-11 19:16:43 +0200 )edit
tmonteil gravatar imagetmonteil ( 2019-10-11 19:24:35 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-10-11 13:06:28 +0200

Seen: 198 times

Last updated: Oct 13 '19