summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2021-09-13 22:56:34 -0300
committerMauricio Collares <mauricio@collares.org>2022-01-30 13:15:20 -0300
commitcecbb55fb0e844fd07d30b2dc73717aa5fcf5a81 (patch)
treed62fa687a42ab4a17463d7317b3e403372dd38cf /pkgs/applications
parent0aef6270cd9a238126568df3749ccd8765c3c7cf (diff)
downloadnixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.tar
nixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.tar.gz
nixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.tar.bz2
nixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.tar.lz
nixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.tar.xz
nixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.tar.zst
nixpkgs-cecbb55fb0e844fd07d30b2dc73717aa5fcf5a81.zip
sage: 9.4 -> 9.5
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/science/math/sage/default.nix19
-rw-r--r--pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch21
-rw-r--r--pkgs/applications/science/math/sage/patches/linbox-1.7-upgrade.patch58
-rw-r--r--pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch12
-rw-r--r--pkgs/applications/science/math/sage/python-modules/sage-docbuild.nix28
-rw-r--r--pkgs/applications/science/math/sage/python-modules/sage-setup.nix28
-rw-r--r--pkgs/applications/science/math/sage/sage-env.nix11
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix49
-rw-r--r--pkgs/applications/science/math/sage/sage-with-env.nix6
-rw-r--r--pkgs/applications/science/math/sage/sage.nix3
-rw-r--r--pkgs/applications/science/math/sage/sage_docbuild.nix20
-rw-r--r--pkgs/applications/science/math/sage/sagedoc.nix2
-rw-r--r--pkgs/applications/science/math/sage/sagelib.nix7
13 files changed, 156 insertions, 108 deletions
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
index e9dae55fbae..2066087692a 100644
--- a/pkgs/applications/science/math/sage/default.nix
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -14,13 +14,17 @@ let
       # `sagelib`, i.e. all of sage except some wrappers and runtime dependencies
       sagelib = self.callPackage ./sagelib.nix {
         inherit flint arb;
-        inherit sage-src env-locations pynac singular;
+        inherit sage-src env-locations singular;
         inherit (maxima) lisp-compiler;
         linbox = pkgs.linbox.override { withSage = true; };
         pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
       };
 
-      sage_docbuild = self.callPackage ./sage_docbuild.nix {
+      sage-docbuild = self.callPackage ./python-modules/sage-docbuild.nix {
+        inherit sage-src;
+      };
+
+      sage-setup = self.callPackage ./python-modules/sage-setup.nix {
         inherit sage-src;
       };
     };
@@ -58,9 +62,9 @@ let
   # the env-locations file.
   sage-env = callPackage ./sage-env.nix {
     sagelib = python3.pkgs.sagelib;
-    sage_docbuild = python3.pkgs.sage_docbuild;
+    sage-docbuild = python3.pkgs.sage-docbuild;
     inherit env-locations;
-    inherit python3 singular palp flint pynac pythonEnv maxima;
+    inherit python3 singular palp flint pythonEnv maxima;
     pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
   };
 
@@ -74,7 +78,7 @@ let
   sage-with-env = callPackage ./sage-with-env.nix {
     inherit python3 pythonEnv;
     inherit sage-env;
-    inherit pynac singular maxima;
+    inherit singular maxima;
     inherit three;
     pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
   };
@@ -91,7 +95,7 @@ let
 
   pythonRuntimeDeps = with python3.pkgs; [
     sagelib
-    sage_docbuild
+    sage-docbuild
     cvxopt
     networkx
     service-identity
@@ -132,9 +136,6 @@ let
     };
   };
 
-  # *not* to confuse with the python package "pynac"
-  pynac = pkgs.pynac.override { inherit singular flint; };
-
   # With openblas (64 bit), the tests fail the same way as when sage is build with
   # openblas instead of openblasCompat. Apparently other packages somehow use flints
   # blas when it is available. Alternative would be to override flint to use
