diff mbox series

[bug#41889] gnu: jupyter: Fix python-ipython conflict that prevented installation

Message ID 87o8pj9ymu.fsf@alice.lan
State Accepted
Headers show
Series [bug#41889] gnu: jupyter: Fix python-ipython conflict that prevented installation | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Edouard Klein June 16, 2020, 8:57 a.m. UTC
* gnu/packages/python-xyz.scm (python-prompt-toolkit, python-prompt-toolkit-2)
(prompt-toolkit-2-instead-of-prompt-toolkit, python2-prompt-toolkit)
(python-prompt-toolkit-1): Move up so that packages defined below
can see them.
(python-widgetsnbextension): Wrap in
prompt-toolkit-2-instead-of-prompt-toolkit to satisfy an explicit
dependency on python-prompt-toolkit-2.
(python-ipywidgets): Likewise.
(python-jupyter-console): Likewise.
(jupyter): Likewise.

* gnu/packages/package-management.scm (guix-jupyter): Wrap some
dependencies in prompt-toolkit-2-instead-of-prompt-toolkit to make the
reverse bag graphs of python-prompt-toolkit-2 and python-prompt-toolkit-3
disconnected graphs.

* gnu/packages/machine-learning.scm (python-iml): Wrap in
prompt-toolkit-2-instead-of-prompt-toolkit to satisfy an explicit
dependency on python-prompt-toolkit-2.
---
 gnu/packages/machine-learning.scm   |  46 ++--
 gnu/packages/package-management.scm |   4 +-
 gnu/packages/python-xyz.scm         | 345 ++++++++++++++--------------
 3 files changed, 198 insertions(+), 197 deletions(-)

Comments

Edouard Klein June 16, 2020, 9:21 a.m. UTC | #1
Hi all,

Here is my proposed correction for the breakage I introduced when I
updated python-prompt-toolkit (bugs #41738, #41729 and 41730).

As you can see on the attached images, I disconnected all packages that
depend on ppt2 from the packages that depend on ppt3.
This should fix all reported problems. If it does not, this means that
there is an undeclared dependency, which is a bug. Please do not
hesitate to tell me about any problem you encounter that my be tied to
this change.

jupyter's &co dependency on ppt2 is still a mystery to me. It is computed
by the setuptools when they run but nowhere in the source of the
packages that have an explicit dependency on ppt2 was I able to find any
reference to it.

I have no idea how setuptools comes to the conclusion that it needs
"prompt_toolkit<2.1.0,>=2.0.0". I (grep -r -i)-ed, in the source code of
ipywidgets and could not find anything. This is black magic to me.

I would have loved to bring all those packages to ppt3 and forget about
ppt2 altogether, but because nowhere in the source is the dependency
written, I can't do it. Any help would be appreciated. In the meantime
this fix should do the trick.

I did not repair packages that were broken for reasons unrelated to
ppt, but I'm quite confident that once their brokenness is fixed, ppt3
won't be a problem for them. For example in my dirty work tree I have a
fix for python-rpy2, but it is tied to a pandas upgrade, and too many
packages depend on pandas for me to handle right now.

Cheers,

Edouard.
Ricardo Wurmus June 16, 2020, 5:37 p.m. UTC | #2
Hi Edouard,

thank you for providing a fix.  I think it’s too complicated, though.
Using prompt-toolkit-2-instead-of-prompt-toolkit everywhere does not
seem like an elegant solution.

I pushed a different fix with commit 7146c8c75d.
diff mbox series

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 0e11da41ca..51bf2ad779 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1805,33 +1805,33 @@  advanced research.")
     (license license:asl2.0)))
 
 (define-public python-iml
-  (package
-    (name "python-iml")
-    (version "0.6.2")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "iml" version))
-       (sha256
-        (base32
-         "1k8szlpm19rcwcxdny9qdm3gmaqq8akb4xlvrzyz8c2d679aak6l"))))
-    (build-system python-build-system)
-    (propagated-inputs
-     `(("ipython" ,(prompt-toolkit-2-instead-of-prompt-toolkit
-                    python-ipython))
-       ("numpy" ,python-numpy)
-       ("pandas" ,python-pandas)
-       ("scipy" ,python-scipy)))
-    (native-inputs
-     `(("nose" ,python-nose)))
-    (home-page "https://github.com/interpretable-ml/iml")
-    (synopsis "Interpretable Machine Learning (iML) package")
-    (description "Interpretable ML (iML) is a set of data type objects,
+  (prompt-toolkit-2-instead-of-prompt-toolkit
+   (package
+     (name "python-iml")
+     (version "0.6.2")
+     (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "iml" version))
+        (sha256
+         (base32
+          "1k8szlpm19rcwcxdny9qdm3gmaqq8akb4xlvrzyz8c2d679aak6l"))))
+     (build-system python-build-system)
+     (propagated-inputs
+      `(("ipython" ,python-ipython)
+        ("numpy" ,python-numpy)
+        ("pandas" ,python-pandas)
+        ("scipy" ,python-scipy)))
+     (native-inputs
+      `(("nose" ,python-nose)))
+     (home-page "https://github.com/interpretable-ml/iml")
+     (synopsis "Interpretable Machine Learning (iML) package")
+     (description "Interpretable ML (iML) is a set of data type objects,
 visualizations, and interfaces that can be used by any method designed to
 explain the predictions of machine learning models (or really the output of
 any function).  It currently contains the interface and IO code from the Shap
 project, and it will potentially also do the same for the Lime project.")
-    (license license:expat)))
+     (license license:expat))))
 
 (define-public python-keras-applications
   (package
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index c1e6657dff..c282ecab40 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -976,8 +976,8 @@  environments.")
 
        ;; For testing.
        ("jupyter" ,jupyter)
-       ("python-ipython" ,python-ipython)
-       ("python-ipykernel" ,python-ipykernel)))
+       ("python-ipython" ,(prompt-toolkit-2-instead-of-prompt-toolkit python-ipython))
+       ("python-ipykernel" ,(prompt-toolkit-2-instead-of-prompt-toolkit python-ipykernel))))
     (inputs
      `(("guix" ,guix)
        ("guile" ,guile-3.0)))
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 7e0a738d51..ebe21a3754 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -8872,6 +8872,81 @@  functions to find and load entry points.")
 from elisp.")
     (license license:gpl3)))
 
+(define-public python-prompt-toolkit
+  (package
+    (name "python-prompt-toolkit")
+    (version "3.0.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "prompt_toolkit" version))
+       (sha256
+        (base32
+         "1j3x5s4gp4ih73sbcni0a0vffbzvrxbrbnkvb3fzjgxn810ilgan"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'check)
+         (add-after 'install 'post-install-check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; HOME is needed for the test
+             ;; "test_pathcompleter_can_expanduser".
+             (setenv "HOME" "/tmp")
+             (add-installed-pythonpath inputs outputs)
+             (invoke "py.test"))))))
+    (propagated-inputs
+     `(("python-wcwidth" ,python-wcwidth)))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (home-page
+     "https://github.com/prompt-toolkit/python-prompt-toolkit")
+    (synopsis "Library for building command line interfaces in Python")
+    (description
+     "Prompt-Toolkit is a library for building interactive command line
+interfaces in Python.  It's like GNU Readline but it also features syntax
+highlighting while typing, out-of-the-box multi-line input editing, advanced
+code completion, incremental search, support for Chinese double-width
+characters, mouse support, and auto suggestions.")
+    (license license:bsd-3)))
+
+(define-public python-prompt-toolkit-2
+  (package (inherit python-prompt-toolkit)
+    (name "python-prompt-toolkit")
+    (version "2.0.7")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "prompt_toolkit" version))
+       (sha256
+        (base32
+         "0fgacqk73w7s932vy46pan2yp8rvjmlkag20xvaydh9mhf6h85zx"))))
+    (propagated-inputs
+     `(("python-wcwidth" ,python-wcwidth)
+       ("python-six" ,python-six)
+       ("python-pygments" ,python-pygments)))))
+
+(define-public prompt-toolkit-2-instead-of-prompt-toolkit
+  (package-input-rewriting/spec
+   `(("python-prompt-toolkit" . ,(const python-prompt-toolkit-2)))))
+
+(define-public python2-prompt-toolkit
+  (package-with-python2 python-prompt-toolkit-2))
+
+(define-public python-prompt-toolkit-1
+  (package (inherit python-prompt-toolkit-2)
+    (version "1.0.15")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "prompt_toolkit" version ".tar.gz"))
+       (sha256
+        (base32
+         "05v9h5nydljwpj5nm8n804ms0glajwfy1zagrzqrg91wk3qqi1c5"))))))
+
+(define-public python2-prompt-toolkit-1
+  (package-with-python2 python-prompt-toolkit-1))
+
 (define-public python-nbconvert
   (package
     (name "python-nbconvert")
@@ -8992,91 +9067,91 @@  interactive computing.")
                   (("formats = self.nbconvert_api") "return #")))))))))))
 
 (define-public python-widgetsnbextension
-  (package
-    (name "python-widgetsnbextension")
-    (version "3.5.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "widgetsnbextension" version))
-       (sha256
-        (base32
-         "1ismyaxbv9d56yqqqb8xl58hg0iq0bbyy014a53y1g3hfbc8g7q7"))))
-    (build-system python-build-system)
-    (propagated-inputs
-     `(("python-ipykernel"
-        ,(prompt-toolkit-2-instead-of-prompt-toolkit python-ipykernel))
-       ("python-notebook" ,python-notebook)))
-    (native-inputs
-     `(("python-certifi" ,python-certifi)
-       ("python-nose" ,python-nose)))
-    (home-page "https://ipython.org")
-    (synopsis "IPython HTML widgets for Jupyter")
-    (description "This package provides interactive HTML widgets for Jupyter
+  (prompt-toolkit-2-instead-of-prompt-toolkit
+   (package
+     (name "python-widgetsnbextension")
+     (version "3.5.1")
+     (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "widgetsnbextension" version))
+        (sha256
+         (base32
+          "1ismyaxbv9d56yqqqb8xl58hg0iq0bbyy014a53y1g3hfbc8g7q7"))))
+     (build-system python-build-system)
+     (propagated-inputs
+      `(("python-ipykernel" ,python-ipykernel)
+        ("python-notebook" ,python-notebook)))
+     (native-inputs
+      `(("python-certifi" ,python-certifi)
+        ("python-nose" ,python-nose)))
+     (home-page "https://ipython.org")
+     (synopsis "IPython HTML widgets for Jupyter")
+     (description "This package provides interactive HTML widgets for Jupyter
 notebooks.")
-    (license license:bsd-3)))
+     (license license:bsd-3))))
 
 (define-public python2-widgetsnbextension
   (package-with-python2 python-widgetsnbextension))
 
 (define-public python-ipywidgets
-  (package
-    (name "python-ipywidgets")
-    (version "7.5.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "ipywidgets" version))
-       (sha256
-        (base32
-         "15sww2mvnkqlvx55gwa82v05062a8j1xpncnqna4k9sl53hgcig9"))))
-    (build-system python-build-system)
-    (propagated-inputs
-     `(("python-ipython" ,(prompt-toolkit-2-instead-of-prompt-toolkit
-                           python-ipython))
-       ("python-traitlets" ,python-traitlets)
-       ("python-widgetsnbextension" ,python-widgetsnbextension)))
-    (native-inputs
-     `(("python-nose" ,python-nose)
-       ("python-pytest" ,python-pytest)))
-    (home-page "https://ipython.org")
-    (synopsis "IPython HTML widgets for Jupyter")
-    (description "Ipywidgets are interactive HTML widgets for Jupyter
+  (prompt-toolkit-2-instead-of-prompt-toolkit
+   (package
+     (name "python-ipywidgets")
+     (version "7.5.1")
+     (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "ipywidgets" version))
+        (sha256
+         (base32
+          "15sww2mvnkqlvx55gwa82v05062a8j1xpncnqna4k9sl53hgcig9"))))
+     (build-system python-build-system)
+     (propagated-inputs
+      `(("python-ipython" ,python-ipython)
+        ("python-traitlets" ,python-traitlets)
+        ("python-widgetsnbextension" ,python-widgetsnbextension)))
+     (native-inputs
+      `(("python-nose" ,python-nose)
+        ("python-pytest" ,python-pytest)))
+     (home-page "https://ipython.org")
+     (synopsis "IPython HTML widgets for Jupyter")
+     (description "Ipywidgets are interactive HTML widgets for Jupyter
 notebooks and the IPython kernel.  Notebooks come alive when interactive
 widgets are used.  Users gain control of their data and can visualize changes
 in the data.")
-    (license license:bsd-3)))
+     (license license:bsd-3))))
 
 (define-public python2-ipywidgets
   (package-with-python2 python-ipywidgets))
 
 (define-public python-jupyter-console
-  (package
-    (name "python-jupyter-console")
-    (version "6.1.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "jupyter_console" version))
-       (sha256
-        (base32
-         "06s3kr5vx0l1y1b7fxb04dmrppscl7q69sl9yyfr0d057d1ssvkg"))))
-    (build-system python-build-system)
-    (propagated-inputs
-     `(("python-ipykernel" ,(prompt-toolkit-2-instead-of-prompt-toolkit
-        python-ipykernel))
-       ("python-jupyter-client" ,python-jupyter-client)
-       ("python-prompt-toolkit" ,python-prompt-toolkit-2)
-       ("python-pygments" ,python-pygments)))
-    (native-inputs
-     `(("python-nose" ,python-nose)))
-    (home-page "https://jupyter.org")
-    (synopsis "Jupyter terminal console")
-    (description "This package provides a terminal-based console frontend for
+  (prompt-toolkit-2-instead-of-prompt-toolkit
+   (package
+     (name "python-jupyter-console")
+     (version "6.1.0")
+     (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "jupyter_console" version))
+        (sha256
+         (base32
+          "06s3kr5vx0l1y1b7fxb04dmrppscl7q69sl9yyfr0d057d1ssvkg"))))
+     (build-system python-build-system)
+     (propagated-inputs
+      `(("python-ipykernel" ,python-ipykernel)
+        ("python-jupyter-client" ,python-jupyter-client)
+        ("python-prompt-toolkit" ,python-prompt-toolkit)
+        ("python-pygments" ,python-pygments)))
+     (native-inputs
+      `(("python-nose" ,python-nose)))
+     (home-page "https://jupyter.org")
+     (synopsis "Jupyter terminal console")
+     (description "This package provides a terminal-based console frontend for
 Jupyter kernels.  It also allows for console-based interaction with non-Python
 Jupyter kernels such as IJulia and IRKernel.")
-    (properties `((python2-variant . ,(delay python2-jupyter-console))))
-    (license license:bsd-3)))
+     (properties `((python2-variant . ,(delay python2-jupyter-console))))
+     (license license:bsd-3))))
 
 (define-public python2-jupyter-console
   (package
@@ -9209,37 +9284,38 @@  popular online obfuscators.")
     (license license:expat)))
 
 (define-public jupyter
-  (package
-    (name "jupyter")
-    (version "1.0.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "jupyter" version))
-       (sha256
-        (base32
-         "0pwf3pminkzyzgx5kcplvvbvwrrzd3baa7lmh96f647k30rlpp6r"))))
-    (build-system python-build-system)
-    (arguments '(#:tests? #f)) ; there are none.
-    (propagated-inputs
-     `(("python-ipykernel" ,python-ipykernel)
-       ("python-ipywidgets" ,python-ipywidgets)
-       ("python-jupyter-console" ,python-jupyter-console)
-       ("python-nbconvert" ,python-nbconvert)
-       ("python-notebook" ,python-notebook)
-       ("python-qtconsole" ,python-qtconsole)))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "JUPYTER_PATH")
-            (files '("share/jupyter")))))
-    (home-page "https://jupyter.org")
-    (synopsis "Web application for interactive documents")
-    (description
-     "The Jupyter Notebook is a web application that allows you to create and
+  (prompt-toolkit-2-instead-of-prompt-toolkit
+   (package
+     (name "jupyter")
+     (version "1.0.0")
+     (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "jupyter" version))
+        (sha256
+         (base32
+          "0pwf3pminkzyzgx5kcplvvbvwrrzd3baa7lmh96f647k30rlpp6r"))))
+     (build-system python-build-system)
+     (arguments '(#:tests? #f)) ; there are none.
+     (propagated-inputs
+      `(("python-ipykernel" ,python-ipykernel)
+        ("python-ipywidgets" ,python-ipywidgets)
+        ("python-jupyter-console" ,python-jupyter-console)
+        ("python-nbconvert" ,python-nbconvert)
+        ("python-notebook" ,python-notebook)
+        ("python-qtconsole" ,python-qtconsole)))
+     (native-search-paths
+      (list (search-path-specification
+             (variable "JUPYTER_PATH")
+             (files '("share/jupyter")))))
+     (home-page "https://jupyter.org")
+     (synopsis "Web application for interactive documents")
+     (description
+      "The Jupyter Notebook is a web application that allows you to create and
 share documents that contain live code, equations, visualizations and
 explanatory text.  Uses include: data cleaning and transformation, numerical
 simulation, statistical modeling, machine learning and much more.")
-    (license license:bsd-3)))
+     (license license:bsd-3))))
 
 (define-public python-chardet
   (package
@@ -12138,81 +12214,6 @@  collections of data.")
 (define-public python2-backpack
   (package-with-python2 python-backpack))
 
-(define-public python-prompt-toolkit
-  (package
-    (name "python-prompt-toolkit")
-    (version "3.0.5")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "prompt_toolkit" version))
-       (sha256
-        (base32
-         "1j3x5s4gp4ih73sbcni0a0vffbzvrxbrbnkvb3fzjgxn810ilgan"))))
-    (build-system python-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (delete 'check)
-         (add-after 'install 'post-install-check
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; HOME is needed for the test
-             ;; "test_pathcompleter_can_expanduser".
-             (setenv "HOME" "/tmp")
-             (add-installed-pythonpath inputs outputs)
-             (invoke "py.test"))))))
-    (propagated-inputs
-     `(("python-wcwidth" ,python-wcwidth)))
-    (native-inputs
-     `(("python-pytest" ,python-pytest)))
-    (home-page
-     "https://github.com/prompt-toolkit/python-prompt-toolkit")
-    (synopsis "Library for building command line interfaces in Python")
-    (description
-     "Prompt-Toolkit is a library for building interactive command line
-interfaces in Python.  It's like GNU Readline but it also features syntax
-highlighting while typing, out-of-the-box multi-line input editing, advanced
-code completion, incremental search, support for Chinese double-width
-characters, mouse support, and auto suggestions.")
-    (license license:bsd-3)))
-
-(define-public python-prompt-toolkit-2
-  (package (inherit python-prompt-toolkit)
-    (name "python-prompt-toolkit")
-    (version "2.0.7")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "prompt_toolkit" version))
-       (sha256
-        (base32
-         "0fgacqk73w7s932vy46pan2yp8rvjmlkag20xvaydh9mhf6h85zx"))))
-    (propagated-inputs
-     `(("python-wcwidth" ,python-wcwidth)
-       ("python-six" ,python-six)
-       ("python-pygments" ,python-pygments)))))
-
-(define-public prompt-toolkit-2-instead-of-prompt-toolkit
-  (package-input-rewriting/spec
-   `(("python-prompt-toolkit" . ,(const python-prompt-toolkit-2)))))
-
-(define-public python2-prompt-toolkit
-  (package-with-python2 python-prompt-toolkit-2))
-
-(define-public python-prompt-toolkit-1
-  (package (inherit python-prompt-toolkit-2)
-    (version "1.0.15")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "prompt_toolkit" version ".tar.gz"))
-       (sha256
-        (base32
-         "05v9h5nydljwpj5nm8n804ms0glajwfy1zagrzqrg91wk3qqi1c5"))))))
-
-(define-public python2-prompt-toolkit-1
-  (package-with-python2 python-prompt-toolkit-1))
-
 (define-public python-jedi
   (package
     (name "python-jedi")