Error rebuilding Python for sage in package setuptools-68.2.2

214 views
Skip to first unread message

Toby Schrager

unread,
Nov 11, 2023, 3:16:06 AM11/11/23
to sage-devel
Hi,
I tried to install the Tck/Tk libraries for sage after I had already downloaded python, so I had to rebuild python after downloading the libraries. Now my python will not rebuild due to an error in package 'setuptools-68.2.2'. The error code actually told me to email this group, which I take it to mean I really messed it up lol. It said to include the two files which I attached below, as well as my computer specs. I don't really know which specs are relevant, but I have a Windows 11 lenovo with 224/475 gb disc space free, and 16gb ram.
Thank you,
Toby
setuptools-68.2.2.log
config.log

Dima Pasechnik

unread,
Nov 11, 2023, 3:43:34 AM11/11/23
to sage-devel
    In your setuptools install log one sees:

from random import Random as _Random
  File "/home/tschrager/sage/local/var/lib/sage/venv-python3.10/lib/python3.11/random.py", line 49, in <module>
    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ModuleNotFoundError: No module named 'math'
*************************************************************************************

That is, your Python got broken when you rebuilt it. We could tell more if you sent us the python install log, too.

------

In fact, Ubuntu 22.04 (that's what you have in WSL) has many packages, including Python, which you can install and use to build Sage.
(and you can probably also install and use system-wide tcl/tk for the Python).


Have a look at the advice Sage's ./configure prints at the end of its run, it will list system packages you can install and use.

HTH

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/da7208f1-fca1-47d6-9312-8d325505b812n%40googlegroups.com.

Toby Schrager

unread,
Nov 11, 2023, 12:31:44 PM11/11/23
to sage-devel
I attached the python logs. How do I see the Sage ./configure prints? Also, how would I go about fixing my Python issue?
Thank you

python3-3.11.1.log

Dima Pasechnik

unread,
Nov 11, 2023, 1:19:27 PM11/11/23
to sage-devel


On Sat, 11 Nov 2023, 17:31 Toby Schrager, <toby.s...@gmail.com> wrote:
I attached the python logs. How do I see the Sage ./configure prints?


well, in WSLterminal, run

./configure

and look at the last page of its output.
It may also be found in config.log


Toby Schrager

unread,
Nov 11, 2023, 1:24:52 PM11/11/23
to sage-devel
I'm sorry  if I'm making this much harder than it is, I have no experience using WSL or Sage or Linux or Ubuntu or anything else. When I try to run ./configure in WSL it responds, -bash: ./configure: No such file or directory. I tried to do cd /var/log and then do ./configure but still nothing. However, I did find a file called config and attached it. At the end of it it says:
#define HAVE_ECM_H 1
#define ABSOLUTE_ECM_H "///usr/include/ecm.h"
#define HAVE_ICONV 1
#define ICONV_CONST
#define HAVE_SUITESPARSE_SUITESPARSE_CONFIG_H 1
#define HAVE_SUITESPARSE_AMD_H 1
#define HAVE_ZMQ /**/
Are these the things I'm supposed to download?
config.log

Dima Pasechnik

unread,
Nov 11, 2023, 6:44:30 PM11/11/23
to sage-devel


On Sat, 11 Nov 2023, 18:24 Toby Schrager, <toby.s...@gmail.com> wrote:
I'm sorry  if I'm making this much harder than it is, I have no experience using WSL or Sage or Linux or Ubuntu or anything else. When I try to run ./configure in WSL it responds, -bash: ./configure: No such file or directory.

"./" in front of the file name means "current directory"
you need to change to the directory (Micro$oft calls them folders:-)) where the root of your 
Sage source is.

I tried to do cd /var/log and then do ./configure but still nothing. However, I did find a file called config and attached it.
config.log, yes

look for lines containing "apt-get" there

From your config.log I see that your installation used Python from the system.
I don't understand what  you meant by "tcl/tl libraries for Sage".
Do you mean tkinter package, a.k.a. python-tk  ?

I'd suggest that you get the latest Sage sources (version 10.2.rc1)
and run its configure with
--enable-system-site-packages
option, i.e.

./configure --enable-system-site-packages

followed by 

make build

to build it.

Then, as we know that the system python3 is used, install tkinter there, by doing

sudo apt-get update
sudo apt-get -y install python-tk

Then it will be available in Sage.

HTH
Dima



 

Toby Schrager

