* Re: [PATCH] Add python-statsmodels.
@ 2015-10-19 16:15 Federico Beffa
0 siblings, 0 replies; 3+ messages in thread
From: Federico Beffa @ 2015-10-19 16:15 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
ludo@gnu.org (Ludovic Courtès) writes:
> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>> + (add-after 'unpack 'set-matplotlib-backend-to-agg
>> + (lambda _
>> + ;; Set the matplotlib backend to Agg to avoid problems using the
>> + ;; GTK backend without a display.
>> + (substitute* (find-files "statsmodels/graphics/tests" "\\.py")
>> + (("import matplotlib\\.pyplot as plt" line)
>> + (string-append "import matplotlib;matplotlib.use('Agg');"
>> + line)))
>
> This looks good. Should we eventually change Matplotlib itself to use
> this back-end by default? What’s at stake exactly?
I don't think so. This back-end is only usable to produce files, it
can't be used for interactive sessions (which is the key appeal of the
numpy/scipy/matplotlib work-flow over C/C++). IMO we should switch to
the TkInter back-end which is part of the standard Python Library. It
was not available in our python when I did package matplotlib.
Regards,
Fede
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Add python-statsmodels.
@ 2015-10-16 13:48 Ricardo Wurmus
2015-10-19 15:47 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Wurmus @ 2015-10-16 13:48 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 167 bytes --]
Hi Guix,
the attached patch adds python{,2}-statsmodels to statistics.scm. Note
that this depends on my previous patch adding patsy to the same module.
~~ Ricardo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-python-statsmodels.patch --]
[-- Type: text/x-patch, Size: 3385 bytes --]
From 33ddc045065722a0bac9b28ad909e838b169d7cb Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Tue, 13 Oct 2015 13:28:58 +0200
Subject: [PATCH 1/2] gnu: Add python-statsmodels.
* gnu/packages/statistics.scm (python-statsmodels, python2-statsmodels):
New variables.
---
gnu/packages/statistics.scm | 64 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 1492094..0c0464c 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -989,3 +989,67 @@ building design matrices.")
,@(alist-delete "python-numpy"
(alist-delete "python-scipy"
(package-propagated-inputs patsy))))))))
+
+(define-public python-statsmodels
+ (package
+ (name "python-statsmodels")
+ (version "0.6.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://pypi.python.org/packages/source/"
+ "s/statsmodels/statsmodels-" version ".tar.gz"))
+ (sha256
+ (base32
+ "0xn67sqr0cc1lmlhzm71352hrb4hw7g318p5ff5q97pc98vl8kmy"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ ;; tests must be run after installation
+ (delete 'check)
+ (add-after 'unpack 'set-matplotlib-backend-to-agg
+ (lambda _
+ ;; Set the matplotlib backend to Agg to avoid problems using the
+ ;; GTK backend without a display.
+ (substitute* (find-files "statsmodels/graphics/tests" "\\.py")
+ (("import matplotlib\\.pyplot as plt" line)
+ (string-append "import matplotlib;matplotlib.use('Agg');"
+ line)))
+ #t))
+ (add-after 'install 'check
+ (lambda _
+ (with-directory-excursion "/tmp"
+ (zero? (system* "nosetests"
+ "--stop"
+ "-v" "statsmodels"))))))))
+ (propagated-inputs
+ `(("python-numpy" ,python-numpy)
+ ("python-scipy" ,python-scipy)
+ ("python-pandas" ,python-pandas)
+ ("python-patsy" ,python-patsy)
+ ("python-matplotlib" ,python-matplotlib)))
+ (native-inputs
+ `(("python-cython" ,python-cython)
+ ("python-nose" ,python-nose)
+ ("python-sphinx" ,python-sphinx)))
+ (home-page "http://statsmodels.sourceforge.net/")
+ (synopsis "Statistical modeling and econometrics in Python")
+ (description
+ "Statsmodels is a Python package that provides a complement to scipy for
+statistical computations including descriptive statistics and estimation and
+inference for statistical models.")
+ (license license:bsd-3)))
+
+(define-public python2-statsmodels
+ (let ((stats (package-with-python2 python-statsmodels)))
+ (package (inherit stats)
+ (propagated-inputs
+ `(("python2-numpy" ,python2-numpy)
+ ("python2-scipy" ,python2-scipy)
+ ("python2-pandas" ,python2-pandas)
+ ("python2-patsy" ,python2-patsy)
+ ("python2-matplotlib" ,python2-matplotlib)))
+ (native-inputs
+ `(("python2-setuptools" ,python2-setuptools)
+ ,@(package-native-inputs stats))))))
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Add python-statsmodels.
2015-10-16 13:48 Ricardo Wurmus
@ 2015-10-19 15:47 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2015-10-19 15:47 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: guix-devel
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
> the attached patch adds python{,2}-statsmodels to statistics.scm. Note
> that this depends on my previous patch adding patsy to the same module.
Hmm I lost track of patsy in my inbox. I’ll check afterwards.
> From 33ddc045065722a0bac9b28ad909e838b169d7cb Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Tue, 13 Oct 2015 13:28:58 +0200
> Subject: [PATCH 1/2] gnu: Add python-statsmodels.
>
> * gnu/packages/statistics.scm (python-statsmodels, python2-statsmodels):
> New variables.
LGTM.
> + (add-after 'unpack 'set-matplotlib-backend-to-agg
> + (lambda _
> + ;; Set the matplotlib backend to Agg to avoid problems using the
> + ;; GTK backend without a display.
> + (substitute* (find-files "statsmodels/graphics/tests" "\\.py")
> + (("import matplotlib\\.pyplot as plt" line)
> + (string-append "import matplotlib;matplotlib.use('Agg');"
> + line)))
This looks good. Should we eventually change Matplotlib itself to use
this back-end by default? What’s at stake exactly?
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-19 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 16:15 [PATCH] Add python-statsmodels Federico Beffa
-- strict thread matches above, loose matches on Subject: below --
2015-10-16 13:48 Ricardo Wurmus
2015-10-19 15:47 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).