From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: [PATCH] gnu: Add Scikit-learn. Date: Thu, 26 Feb 2015 12:28:10 +0100 Message-ID: References: <20150223173628.GA10455@debian.eduroam.u-bordeaux.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQwcB-0002Cm-6H for guix-devel@gnu.org; Thu, 26 Feb 2015 06:28:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQwc7-0006UE-Qx for guix-devel@gnu.org; Thu, 26 Feb 2015 06:28:23 -0500 Received: from pegasus.bbbm.mdc-berlin.de ([141.80.25.20]:44735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQwc7-0006U1-EC for guix-devel@gnu.org; Thu, 26 Feb 2015 06:28:19 -0500 In-Reply-To: <20150223173628.GA10455@debian.eduroam.u-bordeaux.fr> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Andreas Enge Cc: Guix-devel --=-=-= Content-Type: text/plain Andreas Enge writes: > On Mon, Feb 23, 2015 at 06:17:47PM +0100, Ricardo Wurmus wrote: >> The python2-scikit-learn package isn't working as it should. It does >> not actually install python2.7 libraries but just the 3.3 libs. > > I think you did things the wrong way around: You inherit from the python3 > package, then swap its inputs against those from the python2-wrapped one. > In this way, the "#:python" field of "arguments" remains at python3. Yeah, I screwed up. Attached is a better version that actually works. I explicitly delete python-scipy and python-numpy, both of which have matplotlib (and thus the problematic python-pycairo) as inputs, from the propagated inputs and add their python2 versions manually. ~~ Ricardo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0001-gnu-Add-Scikit-learn.patch" >From bc1f142127c734342cd308476ce9a7540f8326ec Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 23 Feb 2015 17:22:29 +0100 Subject: [PATCH] gnu: Add Scikit-learn. * gnu/packages/python.scm (python-scikit-learn, python2-scikit-learn): New variables. --- gnu/packages/python.scm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 6515237..7128182 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -1952,6 +1952,74 @@ sources.") (define-public python2-sphinx-rtd-theme (package-with-python2 python-sphinx-rtd-theme)) +(define-public python-scikit-learn + (package + (name "python-scikit-learn") + (version "0.15.2") + (source + (origin + (method url-fetch) + (uri (string-append + "https://github.com/scikit-learn/scikit-learn/archive/" + version ".tar.gz")) + (sha256 + (base32 + "1rb93h2q15f219sz60sczjb65rg70xjmnp0q4pkkaairx5s05q55")))) + (build-system python-build-system) + (arguments + `(#:phases + (alist-cons-before + 'build 'set-environment-variables + (lambda* (#:key inputs #:allow-other-keys) + (let* ((atlas-threaded + (string-append (assoc-ref inputs "atlas") + "/lib/libtatlas.so")) + ;; On single core CPUs only the serial library is created. + (atlas-lib + (if (file-exists? atlas-threaded) + atlas-threaded + (string-append (assoc-ref inputs "atlas") + "/lib/libsatlas.so")))) + (setenv "ATLAS" atlas-lib))) + (alist-cons-before + 'check 'set-HOME + ;; some tests require access to "$HOME" + (lambda _ (setenv "HOME" "/tmp")) + ;; Tests can only be run after the library has been installed and not + ;; within the source directory. + (alist-cons-after + 'install 'check + (lambda _ + (with-directory-excursion "/tmp" + ;; With Python 3 one test of 3334 fails + ;; (sklearn.tests.test_common.test_transformers); see + ;; https://github.com/scikit-learn/scikit-learn/issues/3693 + (system* "nosetests" "-v" "sklearn"))) + (alist-delete 'check %standard-phases)))))) + (inputs + `(("atlas" ,atlas) + ("python-nose" ,python-nose))) + (propagated-inputs + `(("python-numpy" ,python-numpy) + ("python-scipy" ,python-scipy))) + (home-page "http://scikit-learn.org/") + (synopsis "Machine Learning in Python") + (description + "Scikit-learn provides simple and efficient tools for data +mining and data analysis.") + (license bsd-3))) + +(define-public python2-scikit-learn + (let ((scikit (package-with-python2 python-scikit-learn))) + (package (inherit scikit) + (propagated-inputs + `(("python2-numpy" ,python2-numpy) + ("python2-scipy" ,python2-scipy) + ,@(alist-delete + "python-numpy" + (alist-delete + "python-scipy" (package-propagated-inputs scikit)))))))) + (define-public python-cython (package (name "python-cython") -- 2.1.0 --=-=-=--