diff --git a/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch b/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
index 178cef3e54e..90a23f94cb5 100644
--- a/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
+++ b/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
@@ -1,8 +1,8 @@
 diff --git a/src/sage/env.py b/src/sage/env.py
-index 95980cc2df..37107a30e1 100644
+index c4953cfa65..47b880f9ad 100644
 --- a/src/sage/env.py
 +++ b/src/sage/env.py
-@@ -227,93 +227,12 @@ OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
+@@ -244,81 +244,8 @@ os.environ['MPMATH_SAGE'] = '1'
  SAGE_BANNER = var("SAGE_BANNER", "")
  SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
  
@@ -29,20 +29,12 @@ index 95980cc2df..37107a30e1 100644
 -
 -    EXAMPLES::
 -
--        sage: import sys
--        sage: from fnmatch import fnmatch
 -        sage: from sage.env import _get_shared_lib_path
--        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
--        sage: if sys.platform == 'cygwin':
--        ....:     pattern = "*/cygSingular-*.dll"
--        ....: elif sys.platform == 'darwin':
--        ....:     pattern = "*/libSingular-*.dylib"
--        ....: else:
--        ....:     pattern = "*/lib*Singular-*.so"
--        sage: fnmatch(str(lib_filename), pattern)
+-        sage: "gap" in _get_shared_lib_path("gap")
 -        True
 -        sage: _get_shared_lib_path("an_absurd_lib") is None
 -        True