unread,
Nov 12, 2023, 1:19:47 AM11/12/23
to sage-devel
Hi Dima,
By the tcl/tk libraries for sage, I honestly don't know what I mean either. I downloaded sage using this installation guide, https://doc.sagemath.org/html/en/installation/index.html.

 I then tried to test out all the features, saw that 3d graphing wasn't working and went back to the installation guide to see if there was something I missed. One such thing was the tcl/tk libraries. I figured why not download it right? I thought it would be a few minutes, quick easy download.
Anyway now we're here.

I'm sorry for asking what I'm sure is an easy question, but when you say "get the latest Sage sources (version 10.2.rc1)", do you mean find it on github and download it? Or use sudo apt-get install 'something'?

Thank you for all your help with this computer voodoo. I have no idea what's going on, but I find it really interesting, can you reccomend a place to learn more about linux and directories and all the other computer witchery?

Thank you
Toby

Dima Pasechnik

unread,
Nov 12, 2023, 8:33:07 AM11/12/23
to sage-...@googlegroups.com
On Sun, Nov 12, 2023 at 6:19 AM Toby Schrager <toby.s...@gmail.com> wrote:
>
> Hi Dima,
> By the tcl/tk libraries for sage, I honestly don't know what I mean either. I downloaded sage using this installation guide, https://doc.sagemath.org/html/en/installation/index.html.

This link documents many ways to install Sage on Linux, it's not clear
what you did exactly.
You can't just "download" Sage, you need to install it, anyway.

>
> I then tried to test out all the features, saw that 3d graphing wasn't working and went back to the installation guide to see if there was something I missed. One such thing was the tcl/tk libraries. I figured why not download it right? I thought it would be a few minutes, quick easy download.

Again, it's not clear what you did exactly.

> Anyway now we're here.
>
> I'm sorry for asking what I'm sure is an easy question, but when you say "get the latest Sage sources (version 10.2.rc1)", do you mean find it on github and download it? Or use sudo apt-get install 'something'?

No, you can't get it via apt-get. You need to install it from source.

>
> Thank you for all your help with this computer voodoo. I have no idea what's going on, but I find it really interesting, can you reccomend a place to learn more about linux and directories and all the other computer witchery?

I don't know a particular place. There are many old and not so old
resources, e.g.
https://doc.lagout.org/operating%20system%20/linux/Teach%20Yourself%20Unix%20in%2024%20Hours.pdf
https://www.digitalocean.com/community/tutorials/an-introduction-to-linux-basics

HTH
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/815e1efb-83ff-4f6f-b2c7-0e67b7f174d9n%40googlegroups.com.

Toby Schrager

unread,
Nov 12, 2023, 1:19:19 PM11/12/23
to sage-devel
Within the document I followed the Windows section and then chose to use sage for development. Then it sent me to the Linux section, which had me link github to my computer. Then it sent me to this link, https://doc.sagemath.org/html/en/installation/source.html#sec-installation-from-sources, which had me download/install a whole bunch of things using sudo apt-get commands. like system packages, C/C++ compliers, Fortran Compliers, python, dvipng, ffmpeg, imagemagick, and LaTeX. There was one thing I forgot to download/install, which was the tcl/tk libraries. After that I uploaded the Sage source code from Github, and made it.

When I say I tried to download the tcl/tk libraries I meant that I did, 

sudo apt-get install tk tk-dev

And then the instructions said to rebuild python so I did

sage -f python3
make

How would I download and install sage from the source, is it the same process I already did? should I remove the first sage before redownloading and reinstalling it?

Dima Pasechnik

unread,
Nov 12, 2023, 1:59:34 PM11/12/23
to sage-...@googlegroups.com
On Sun, Nov 12, 2023 at 6:19 PM Toby Schrager <toby.s...@gmail.com> wrote:
>
> Within the document I followed the Windows section and then chose to use sage for development. Then it sent me to the Linux section, which had me link github to my computer. Then it sent me to this link, https://doc.sagemath.org/html/en/installation/source.html#sec-installation-from-sources, which had me download/install a whole bunch of things using sudo apt-get commands. like system packages, C/C++ compliers, Fortran Compliers, python, dvipng, ffmpeg, imagemagick, and LaTeX. There was one thing I forgot to download/install, which was the tcl/tk libraries. After that I uploaded the Sage source code from Github, and made it.
>
> When I say I tried to download the tcl/tk libraries I meant that I did,
>
> sudo apt-get install tk tk-dev
>
> And then the instructions said to rebuild python so I did
>
> sage -f python3
> make
>

