Sage on Guix

25 views
Skip to first unread message

Andreas Enge

unread,
Jun 21, 2019, 4:35:16 AM6/21/19
to sage-pa...@googlegroups.com, Nicolas Goaziou
Hello,

during the Sage Days 101 in Cernay I have made some progress towards
packaging Sage for the GNU Guix distribution. Thanks to all present who
helped me!

Currently, cythonising and compiling a minimal set of packages towards
sagelib succeeds, but setup.py fails later.

For context, here is a relevant excerpt of the Guix recipe, which should
be self-explaining:
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'build 'setup
(lambda _
(setenv "SAGE_ROOT" (getcwd))
(setenv "SAGE_LOCAL" (getcwd))
(setenv "SAGE_SHARE" (string-append (getcwd) "/share"))
(setenv "PATH" (string-append (getcwd) "/build/bin:"
(getcwd) "/src/bin:"
(getenv "PATH")))
(setenv "SAGE_NUM_THREADS" "32") ; arbitrary number, 32 cores
; on bayfront
(mkdir-p "var/lib/sage/installed")
(chdir "src")
#t)))))
(build-system python-build-system)
We set a few environment variables and then call the Python build system
from within the source tree in "src".

Precisely, we run a build phase:
python setup-py build
which succeeds; and a check phase
python setup.py test
which fails with the following message:
Discovering Python/Cython source code....
Discovered Python/Cython sources, time: 0.03 seconds.
running test
running egg_info
creating sage.egg-info
writing sage.egg-info/PKG-INFO
...
running build_cython
Enabling Cython debugging support
Updating Cython code....
Finished Cythonizing, time: 4.63 seconds.
************************************************************************
Traceback (most recent call last):
File "setup.py", line 703, in prepare_extension
os.makedirs(path)
File "/gnu/store/b7fqhszxl02g6pfm3vw6b3cjz472qrly-python-3.7.0/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''

The lines around this error create a file name that apparently is empty.
Have you got any idea what the problem could be?

My next trial will be to skip the tests and to run the install phase
python setup.py install
to see what happens...

Thanks,

Andreas

Jeroen Demeyer

unread,
Jun 21, 2019, 4:40:48 AM6/21/19
to sage-pa...@googlegroups.com
On 2019-06-21 10:35, Andreas Enge wrote:
> python setup.py test

I have no idea what that does, but I don't think that Sage supports
that. It wouldn't be very meaningful either, since the Sage library by
itself doesn't have a testsuite, only the Sage distribution as a whole has.

Andreas Enge

unread,
Jun 21, 2019, 5:10:37 AM6/21/19
to sage-pa...@googlegroups.com
On Fri, Jun 21, 2019 at 10:40:47AM +0200, Jeroen Demeyer wrote:
> I have no idea what that does, but I don't think that Sage supports that. It
> wouldn't be very meaningful either, since the Sage library by itself doesn't
> have a testsuite, only the Sage distribution as a whole has.

Okay, dropping it leads me somewhere else (further?):

$ python setup.py install
...
running install_egg_info
Writing /gnu/store/nwxidr4am86hcqhzvdadjb5rdrd32jls-sage-8.7/lib/python3.7/site-packages/sage-8.7-py3.7.egg-info
error: [Errno 2] No such file or directory: '/tmp/guix-build-sage-8.7.drv-0/sage-8.7/share/sage/ext/notebook-ipython'

I suppose it is missing some ipython package as input. So far I only added
standard packages required by the cythonising process, and am missing a few.
Will it be enough to add the "notebook" package? Besides looking at the
build/pkgs directory, are there other ways to know the names of packages
that are absolutely necessary at this point of the process? Up until now,
I just followed the gcc error messages, and now I am entering unknown
Python territory...

Andreas

Isuru Fernando

unread,
Jun 21, 2019, 5:14:20 AM6/21/19
to sage-pa...@googlegroups.com

Jeroen Demeyer

unread,
Jun 21, 2019, 6:10:44 AM6/21/19
to sage-pa...@googlegroups.com
On 2019-06-21 11:10, Andreas Enge wrote:
> error: [Errno 2] No such file or directory: '/tmp/guix-build-sage-8.7.drv-0/sage-8.7/share/sage/ext/notebook-ipython'
>
> I suppose it is missing some ipython package as input.

No, this is a file in src/ext

Have a look at the list of dependencies of sagelib in the file
build/make/deps. That's supposed to be the list of build-time
dependencies of the Sage library. EXTCODE (a bunch of files shipped with
Sage) is the one you're missing here.

Timo Kaufmann

unread,
Jun 21, 2019, 6:39:45 AM6/21/19
to sage-packaging

Would be great to have another packager in the nix/guix family :)

For what its worth, here is what I do on nix: https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/science/math/sage

Particularly interesting for you right now should be `sagelib.nix` which actually builds the sage library and `sage-src.nix` which prepares the source (applying a bunch of patches). `sage-env.py` and `env-locations.py` define necessary environment variables.

Andreas Enge

unread,
Jun 21, 2019, 11:10:09 AM6/21/19
to sage-pa...@googlegroups.com, Nicolas Goaziou
Hello,

thanks to all for your quick and helpful replies!

On Fri, Jun 21, 2019 at 03:39:45AM -0700, Timo Kaufmann wrote:
> Would be great to have another packager in the nix/guix family :)

Well, at least two, I have been working with Nicolas Goaziou (in cc).

> For what its worth, here is what I do on nix: https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/science/math/sage
> Particularly interesting for you right now should be `sagelib.nix` which actually builds the sage library and `sage-src.nix` which prepares the source (applying a bunch of patches). `sage-env.py` and `env-locations.py` define necessary environment variables.

Indeed, I think I copied the environment variable definitions from
sagelib.nix a long while ago...

The library is compiled!!!

Next step: the command line interface...

Andreas

E. Madison Bray

unread,
Jun 21, 2019, 2:05:53 PM6/21/19
to sage-packaging
Congrats! I'm sorry I didn't get a chance to say bye, but I hope you
have had(?)/are having(?) a good trip home.

Is there some place we can easily look at your work (if you already
said I didn't see it)?

I'd like to try playing with Sage on GUIX again, which I haven't
really done since like 2 years ago or so when I first saw you
demonstrate it.

matthia...@gmail.com

unread,
Jun 22, 2019, 5:27:22 PM6/22/19
to sage-packaging

See also: #21785: Installation of SAGE_SRC/ext/ in SAGE_LOCAL/share/sage/ext/ should be done by setup.py, not build/make/Makefile

Reply all
Reply to author
Forward
0 new messages