+-
 -    """
 -
 -    for libname in libnames:
@@ -87,11 +79,6 @@ index 95980cc2df..37107a30e1 100644
 -    # Just return None if no files were found
 -    return None
 -
- # locate singular shared object
- # On Debian it's libsingular-Singular so try that as well
--SINGULAR_SO = var("SINGULAR_SO", _get_shared_lib_path("Singular", "singular-Singular"))
-+SINGULAR_SO = var("SINGULAR_SO", '/default')
- 
  # locate libgap shared object
 -GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
 +GAP_SO = var("GAP_SO", '/default')
diff --git a/pkgs/applications/science/math/sage/patches/linbox-1.7-upgrade.patch b/pkgs/applications/science/math/sage/patches/linbox-1.7-upgrade.patch
new file mode 100644
index 00000000000..91e080aa294
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/linbox-1.7-upgrade.patch
@@ -0,0 +1,58 @@
+diff --git a/src/sage/libs/linbox/conversion.pxd b/src/sage/libs/linbox/conversion.pxd
+index 7794c9edc3..1753277b1f 100644
+--- a/src/sage/libs/linbox/conversion.pxd
++++ b/src/sage/libs/linbox/conversion.pxd
+@@ -177,9 +177,8 @@ cdef inline Vector_integer_dense new_sage_vector_integer_dense(P, DenseVector_in
+     - v -- linbox vector
+     """
+     cdef Vector_integer_dense res = P()
+-    cdef cppvector[Integer] * vec = &v.refRep()
+     cdef size_t i
+     for i in range(<size_t> res._degree):
+-        mpz_set(res._entries[i], vec[0][i].get_mpz_const())
++        mpz_set(res._entries[i], v.getEntry(i).get_mpz_const())
+ 
+     return res
+diff --git a/src/sage/libs/linbox/linbox.pxd b/src/sage/libs/linbox/linbox.pxd
+index 9112d151f8..dcc482960c 100644
+--- a/src/sage/libs/linbox/linbox.pxd
++++ b/src/sage/libs/linbox/linbox.pxd
+@@ -32,7 +32,7 @@ cdef extern from "linbox/matrix/dense-matrix.h":
+         ctypedef Modular_double Field
+         ctypedef double Element
+         DenseMatrix_Modular_double(Field F, size_t m, size_t n)
+-        DenseMatrix_Modular_double(Field F, Element*, size_t m, size_t n)
++        DenseMatrix_Modular_double(Field F, size_t m, size_t n, Element*)
+         void setEntry(size_t i, size_t j, Element& a)
+         Element &getEntry(size_t i, size_t j)
+ 
+@@ -42,7 +42,7 @@ cdef extern from "linbox/matrix/dense-matrix.h":
+         ctypedef Modular_float Field
+         ctypedef float Element
+         DenseMatrix_Modular_float(Field F, size_t m, size_t n)
+-        DenseMatrix_Modular_float(Field F, Element*, size_t m, size_t n)
++        DenseMatrix_Modular_float(Field F, size_t m, size_t n, Element*)
+         void setEntry(size_t i, size_t j, Element& a)
+         Element &getEntry(size_t i, size_t j)
+ 
+@@ -101,7 +101,6 @@ cdef extern from "linbox/vector/vector.h":
+         DenseVector_integer (Field &F)
+         DenseVector_integer (Field &F, long& m)
+         DenseVector_integer (Field &F, cppvector[Integer]&)
+-        cppvector[Element]& refRep()
+         size_t size()
+         void resize(size_t)
+         void resize(size_t n, const Element&)
+diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi
+index 010365d76f..3d60726ff9 100644
+--- a/src/sage/matrix/matrix_modn_dense_template.pxi
++++ b/src/sage/matrix/matrix_modn_dense_template.pxi
+@@ -219,7 +219,7 @@ cdef inline linbox_echelonize_efd(celement modulus, celement* entries, Py_ssize_
+         return 0,[]
+ 
+     cdef ModField *F = new ModField(<long>modulus)
+-    cdef DenseMatrix *A = new DenseMatrix(F[0], <ModField.Element*>entries,<Py_ssize_t>nrows, <Py_ssize_t>ncols)
++    cdef DenseMatrix *A = new DenseMatrix(F[0], <Py_ssize_t>nrows, <Py_ssize_t>ncols, <ModField.Element*>entries)
+     cdef Py_ssize_t r = reducedRowEchelonize(A[0])
+     cdef Py_ssize_t i,j
+     for i in range(nrows):
diff --git a/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch b/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch
index 3c64be100d2..1ff081b25e0 100644
--- a/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch
+++ b/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch
@@ -1,8 +1,8 @@
 diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py
-index 79005b903a..fbe6fe2595 100644
+index 8a5c1a19d2..21fd192642 100644
 --- a/src/sage_docbuild/__init__.py
 +++ b/src/sage_docbuild/__init__.py
-@@ -85,27 +85,6 @@ def builder_helper(type):
+@@ -89,27 +89,6 @@ def builder_helper(type):
      """
      Returns a function which builds the documentation for
      output type ``type``.
@@ -12,7 +12,7 @@ index 79005b903a..fbe6fe2595 100644
 -    Check that :trac:`25161` has been resolved::
 -
 -        sage: from sage_docbuild import DocBuilder, setup_parser
--        sage: DocBuilder._options = setup_parser().parse_args([])[0] # builder_helper needs _options to be set
+-        sage: DocBuilder._options = setup_parser().parse_args([]) # builder_helper needs _options to be set
 -
 -        sage: import sage_docbuild.sphinxbuild
 -        sage: def raiseBaseException():
@@ -30,7 +30,7 @@ index 79005b903a..fbe6fe2595 100644
      """
      def f(self, *args, **kwds):
          output_dir = self._output_dir(type)
-@@ -127,10 +106,9 @@ def builder_helper(type):
+@@ -131,10 +110,9 @@ def builder_helper(type):
          logger.debug(build_command)
  
          # Run Sphinx with Sage's special logger
@@ -44,10 +44,10 @@ index 79005b903a..fbe6fe2595 100644
              if ABORT_ON_ERROR:
                  raise
 diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
-index f58f6c61d7..ef51a55411 100644
+index d917c3e9d4..551cc8028a 100644
 --- a/src/sage_docbuild/sphinxbuild.py
 +++ b/src/sage_docbuild/sphinxbuild.py
-@@ -326,3 +326,8 @@ def runsphinx():
+@@ -327,3 +327,8 @@ def runsphinx():
          sys.stderr = saved_stderr
          sys.stdout.flush()
          sys.stderr.flush()
diff --git a/pkgs/applications/science/math/sage/python-modules/sage-docbuild.nix b/pkgs/applications/science/math/sage/python-modules/sage-docbuild.nix
new file mode 100644
index 00000000000..1766cec3e35
--- /dev/null
+++ b/pkgs/applications/science/math/sage/python-modules/sage-docbuild.nix
@@ -0,0 +1,28 @@
+{ lib
+, buildPythonPackage
+, sage-src
+, sphinx
+}:
+
+buildPythonPackage rec {
+  version = src.version;
+  pname = "sage-docbuild";
+  src = sage-src;
+
+  propagatedBuildInputs = [
+    sphinx
+  ];
+
+  preBuild = ''
+    cd pkgs/sage-docbuild
+  '';
+
+  doCheck = false; # we will run tests in sagedoc.nix
+
+  meta = with lib; {
+    description = "Build system of the Sage documentation";
+    homepage = "https://www.sagemath.org";
+    license = licenses.gpl2Plus;
+    maintainers = teams.sage.members;
+  };
+}
diff --git a/pkgs/applications/science/math/sage/python-modules/sage-setup.nix b/pkgs/applications/science/math/sage/python-modules/sage-setup.nix
new file mode 100644
index 00000000000..50346153123
--- /dev/null
+++ b/pkgs/applications/science/math/sage/python-modules/sage-setup.nix
@@ -0,0 +1,28 @@
+{ lib
+, buildPythonPackage
+, sage-src
+, pkgconfig # the python module, not the pkg-config alias
+}:
+
+buildPythonPackage rec {
+  version = src.version;
+  pname = "sage-setup";
+  src = sage-src;
+
+  buildInputs = [
+    pkgconfig
+  ];
+
+  preBuild = ''
+    cd pkgs/sage-setup
+  '';
+
+  doCheck = false; # sagelib depends on sage-setup, but sage-setup's tests depend on sagelib
+
+  meta = with lib; {
+    description = "Build system of the Sage library";
+    homepage = "https://www.sagemath.org";
+    license = licenses.gpl2Plus;
+    maintainers = teams.sage.members;
+  };
+}
diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix
index ae0b9f7453b..e680c0c3b22 100644
--- a/pkgs/applications/science/math/sage/sage-env.nix
+++ b/pkgs/applications/science/math/sage/sage-env.nix
@@ -2,7 +2,7 @@
 , lib
 , writeTextFile
 , sagelib
-, sage_docbuild
+, sage-docbuild
 , env-locations
 , gfortran
 , bash
@@ -45,11 +45,10 @@
 , flint
 , gmp
 , mpfr
-, pynac
 , zlib
 , gsl
 , ntl
-, jdk8
+, jdk
 , less
 }:
 