OK, I see. Our instructions for tk are old, and do not consider the
case where Sage's python comes from the system.
That's a bug we should fix.
(see https://github.com/sagemath/sage/issues/36710)

However, if you think that problems you saw with 3D have anything to
do with absence of tk, it's not so.
Sage itself does not use tk at all. This instruction is provided for
people who need to use tk with Sage's Python (tk is tightly integrated
in Python, so it needs a rebuild if this integration is turned on).

> How would I download and install sage from the source, is it the same process I already did? should I remove the first sage before redownloading and reinstalling it?

One way or another, you should revert "sage -f python3". To do this, run

make python3-clean python3-uninstall

followed by

./configure && make

If you want tkinter in your (Sage's) Python, you need to install
system package python3-tk, and this can be done by

sudo apt-get install python3-tk

HTH
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/992b8f46-73fe-4440-a527-f14485935531n%40googlegroups.com.

Toby Schrager

unread,
Nov 12, 2023, 7:27:51 PM11/12/23
to sage-devel
Yay thanks Dima, my sage works now! Actually I think it works? After doing the 
./configure && make
command, it said 

Error building Sage.

The following package(s) may have failed to build (not necessarily
during this run of 'make all-start'):

* package:         sagelib-10.2.rc0
  last build time: Nov 11 22:36
  log file:        /home/tschrager/sage/logs/pkgs/sagelib-10.2.rc0.log

* package:         setuptools-68.2.2
  last build time: Nov 12 16:23
  log file:        /home/tschrager/sage/logs/pkgs/setuptools-68.2.2.log

It is safe to delete any log files and build directories, but they
contain information that is helpful for debugging build problems.
WARNING: If you now run 'make' again, the build directory of the
same version of the package will, by default, be deleted. Set the
environment variable SAGE_KEEP_BUILT_SPKGS=yes to prevent this.

make[1]: *** [Makefile:40: all-start] Error 1
make[1]: Leaving directory '/home/tschrager/sage'
make: *** [Makefile:13: all] Error

But when I tried to enter sage and use it just to see what would happen, it totally worked, so I'm a little confused.
Either way, thank you so much. 

I did'nt think that the tk libraries would fix my graphing problem, but I thought why not download it, right? What's the harm in more libraries, maybe it'll help me down the line, and I thought it would be a quick and easy process.

Thank you so much again, for all the help and for answering my menial questions and handling my inexperience.
Toby

Dima Pasechnik

unread,
Nov 12, 2023, 7:41:31 PM11/12/23
to sage-...@googlegroups.com
On Mon, Nov 13, 2023 at 12:27 AM Toby Schrager <toby.s...@gmail.com> wrote:
>
> Yay thanks Dima, my sage works now! Actually I think it works? After doing the
> ./configure && make
> command, it said
>
> Error building Sage.
>
> The following package(s) may have failed to build (not necessarily
> during this run of 'make all-start'):
>
> * package: sagelib-10.2.rc0
> last build time: Nov 11 22:36
> log file: /home/tschrager/sage/logs/pkgs/sagelib-10.2.rc0.log
>
> * package: setuptools-68.2.2
> last build time: Nov 12 16:23
> log file: /home/tschrager/sage/logs/pkgs/setuptools-68.2.2.log
>
> It is safe to delete any log files and build directories, but they
> contain information that is helpful for debugging build problems.
> WARNING: If you now run 'make' again, the build directory of the
> same version of the package will, by default, be deleted. Set the
> environment variable SAGE_KEEP_BUILT_SPKGS=yes to prevent this.
>
> make[1]: *** [Makefile:40: all-start] Error 1
> make[1]: Leaving directory '/home/tschrager/sage'
> make: *** [Makefile:13: all] Error
>
> But when I tried to enter sage and use it just to see what would happen, it totally worked, so I'm a little confused.
Looks like setuptools didn't install successfully. (look at the dates/times)

probably you have another version of Sage installed? Note that you can
see the version
in the banner it prints on startup in terminal.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/d0741518-6da6-415a-8ea1-31163f63333en%40googlegroups.com.

Toby Schrager

unread,
Nov 13, 2023, 12:03:54 AM11/13/23
to sage-devel
Ok yeah there are two versions of sage, when I look in my folders there's a folder called 'VERSION' and all it says it:
SageMath version 10.2.rc0, Release Date: 2023-11-05

But when I run sage via Ubuntu it opens SageMath version 9.5.

How should I go about fixing this?

Toby Schrager

unread,
Nov 13, 2023, 7:54:46 PM11/13/23
to sage-devel
I ran 
make distclean && make build
and it seems to be working well, with the right version. I'm running a doctest currently.
Thank you for all your help Dima.
Toby

Reply all
Reply to author
Forward
0 new messages