@@ -60,8 +59,6 @@ assert (!blas.isILP64) && (!lapack.isILP64);
 # dependencies.
 
 let
-  jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
-
   runtimepath = (lib.makeBinPath ([
     "@sage-local@"
     "@sage-local@/build"
@@ -163,7 +160,6 @@ writeTextFile rec {
         gmp
         mpfr
         pari
-        pynac
         zlib
         eclib
         gsl
@@ -179,7 +175,6 @@ writeTextFile rec {
         glpk
         flint
         gap
-        pynac
         mpfr.dev
       ])
     }'
@@ -193,5 +188,5 @@ writeTextFile rec {
   '';
 } // { # equivalent of `passthru`, which `writeTextFile` doesn't support
   lib = sagelib;
-  docbuild = sage_docbuild;
+  docbuild = sage-docbuild;
 }
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index eb07434b4cc..b260f2cd3cf 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -57,14 +57,14 @@ let
   );
 in
 stdenv.mkDerivation rec {
-  version = "9.4";
+  version = "9.5";
   pname = "sage-src";
 
   src = fetchFromGitHub {
     owner = "sagemath";
     repo = "sage";
     rev = version;
-    sha256 = "sha256-jqkr4meG02KbTCMsGvyr1UbosS4ZuUJhPXU/InuS+9A=";
+    sha256 = "sha256-uOsLpsGpcIGs8Xr82X82MElnTB2E908gytyNJ8WVD5w=";
   };
 
   # Patches needed because of particularities of nix or the way this is packaged.
@@ -117,46 +117,6 @@ stdenv.mkDerivation rec {
     # Let's just assume warnings are expected until we update to 4.27.0.
     ./patches/fonttools-deprecation-warnings.patch
 
-    # https://trac.sagemath.org/ticket/32305
-    (fetchSageDiff {
-      base = "9.4";
-      name = "networkx-2.6-upgrade.patch";
-      rev = "9808325853ba9eb035115e5b056305a1c9d362a0";
-      sha256 = "sha256-gJSqycCtbAVr5qnVEbHFUvIuTOvaxFIeffpzd6nH4DE=";
-    })
-
-    # https://trac.sagemath.org/ticket/32420
-    (fetchSageDiff {
-      base = "9.5.beta2";
-      name = "sympy-1.9-update.patch";
-      rev = "beed4e16aff32e47d0c3b1c58cb1e2f4c38590f8";
-      sha256 = "sha256-3eJPfWfCrCAQ5filIn7FbzjRQeO9QyTIVl/HyRuqFtE=";
-    })
-
-    # https://trac.sagemath.org/ticket/32567
-    (fetchSageDiff {
-      base = "9.5.beta2";
-      name = "arb-2.21.0-update.patch";
-      rev = "eb3304dd521a3d5a9334e747a08e234bbf16b4eb";
-      sha256 = "sha256-XDkaY4VQGyESXI6zuD7nCNzyQOl/fmBFvAESH9+RRvk=";
-    })
-
-    # https://trac.sagemath.org/ticket/32797
-    (fetchSageDiff {
-      base = "9.5.beta7";
-      name = "pari-2.13.3-update.patch";
-      rev = "f5f7a86908daf60b25e66e6a189c51ada7e0a732";
-      sha256 = "sha256-H/caGx3q4KcdsyGe+ojV9bUTQ5y0siqM+QHgDbeEnbw=";
-    })
-
-    # https://trac.sagemath.org/ticket/32909
-    (fetchSageDiff {
-      base = "9.5.beta7";
-      name = "matplotlib-3.5-deprecation-warnings.patch";
-      rev = "a5127dc56fdf5c2e82f6bc781cfe78dbd04e97b7";
-      sha256 = "sha256-p23qUu9mgEUbdbX6cy7ArxZAtpcFjCKbgyxN4jWvj1o=";
-    })
-
     # https://trac.sagemath.org/ticket/32968
     (fetchSageDiff {
       base = "9.5.beta8";
@@ -164,6 +124,11 @@ stdenv.mkDerivation rec {
       rev = "fc84f82f52b6f05f512cb359ec7c100f93cf8841";
       sha256 = "sha256-bBbfdcnw/9LUOlY8rHJRbFJEdMXK4shosqTNaobTS1Q=";
     })
+
+    # Upstream has not upgraded to linbox 1.7 yet because it conflicts with
+    # pre-4.2.1p3 versions of Singular, but we don't have this problem.
+    # https://trac.sagemath.org/ticket/32959
+    ./patches/linbox-1.7-upgrade.patch
   ];
 
   patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
diff --git a/pkgs/applications/science/math/sage/sage-with-env.nix b/pkgs/applications/science/math/sage/sage-with-env.nix
index b74ec4007e6..df3a1467d53 100644
--- a/pkgs/applications/science/math/sage/sage-with-env.nix
+++ b/pkgs/applications/science/math/sage/sage-with-env.nix
@@ -18,7 +18,6 @@
 , eclib
 , ntl
 , ecm
-, pynac
 , pythonEnv
 }:
 
@@ -36,7 +35,6 @@ let
     blas lapack
     singular
     three
-    pynac
     giac
     gap
     pari
@@ -126,6 +124,10 @@ stdenv.mkDerivation rec {
     cp -r src/bin "$out/bin"
     cp -r build/bin "$out/build/bin"
 
+    # sage assumes the existence of sage-src-env-config.in means it's being executed in-tree. in this case, it
+    # adds SAGE_SRC/bin to PATH, breaking our wrappers
+    rm "$out/bin"/*.in "$out/build/bin"/*.in
+
     cp -f '${sage-env}/sage-env' "$out/bin/sage-env"
     substituteInPlace "$out/bin/sage-env" \
       --subst-var-by sage-local "$out"
diff --git a/pkgs/applications/science/math/sage/sage.nix b/pkgs/applications/science/math/sage/sage.nix
index 106f9eea309..5805a5c7b0c 100644
--- a/pkgs/applications/science/math/sage/sage.nix
+++ b/pkgs/applications/science/math/sage/sage.nix
@@ -62,7 +62,8 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
-    license = licenses.gpl2;
+    homepage = "https://www.sagemath.org";
+    license = licenses.gpl2Plus;
     maintainers = teams.sage.members;
   };
 }
diff --git a/pkgs/applications/science/math/sage/sage_docbuild.nix b/pkgs/applications/science/math/sage/sage_docbuild.nix
deleted file mode 100644
index ed78d46b445..00000000000
--- a/pkgs/applications/science/math/sage/sage_docbuild.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ buildPythonPackage
-, sage-src
-, sphinx
-}:
-
-buildPythonPackage rec {
-  version = src.version;
-  pname = "sage_docbuild";
-  src = sage-src;
-
-  propagatedBuildInputs = [
-    sphinx
-  ];
-
-  preBuild = ''
-    cd build/pkgs/sage_docbuild/src
-  '';
-
-  doCheck = false; # we will run tests in sagedoc.nix
-}
diff --git a/pkgs/applications/science/math/sage/sagedoc.nix b/pkgs/applications/science/math/sage/sagedoc.nix
index 6016b3baeb4..978d96e597b 100644
--- a/pkgs/applications/science/math/sage/sagedoc.nix
+++ b/pkgs/applications/science/math/sage/sagedoc.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     jmol
     cddlib
   ] ++ (with python3.pkgs; [
-    sage_docbuild
+    sage-docbuild
     psutil
     future
     sphinx
diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix
index 47e857a7bbb..8d685c8da60 100644
--- a/pkgs/applications/science/math/sage/sagelib.nix
+++ b/pkgs/applications/science/math/sage/sagelib.nix
@@ -38,7 +38,7 @@
 , pkg-config
 , planarity
 , ppl
-, pynac
+, primecountpy
 , python
 , ratpoints
 , readline
@@ -50,6 +50,7 @@
 , singular
 , pip
 , jupyter_core
+, sage-setup
 , libhomfly
 , libbraiding
 , gmpy2
@@ -86,6 +87,7 @@ buildPythonPackage rec {
     perl
     jupyter_core
     pkg-config
+    sage-setup
     pip # needed to query installed packages
     lisp-compiler
     m4
@@ -130,7 +132,7 @@ buildPythonPackage rec {
     pari
     planarity
     ppl
-    pynac
+    primecountpy
     rankwidth
     ratpoints
     singular
@@ -181,6 +183,7 @@ buildPythonPackage rec {
     # build/pkgs, either directly or via sage-get-system-packages.
     sed -i 's/==2.1.0rc1/>=2.1.1/' ../gmpy2/install-requires.txt
     sed -i 's/, <3.4//' ../rpy2/install-requires.txt
+    sed -i 's/, <4.3//' ../sphinx/install-requires.txt
     sed -i '/sage_conf/d' src/setup.cfg.m4
     sed -i '/sage_conf/d' src/requirements.txt.m4
     for infile in src/*.m4; do