python-science.scm 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015, 2016, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
  3. ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
  4. ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
  5. ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
  6. ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
  8. ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
  9. ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  10. ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
  11. ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
  12. ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
  13. ;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
  14. ;;; Copyright © 2021 Roel Janssen <roel@gnu.org>
  15. ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
  16. ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
  17. ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
  18. ;;;
  19. ;;; This file is part of GNU Guix.
  20. ;;;
  21. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  22. ;;; under the terms of the GNU General Public License as published by
  23. ;;; the Free Software Foundation; either version 3 of the License, or (at
  24. ;;; your option) any later version.
  25. ;;;
  26. ;;; GNU Guix is distributed in the hope that it will be useful, but
  27. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  28. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. ;;; GNU General Public License for more details.
  30. ;;;
  31. ;;; You should have received a copy of the GNU General Public License
  32. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  33. (define-module (gnu packages python-science)
  34. #:use-module ((guix licenses) #:prefix license:)
  35. #:use-module (gnu packages)
  36. #:use-module (gnu packages base)
  37. #:use-module (gnu packages check)
  38. #:use-module (gnu packages databases)
  39. #:use-module (gnu packages gcc)
  40. #:use-module (gnu packages image-processing)
  41. #:use-module (gnu packages machine-learning)
  42. #:use-module (gnu packages maths)
  43. #:use-module (gnu packages mpi)
  44. #:use-module (gnu packages perl)
  45. #:use-module (gnu packages pkg-config)
  46. #:use-module (gnu packages python)
  47. #:use-module (gnu packages python-build)
  48. #:use-module (gnu packages python-crypto)
  49. #:use-module (gnu packages python-check)
  50. #:use-module (gnu packages python-web)
  51. #:use-module (gnu packages python-xyz)
  52. #:use-module (gnu packages simulation)
  53. #:use-module (gnu packages sphinx)
  54. #:use-module (gnu packages statistics)
  55. #:use-module (gnu packages time)
  56. #:use-module (gnu packages xdisorg)
  57. #:use-module (gnu packages xml)
  58. #:use-module (gnu packages xorg)
  59. #:use-module (guix packages)
  60. #:use-module (guix download)
  61. #:use-module (guix git-download)
  62. #:use-module (guix utils)
  63. #:use-module (guix build-system python))
  64. (define-public python-scipy
  65. (package
  66. (name "python-scipy")
  67. (version "1.6.0")
  68. (source
  69. (origin
  70. (method url-fetch)
  71. (uri (pypi-uri "scipy" version))
  72. (sha256
  73. (base32 "0rh5b1rwdcvvagld8vpxnpaibszy1skpx39a0fwzd5gx5pwcjvfb"))))
  74. (build-system python-build-system)
  75. (propagated-inputs
  76. `(("python-numpy" ,python-numpy)
  77. ("python-matplotlib" ,python-matplotlib)
  78. ("python-pyparsing" ,python-pyparsing)))
  79. (inputs
  80. `(("openblas" ,openblas)
  81. ("pybind11" ,pybind11)))
  82. (native-inputs
  83. `(("python-cython" ,python-cython)
  84. ("python-pytest" ,python-pytest)
  85. ("python-sphinx" ,python-sphinx)
  86. ("python-numpydoc" ,python-numpydoc)
  87. ("gfortran" ,gfortran)
  88. ("perl" ,perl)
  89. ("which" ,which)))
  90. (outputs '("out" "doc"))
  91. (arguments
  92. `(#:phases
  93. (modify-phases %standard-phases
  94. (add-before 'build 'change-home-dir
  95. (lambda _
  96. ;; Change from /homeless-shelter to /tmp for write permission.
  97. (setenv "HOME" "/tmp")
  98. #t))
  99. (add-after 'unpack 'disable-broken-tests
  100. (lambda _
  101. (substitute* "scipy/sparse/linalg/dsolve/tests/test_linsolve.py"
  102. (("^( +)def test_threads_parallel\\(self\\):" m indent)
  103. (string-append indent
  104. "@pytest.mark.skip(reason=\"Disabled by Guix\")\n"
  105. m)))
  106. (substitute* "scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py"
  107. (("^def test_parallel_threads\\(\\):" m)
  108. (string-append "@pytest.mark.skip(reason=\"Disabled by Guix\")\n"
  109. m)))
  110. #t))
  111. (add-before 'build 'configure-openblas
  112. (lambda* (#:key inputs #:allow-other-keys)
  113. (call-with-output-file "site.cfg"
  114. (lambda (port)
  115. (format port
  116. "[blas]
  117. libraries = openblas
  118. library_dirs = ~a/lib
  119. include_dirs = ~a/include
  120. # backslash-n to make emacs happy
  121. \n[atlas]
  122. library_dirs = ~a/lib
  123. atlas_libs = openblas
  124. "
  125. (assoc-ref inputs "openblas")
  126. (assoc-ref inputs "openblas")
  127. (assoc-ref inputs "openblas"))))
  128. #t))
  129. (add-after 'install 'install-doc
  130. (lambda* (#:key inputs outputs #:allow-other-keys)
  131. (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
  132. (doc (string-append data "/doc/" ,name "-" ,version))
  133. (html (string-append doc "/html"))
  134. (pyver ,(string-append "PYVER=" (version-major+minor
  135. (package-version python))))
  136. ;; By default it tries to run sphinx-build through the Python
  137. ;; interpreter which won't work with our shell wrapper.
  138. (sphinxbuild "SPHINXBUILD=LANG=C sphinx-build"))
  139. ;; Make installed package available for building the
  140. ;; documentation
  141. (add-installed-pythonpath inputs outputs)
  142. (with-directory-excursion "doc"
  143. ;; Fix generation of images for mathematical expressions.
  144. (substitute* (find-files "source" "conf\\.py")
  145. (("pngmath_use_preview = True")
  146. "pngmath_use_preview = False"))
  147. (mkdir-p html)
  148. (invoke "make" "html" pyver sphinxbuild)
  149. (with-directory-excursion "build/html"
  150. (for-each (lambda (file)
  151. (let* ((dir (dirname file))
  152. (tgt-dir (string-append html "/" dir)))
  153. (install-file file html)))
  154. (find-files "." ".*")))))
  155. #t))
  156. ;; Tests can only be run after the library has been installed and not
  157. ;; within the source directory.
  158. (delete 'check)
  159. (add-after 'install 'check
  160. (lambda* (#:key inputs outputs #:allow-other-keys)
  161. (add-installed-pythonpath inputs outputs)
  162. (with-directory-excursion "/tmp"
  163. (invoke "python" "-c"
  164. "import scipy; scipy.test(verbose=2)")))))))
  165. (home-page "https://www.scipy.org/")
  166. (synopsis "The Scipy library provides efficient numerical routines")
  167. (description "The SciPy library is one of the core packages that make up
  168. the SciPy stack. It provides many user-friendly and efficient numerical
  169. routines such as routines for numerical integration and optimization.")
  170. (properties `((python2-variant . ,(delay python2-scipy))))
  171. (license license:bsd-3)))
  172. ;; Version 1.2.2 is the last version to support Python 2
  173. (define-public python2-scipy
  174. (package
  175. (inherit (package-with-python2
  176. (strip-python2-variant python-scipy)))
  177. (version "1.2.2")
  178. (source
  179. (origin
  180. (method url-fetch)
  181. (uri (pypi-uri "scipy" version))
  182. (sha256
  183. (base32
  184. "1cgvgin8fvckv96hjh3ikmwkra5rif51bdb75ifzf7xbil5iwcx4"))))))
  185. (define-public python2-weave
  186. (package
  187. (name "python2-weave")
  188. (version "0.16.0")
  189. (source
  190. (origin
  191. (method url-fetch)
  192. (uri (pypi-uri "weave" version))
  193. (sha256
  194. (base32 "0jnm3584mfichgwgrd1gk5i42ll9c08nkw9716n947n4338f6ghs"))))
  195. (build-system python-build-system)
  196. (arguments
  197. `(#:python ,python-2
  198. #:phases
  199. (modify-phases %standard-phases
  200. (replace 'check
  201. (lambda _
  202. (invoke "nosetests" "-v"
  203. "--exclude"
  204. "test_(user|incorrect_ownership|char_fail|obj_fail)"))))))
  205. (propagated-inputs
  206. `(("python-numpy" ,python2-numpy)))
  207. (native-inputs
  208. `(("python-nose" ,python2-nose)))
  209. (home-page "https://www.scipy.org/")
  210. (synopsis "Tools for including C/C++ code within Python code")
  211. (description "Weave is the stand-alone version of the obsolete Scipy
  212. submodule @code{scipy.weave}. It is Python 2.x only, and is provided for
  213. users that need new versions of Scipy but have existing code that still
  214. depends on @code{scipy.weave}. For new code, users are recommended to use
  215. Cython.")
  216. (license license:bsd-3)))
  217. (define-public python-scikit-fuzzy
  218. (package
  219. (name "python-scikit-fuzzy")
  220. (version "0.4.2")
  221. (source
  222. (origin
  223. (method url-fetch)
  224. (uri (pypi-uri "scikit-fuzzy" version))
  225. (sha256
  226. (base32 "0bp1n771fj44kdp7a00bcvfwirvv2rc803b7g6yf3va7v0j29c8s"))))
  227. (build-system python-build-system)
  228. (arguments
  229. `(#:phases
  230. (modify-phases %standard-phases
  231. (replace 'check
  232. (lambda _
  233. (invoke "nosetests" "-s" "-v" "skfuzzy")
  234. #t)))))
  235. (native-inputs
  236. `(("python-nose" ,python-nose)))
  237. (propagated-inputs
  238. `(("python-networkx" ,python-networkx)
  239. ("python-numpy" ,python-numpy)
  240. ("python-scipy" ,python-scipy)))
  241. (home-page "https://github.com/scikit-fuzzy/scikit-fuzzy")
  242. (synopsis "Fuzzy logic toolkit for SciPy")
  243. (description
  244. "This package implements many useful tools for projects involving fuzzy
  245. logic, also known as grey logic.")
  246. (license license:bsd-3)))
  247. (define-public python-scikit-image
  248. (package
  249. (name "python-scikit-image")
  250. (version "0.18.1")
  251. (source
  252. (origin
  253. (method url-fetch)
  254. (uri (pypi-uri "scikit-image" version))
  255. (sha256
  256. (base32 "0wgisa03smhrphcjnhq7waa5vyyd32b67hblapjbqrqqj751idpv"))))
  257. (build-system python-build-system)
  258. (arguments
  259. `(#:phases
  260. (modify-phases %standard-phases
  261. (add-before 'build 'change-home-dir
  262. (lambda _
  263. ;; Change from /homeless-shelter to /tmp for write permission.
  264. (setenv "HOME" "/tmp")
  265. #t))
  266. (replace 'build
  267. (lambda _
  268. (invoke "make")))
  269. (replace 'check
  270. (lambda _
  271. ;; The following tests require online data.
  272. (invoke "python" "-m" "pytest" "skimage" "--doctest-modules" "-k"
  273. (string-append "not test_ndim"
  274. " and not test_skin")))))))
  275. ;; See requirements/ for the list of build and run time requirements.
  276. ;; NOTE: scikit-image has an optional dependency on python-pooch, however
  277. ;; propagating it would enable many more tests that require online data.
  278. (propagated-inputs
  279. `(("python-cloudpickle" ,python-cloudpickle)
  280. ("python-dask" ,python-dask)
  281. ("python-imageio" ,python-imageio)
  282. ("python-matplotlib" ,python-matplotlib)
  283. ("python-networkx" ,python-networkx)
  284. ("python-numpy" ,python-numpy)
  285. ("python-pillow" ,python-pillow)
  286. ("python-pywavelets" ,python-pywavelets)
  287. ("python-scipy" ,python-scipy)
  288. ("python-tifffile" ,python-tifffile)))
  289. (native-inputs
  290. `(("python-codecov" ,python-codecov)
  291. ("python-cython" ,python-cython)
  292. ("python-flake8" ,python-flake8)
  293. ("python-pytest" ,python-pytest)
  294. ("python-pytest-cov" ,python-pytest-cov)
  295. ("python-pytest-localserver" ,python-pytest-localserver)
  296. ("python-wheel" ,python-wheel)))
  297. (home-page "https://scikit-image.org/")
  298. (synopsis "Image processing in Python")
  299. (description
  300. "Scikit-image is a collection of algorithms for image processing.")
  301. (license license:bsd-3)))
  302. (define-public python-sgp4
  303. (package
  304. (name "python-sgp4")
  305. (version "2.12")
  306. (source
  307. (origin
  308. (method url-fetch)
  309. (uri (pypi-uri "sgp4" version))
  310. (sha256
  311. (base32 "0dncp9i5b6afkg7f8mj9j0qzsp008b8v73yc0qkmizhpns7mvwvx"))))
  312. (build-system python-build-system)
  313. (propagated-inputs
  314. `(("python-numpy" ,python-numpy)))
  315. (home-page "https://github.com/brandon-rhodes/python-sgp4")
  316. (synopsis "Track earth satellite TLE orbits using SGP4")
  317. (description
  318. "This package provides a Python implementation of the most recent version
  319. of the SGP4 satellite tracking algorithm.")
  320. (license license:expat)))
  321. (define-public python-pandas
  322. (package
  323. (name "python-pandas")
  324. (version "1.3.4")
  325. (source
  326. (origin
  327. (method url-fetch)
  328. (uri (pypi-uri "pandas" version))
  329. (sha256
  330. (base32 "1z3gm521wpm3j13rwhlb4f2x0645zvxkgxij37i3imdpy39iiam2"))))
  331. (build-system python-build-system)
  332. (arguments
  333. `(#:modules ((guix build utils)
  334. (guix build python-build-system)
  335. (ice-9 ftw)
  336. (srfi srfi-1)
  337. (srfi srfi-26))
  338. #:phases
  339. (modify-phases %standard-phases
  340. (add-after 'unpack 'patch-which
  341. (lambda* (#:key inputs #:allow-other-keys)
  342. (let ((which (assoc-ref inputs "which")))
  343. (substitute* "pandas/io/clipboard/__init__.py"
  344. (("^WHICH_CMD = .*")
  345. (string-append "WHICH_CMD = \"" which "\"\n"))))))
  346. (add-before 'check 'prepare-x
  347. (lambda _
  348. (system "Xvfb &")
  349. (setenv "DISPLAY" ":0")
  350. ;; xsel needs to write a log file.
  351. (setenv "HOME" "/tmp")))
  352. (replace 'check
  353. (lambda* (#:key tests? #:allow-other-keys)
  354. (let ((build-directory
  355. (string-append
  356. (getcwd) "/build/"
  357. (first (scandir "build"
  358. (cut string-prefix? "lib." <>))))))
  359. (substitute* "pyproject.toml"
  360. ;; Not all data files are distributed with the tarball.
  361. (("--strict-data-files ") ""))
  362. (with-directory-excursion build-directory
  363. (when tests?
  364. (invoke "pytest" "-vv" "pandas" "--skip-slow"
  365. "--skip-network"
  366. "-k"
  367. ;; These tets access the internet:
  368. ;; pandas/tests/io/xml/test_xml.py::test_wrong_url[lxml]
  369. ;; pandas/tests/io/xml/test_xml.py::test_wrong_url[etree]
  370. ;; TODO: the excel tests fail for unknown reasons
  371. (string-append "not test_wrong_url"
  372. " and not test_excelwriter_fspath"
  373. " and not test_ExcelWriter_dispatch"
  374. ;; TODO: Missing input
  375. " and not TestS3"
  376. " and not s3"))))))))))
  377. (propagated-inputs
  378. `(("python-jinja2" ,python-jinja2)
  379. ("python-numpy" ,python-numpy)
  380. ("python-openpyxl" ,python-openpyxl)
  381. ("python-pytz" ,python-pytz)
  382. ("python-dateutil" ,python-dateutil)
  383. ("python-xlrd" ,python-xlrd)))
  384. (inputs
  385. `(("which" ,which)
  386. ("xclip" ,xclip)
  387. ("xsel" ,xsel)))
  388. (native-inputs
  389. `(("python-cython" ,python-cython)
  390. ("python-beautifulsoup4" ,python-beautifulsoup4)
  391. ("python-lxml" ,python-lxml)
  392. ("python-html5lib" ,python-html5lib)
  393. ("python-nose" ,python-nose)
  394. ("python-pytest" ,python-pytest)
  395. ("python-pytest-mock" ,python-pytest-mock)
  396. ;; Needed to test clipboard support.
  397. ("xorg-server" ,xorg-server-for-tests)))
  398. (home-page "https://pandas.pydata.org")
  399. (synopsis "Data structures for data analysis, time series, and statistics")
  400. (description
  401. "Pandas is a Python package providing fast, flexible, and expressive data
  402. structures designed to make working with structured (tabular,
  403. multidimensional, potentially heterogeneous) and time series data both easy
  404. and intuitive. It aims to be the fundamental high-level building block for
  405. doing practical, real world data analysis in Python.")
  406. (properties `((python2-variant . ,(delay python2-pandas))))
  407. (license license:bsd-3)))
  408. (define-public python-pandas-0.25
  409. (package
  410. (inherit python-pandas)
  411. (version "0.25.3")
  412. (source (origin
  413. (method url-fetch)
  414. (uri (pypi-uri "pandas" version))
  415. (sha256
  416. (base32
  417. "191048m6kdc6yfvqs9w412lq60cfvigrsb57y0x116lwibgp9njj"))))
  418. (arguments
  419. (substitute-keyword-arguments (package-arguments python-pandas)
  420. ((#:phases phases)
  421. `(modify-phases ,phases
  422. (replace 'patch-which
  423. (lambda* (#:key inputs #:allow-other-keys)
  424. (let ((which (assoc-ref inputs "which")))
  425. (substitute* "pandas/io/clipboard/__init__.py"
  426. (("^CHECK_CMD = .*")
  427. (string-append "CHECK_CMD = \"" which "\"\n"))))
  428. #t))
  429. (delete 'prepare-x)))))))
  430. ;; Pandas 0.24.x are the last versions that support Python 2.
  431. (define-public python2-pandas
  432. (let ((pandas (package-with-python2
  433. (strip-python2-variant python-pandas-0.25))))
  434. (package
  435. (inherit pandas)
  436. (version "0.24.2")
  437. (source (origin
  438. (method url-fetch)
  439. (uri (pypi-uri "pandas" version))
  440. (sha256
  441. (base32
  442. "18imlm8xbhcbwy4wa957a1fkamrcb0z988z006jpfda3ki09z4ag"))
  443. (modules '((guix build utils)))
  444. (snippet
  445. '(begin
  446. ;; Adjust for renamed error message in Python 2.7.17. Taken
  447. ;; from <https://github.com/pandas-dev/pandas/pull/29294>.
  448. (substitute* "pandas/io/parsers.py"
  449. (("if 'NULL byte' in msg:")
  450. "if 'NULL byte' in msg or 'line contains NUL' in msg:"))))))
  451. (arguments
  452. `(#:modules ((guix build utils)
  453. (guix build python-build-system)
  454. (ice-9 ftw)
  455. (srfi srfi-26))
  456. #:python ,python-2
  457. #:phases
  458. (modify-phases %standard-phases
  459. (add-after 'unpack 'patch-which
  460. (lambda* (#:key inputs #:allow-other-keys)
  461. (let ((which (assoc-ref inputs "which")))
  462. (substitute* "pandas/io/clipboard/__init__.py"
  463. (("^CHECK_CMD = .*")
  464. (string-append "CHECK_CMD = \"" which "\"\n"))))))
  465. (replace 'check
  466. (lambda _
  467. (let ((build-directory
  468. (string-append
  469. (getcwd) "/build/"
  470. (car (scandir "build"
  471. (cut string-prefix? "lib." <>))))))
  472. ;; Disable the "strict data files" option which causes
  473. ;; the build to error out if required data files are
  474. ;; not available (as is the case with PyPI archives).
  475. (substitute* "setup.cfg"
  476. (("addopts = --strict-data-files") "addopts = "))
  477. (with-directory-excursion build-directory
  478. ;; Delete tests that require "moto" which is not yet
  479. ;; in Guix.
  480. (for-each delete-file
  481. '("pandas/tests/io/conftest.py"
  482. "pandas/tests/io/json/test_compression.py"
  483. "pandas/tests/io/parser/test_network.py"
  484. "pandas/tests/io/test_parquet.py"))
  485. (invoke "pytest" "-vv" "pandas" "--skip-slow"
  486. "--skip-network" "-k"
  487. ;; XXX: Due to the deleted tests above.
  488. "not test_read_s3_jsonl"))))))))
  489. (propagated-inputs
  490. `(("python-numpy" ,python2-numpy)
  491. ("python-openpyxl" ,python2-openpyxl)
  492. ("python-pytz" ,python2-pytz)
  493. ("python-dateutil" ,python2-dateutil)
  494. ("python-xlrd" ,python2-xlrd)))
  495. (inputs
  496. `(("which" ,which)))
  497. (native-inputs
  498. `(("python-cython" ,python2-cython)
  499. ("python-beautifulsoup4" ,python2-beautifulsoup4)
  500. ("python-lxml" ,python2-lxml)
  501. ("python-html5lib" ,python2-html5lib)
  502. ("python-nose" ,python2-nose)
  503. ("python-pytest" ,python2-pytest)
  504. ("python-pytest-mock" ,python2-pytest-mock))))))
  505. (define-public python-pyflow
  506. (package
  507. (name "python-pyflow")
  508. (version "1.1.20")
  509. (source (origin
  510. (method url-fetch)
  511. (uri (string-append
  512. "https://github.com/Illumina/pyflow/releases/download/v"
  513. version "/pyflow-" version ".tar.gz"))
  514. (sha256
  515. (base32
  516. "1bvfvviw58cndyn862qnv9nj3d9cd3a0dm4vc4sd9vwq8a6z1riv"))))
  517. (build-system python-build-system)
  518. (arguments
  519. `(#:tests? #f)) ; There is no test suite.
  520. (home-page "https://illumina.github.io/pyflow/")
  521. (synopsis "Tool to manage tasks in a task dependency graph")
  522. (description "This package is a Python module to manage tasks in the
  523. context of a task dependency graph. It has some similarities to make.")
  524. (license license:bsd-2)))
  525. (define-public python-bottleneck
  526. (package
  527. (name "python-bottleneck")
  528. (version "1.3.2")
  529. (source
  530. (origin
  531. (method url-fetch)
  532. (uri (pypi-uri "Bottleneck" version))
  533. (sha256
  534. (base32 "0wz5320jx3n4q2nsvwvc7cpi66b46qbals9v53m955rmcq5ry5r0"))))
  535. (build-system python-build-system)
  536. (arguments
  537. `(#:phases
  538. (modify-phases %standard-phases
  539. (replace 'check
  540. (lambda _
  541. (invoke "python" "setup.py" "pytest"))))))
  542. (native-inputs
  543. `(("python-hypothesis" ,python-hypothesis)
  544. ("python-pytest" ,python-pytest)
  545. ("python-pytest-runner" ,python-pytest-runner)))
  546. (propagated-inputs
  547. `(("python-numpy" ,python-numpy)))
  548. (home-page "https://github.com/pydata/bottleneck")
  549. (synopsis "Fast NumPy array functions written in C")
  550. (description
  551. "Bottleneck is a collection of fast, NaN-aware NumPy array functions
  552. written in C.")
  553. (license license:bsd-2)))
  554. (define-public python-baycomp
  555. (package
  556. (name "python-baycomp")
  557. (version "1.0.2")
  558. (source
  559. (origin
  560. (method url-fetch)
  561. (uri (pypi-uri "baycomp" version))
  562. (sha256
  563. (base32 "1c1354a7b3g8slychjgyjxqdm8z40z9kviyl9n4g9kfpdg0p4d64"))))
  564. (build-system python-build-system)
  565. (propagated-inputs
  566. `(("python-matplotlib" ,python-matplotlib)
  567. ("python-numpy" ,python-numpy)
  568. ("python-scipy" ,python-scipy)))
  569. (home-page "https://github.com/janezd/baycomp")
  570. (synopsis "Library for comparison of Bayesian classifiers")
  571. (description
  572. "Baycomp is a library for Bayesian comparison of classifiers. Functions
  573. in the library compare two classifiers on one or on multiple data sets. They
  574. compute three probabilities: the probability that the first classifier has
  575. higher scores than the second, the probability that differences are within the
  576. region of practical equivalence (rope), or that the second classifier has
  577. higher scores.")
  578. (license license:expat)))
  579. (define-public python-xarray
  580. (package
  581. (name "python-xarray")
  582. (version "0.15.1")
  583. (source (origin
  584. (method url-fetch)
  585. (uri (pypi-uri "xarray" version))
  586. (sha256
  587. (base32
  588. "1yx8j66b7rn10m2l6gmn8yr9cn38pi5cj0x0wwpy4hdnhy6i7qv4"))))
  589. (build-system python-build-system)
  590. (native-inputs
  591. `(("python-setuptools-scm" ,python-setuptools-scm)
  592. ("python-pytest" ,python-pytest)))
  593. (propagated-inputs
  594. `(("python-numpy" ,python-numpy)
  595. ("python-pandas" ,python-pandas)))
  596. (arguments
  597. `(#:phases
  598. (modify-phases %standard-phases
  599. (replace 'check
  600. (lambda _
  601. (invoke "pytest"))))))
  602. (home-page "https://github.com/pydata/xarray")
  603. (synopsis "N-D labeled arrays and datasets")
  604. (description "Xarray (formerly xray) makes working with labelled
  605. multi-dimensional arrays simple, efficient, and fun!
  606. Xarray introduces labels in the form of dimensions, coordinates and attributes
  607. on top of raw NumPy-like arrays, which allows for a more intuitive, more
  608. concise, and less error-prone developer experience. The package includes a
  609. large and growing library of domain-agnostic functions for advanced analytics
  610. and visualization with these data structures.")
  611. (license license:asl2.0)))
  612. (define-public python-msgpack-numpy
  613. (package
  614. (name "python-msgpack-numpy")
  615. (version "0.4.6.post0")
  616. (source
  617. (origin
  618. (method url-fetch)
  619. (uri (pypi-uri "msgpack-numpy" version))
  620. (sha256
  621. (base32
  622. "0syzy645mwcy7lfjwz6pc8f9p2vv1qk4limc8iina3l5nnf0rjyz"))))
  623. (build-system python-build-system)
  624. (propagated-inputs
  625. `(("python-msgpack" ,python-msgpack)
  626. ("python-numpy" ,python-numpy)))
  627. (home-page "https://github.com/lebedov/msgpack-numpy")
  628. (synopsis
  629. "Numpy data serialization using msgpack")
  630. (description
  631. "This package provides encoding and decoding routines that enable the
  632. serialization and deserialization of numerical and array data types provided
  633. by numpy using the highly efficient @code{msgpack} format. Serialization of
  634. Python's native complex data types is also supported.")
  635. (license license:bsd-3)))
  636. (define-public python-ruffus
  637. (package
  638. (name "python-ruffus")
  639. (version "2.8.4")
  640. (source
  641. (origin
  642. (method url-fetch)
  643. (uri (pypi-uri "ruffus" version))
  644. (sha256
  645. (base32
  646. "1ai673k1s94s8b6pyxai8mk17p6zvvyi87rl236fs6ls8mpdklvc"))))
  647. (build-system python-build-system)
  648. (arguments
  649. `(#:phases
  650. (modify-phases %standard-phases
  651. (delete 'check)
  652. (add-after 'install 'check
  653. (lambda* (#:key tests? inputs outputs #:allow-other-keys)
  654. (when tests?
  655. (add-installed-pythonpath inputs outputs)
  656. (with-directory-excursion "ruffus/test"
  657. (invoke "bash" "run_all_unit_tests3.cmd"))))))))
  658. (native-inputs
  659. `(("python-pytest" ,python-pytest)))
  660. (home-page "http://www.ruffus.org.uk")
  661. (synopsis "Light-weight computational pipeline management")
  662. (description
  663. "Ruffus is designed to allow scientific and other analyses to be
  664. automated with the minimum of fuss and the least effort.")
  665. (license license:expat)))
  666. (define-public python-statannot
  667. (package
  668. (name "python-statannot")
  669. (version "0.2.3")
  670. (source
  671. (origin
  672. (method url-fetch)
  673. (uri (pypi-uri "statannot" version))
  674. (sha256
  675. (base32
  676. "1f8c2sylzr7lpjbyqxsqlp9xi8rj3d8c9hfh98x4jbb83zxc4026"))))
  677. (build-system python-build-system)
  678. (propagated-inputs
  679. `(("python-numpy" ,python-numpy)
  680. ("python-seaborn" ,python-seaborn)
  681. ("python-matplotlib" ,python-matplotlib)
  682. ("python-pandas" ,python-pandas)
  683. ("python-scipy" ,python-scipy)))
  684. (home-page
  685. "https://github.com/webermarcolivier/statannot")
  686. (synopsis "Add annotations to existing plots generated by seaborn")
  687. (description
  688. "This is a Python package to compute statistical test and add statistical
  689. annotations on an existing boxplots and barplots generated by seaborn.")
  690. (license license:expat)))
  691. (define-public python-upsetplot
  692. (package
  693. (name "python-upsetplot")
  694. (version "0.4.1")
  695. (source
  696. (origin
  697. (method url-fetch)
  698. (uri (pypi-uri "UpSetPlot" version))
  699. (sha256
  700. (base32
  701. "0kwljcmsvrxm33y3ssham2bwv4a5m31mv96y9h18va0cv7s3mqn1"))))
  702. (build-system python-build-system)
  703. (arguments
  704. `(#:phases
  705. (modify-phases %standard-phases
  706. (add-after 'unpack 'fix-versioning
  707. (lambda _
  708. (substitute* "setup.py"
  709. (("pytest-cov<2.6") "pytest-cov"))))
  710. (replace 'check
  711. (lambda* (#:key inputs outputs #:allow-other-keys)
  712. (add-installed-pythonpath inputs outputs)
  713. (invoke "pytest" "-v" "--doctest-modules"))))))
  714. (propagated-inputs
  715. `(("python-matplotlib" ,python-matplotlib)
  716. ("python-pandas" ,python-pandas)))
  717. (native-inputs
  718. `(("python-pytest-runner" ,python-pytest-runner)
  719. ("python-pytest-cov" ,python-pytest-cov)))
  720. (home-page "https://upsetplot.readthedocs.io")
  721. (synopsis "Draw UpSet plots with Pandas and Matplotlib")
  722. (description
  723. "This is a Python implementation of UpSet plots by Lex et al.
  724. UpSet plots are used to visualize set overlaps; like Venn diagrams but more
  725. readable.")
  726. (license license:bsd-3)))
  727. (define-public python-vedo
  728. (package
  729. (name "python-vedo")
  730. (version "2021.0.3")
  731. (source
  732. (origin
  733. (method git-fetch)
  734. (uri (git-reference
  735. (url "https://github.com/marcomusy/vedo")
  736. (commit version)))
  737. (file-name (git-file-name name version))
  738. (sha256
  739. (base32
  740. "18i3ajh5jzhpc86di15lwh4jv97jhm627ii877sa4yhv6abzjfpn"))))
  741. (build-system python-build-system)
  742. (arguments
  743. `(#:phases
  744. (modify-phases %standard-phases
  745. (add-after 'build 'mpi-setup
  746. ,%openmpi-setup)
  747. (replace 'check
  748. (lambda* (#:key inputs outputs #:allow-other-keys)
  749. (setenv "HOME" (getcwd))
  750. (add-installed-pythonpath inputs outputs)
  751. (with-directory-excursion "tests"
  752. (for-each (lambda (dir)
  753. (with-directory-excursion dir
  754. (invoke "./run_all.sh")))
  755. '("common" "dolfin")))
  756. #t)))))
  757. (inputs ; for the check phase
  758. `(("dolfin" ,fenics)
  759. ("pkgconfig" ,python-pkgconfig)
  760. ("matplotlib" ,python-matplotlib)))
  761. (native-inputs ; for python-pkgconfig
  762. `(("pkg-config" ,pkg-config)))
  763. (propagated-inputs
  764. `(("numpy" ,python-numpy)
  765. ("vtk" ,vtk)))
  766. (home-page "https://github.com/marcomusy/vedo")
  767. (synopsis
  768. "Analysis and visualization of 3D objects and point clouds")
  769. (description
  770. "@code{vedo} is a fast and lightweight python module for
  771. scientific analysis and visualization. The package provides a wide
  772. range of functionalities for working with three-dimensional meshes and
  773. point clouds. It can also be used to generate high quality
  774. two-dimensional renderings such as scatter plots and histograms.
  775. @code{vedo} is based on @code{vtk} and @code{numpy}, with no other
  776. dependencies.")
  777. ;; vedo is released under the Expat license. Included fonts are
  778. ;; covered by the OFL license and textures by the CC0 license.
  779. ;; The earth images are in the public domain.
  780. (license (list license:expat
  781. license:silofl1.1
  782. license:cc0
  783. license:public-domain))))
  784. (define-public python-pandas-flavor
  785. (package
  786. (name "python-pandas-flavor")
  787. (version "0.2.0")
  788. (source
  789. (origin
  790. (method url-fetch)
  791. (uri (pypi-uri "pandas_flavor" version))
  792. (sha256
  793. (base32
  794. "12g4av8gpl6l83yza3h97j3f2jblqv69frlidrvdq8ny2rc6awbq"))))
  795. (build-system python-build-system)
  796. (propagated-inputs
  797. `(("python-pandas" ,python-pandas)
  798. ("python-xarray" ,python-xarray)))
  799. (home-page "https://github.com/Zsailer/pandas_flavor")
  800. (synopsis "Write your own flavor of Pandas")
  801. (description "Pandas 0.23 added a simple API for registering accessors
  802. with Pandas objects. Pandas-flavor extends Pandas' extension API by
  803. @itemize
  804. @item adding support for registering methods as well
  805. @item making each of these functions backwards compatible with older versions
  806. of Pandas
  807. @end itemize")
  808. (license license:expat)))
  809. (define-public python-pingouin
  810. (package
  811. (name "python-pingouin")
  812. (version "0.3.12")
  813. (source
  814. ;; The PyPI tarball does not contain the tests.
  815. (origin
  816. (method git-fetch)
  817. (uri (git-reference
  818. (url "https://github.com/raphaelvallat/pingouin")
  819. (commit (string-append "v" version))))
  820. (file-name (git-file-name name version))
  821. (sha256
  822. (base32
  823. "1ap29x54kdr19vi8qxj9g6cz2r1q4f0z7dcf6g77zwav7hf7r61a"))))
  824. (build-system python-build-system)
  825. (arguments
  826. `(#:phases
  827. (modify-phases %standard-phases
  828. ;; On loading, Pingouin uses the outdated package to check if a newer
  829. ;; version is available on PyPI. This check adds an extra dependency
  830. ;; and is irrelevant to Guix users. So, disable it.
  831. (add-after 'unpack 'remove-outdated-check
  832. (lambda _
  833. (substitute* "setup.py"
  834. (("'outdated',") ""))
  835. (substitute* "pingouin/__init__.py"
  836. (("^from outdated[^\n]*") "")
  837. (("^warn_if_outdated[^\n]*") ""))))
  838. (replace 'check
  839. (lambda* (#:key tests? #:allow-other-keys)
  840. (when tests?
  841. (invoke "pytest")))))))
  842. (native-inputs
  843. `(("python-pytest" ,python-pytest)
  844. ("python-pytest-cov" ,python-pytest-cov)))
  845. (propagated-inputs
  846. `(("python-matplotlib" ,python-matplotlib)
  847. ("python-mpmath" ,python-mpmath)
  848. ("python-numpy" ,python-numpy)
  849. ("python-pandas" ,python-pandas)
  850. ("python-pandas-flavor" ,python-pandas-flavor)
  851. ("python-scikit-learn" ,python-scikit-learn)
  852. ("python-scipy" ,python-scipy)
  853. ("python-seaborn" ,python-seaborn)
  854. ("python-statsmodels" ,python-statsmodels)
  855. ("python-tabulate" ,python-tabulate)))
  856. (home-page "https://pingouin-stats.org/")
  857. (synopsis "Statistical package for Python")
  858. (description "Pingouin is a statistical package written in Python 3 and
  859. based mostly on Pandas and NumPy. Its features include
  860. @itemize
  861. @item ANOVAs: N-ways, repeated measures, mixed, ancova
  862. @item Pairwise post-hocs tests (parametric and non-parametric) and pairwise
  863. correlations
  864. @item Robust, partial, distance and repeated measures correlations
  865. @item Linear/logistic regression and mediation analysis
  866. @item Bayes Factors
  867. @item Multivariate tests
  868. @item Reliability and consistency
  869. @item Effect sizes and power analysis
  870. @item Parametric/bootstrapped confidence intervals around an effect size or a
  871. correlation coefficient
  872. @item Circular statistics
  873. @item Chi-squared tests
  874. @item Plotting: Bland-Altman plot, Q-Q plot, paired plot, robust correlation,
  875. and more
  876. @end itemize")
  877. (license license:gpl3)))
  878. (define-public python-distributed
  879. (package
  880. (name "python-distributed")
  881. (version "2021.09.1")
  882. (source
  883. (origin
  884. ;; The test files are not included in the archive on pypi
  885. (method git-fetch)
  886. (uri (git-reference
  887. (url "https://github.com/dask/distributed")
  888. (commit version)))
  889. (file-name (git-file-name name version))
  890. (sha256
  891. (base32
  892. "05djzza3f72nw1i1c9qyamgaf93pbf6jxx0migpp1wvvfl0v2j9z"))))
  893. (build-system python-build-system)
  894. (arguments
  895. '(#:phases
  896. (modify-phases %standard-phases
  897. (add-after 'unpack 'fix-references
  898. (lambda* (#:key outputs #:allow-other-keys)
  899. (substitute* '("distributed/comm/tests/test_ucx_config.py"
  900. "distributed/tests/test_client.py"
  901. "distributed/tests/test_queues.py"
  902. "distributed/tests/test_variable.py"
  903. "distributed/cli/tests/test_tls_cli.py"
  904. "distributed/cli/tests/test_dask_spec.py"
  905. "distributed/cli/tests/test_dask_worker.py"
  906. "distributed/cli/tests/test_dask_scheduler.py")
  907. (("\"dask-scheduler\"")
  908. (format #false "\"~a/bin/dask-scheduler\""
  909. (assoc-ref outputs "out")))
  910. (("\"dask-worker\"")
  911. (format #false "\"~a/bin/dask-worker\""
  912. (assoc-ref outputs "out"))))))
  913. (replace 'check
  914. (lambda* (#:key tests? #:allow-other-keys)
  915. (when tests?
  916. (setenv "DISABLE_IPV6" "1")
  917. (invoke "pytest" "-vv" "distributed"
  918. "-m" "not slow and not gpu and not ipython and not avoid_ci"
  919. "-k"
  920. ;; TODO: These tests fail for unknown reasons:
  921. (string-append
  922. ;; TimeoutExpired
  923. "not test_text"
  924. ;; AssertionError
  925. " and not test_version_option"
  926. ;; "The 'distributed' distribution was not found"
  927. " and not test_register_backend_entrypoint"
  928. ;; "AttributeError: module 'distributed.dashboard' has no attribute 'scheduler'"
  929. " and not test_get_client_functions_spawn_clusters"))))))))
  930. (propagated-inputs
  931. `(("python-click" ,python-click)
  932. ("python-cloudpickle" ,python-cloudpickle)
  933. ("python-cryptography" ,python-cryptography)
  934. ("python-dask" ,python-dask)
  935. ("python-msgpack" ,python-msgpack)
  936. ("python-psutil" ,python-psutil)
  937. ("python-pyyaml" ,python-pyyaml)
  938. ("python-setuptools" ,python-setuptools)
  939. ("python-sortedcontainers" ,python-sortedcontainers)
  940. ("python-tblib" ,python-tblib)
  941. ("python-toolz" ,python-toolz)
  942. ("python-tornado" ,python-tornado-6)
  943. ("python-zict" ,python-zict)))
  944. (native-inputs
  945. `(("python-pytest" ,python-pytest)))
  946. (home-page "https://distributed.dask.org")
  947. (synopsis "Distributed scheduler for Dask")
  948. (description "Dask.distributed is a lightweight library for distributed
  949. computing in Python. It extends both the @code{concurrent.futures} and
  950. @code{dask} APIs to moderate sized clusters.")
  951. (license license:bsd-3)))
  952. (define-public python-modin
  953. (package
  954. (name "python-modin")
  955. (version "0.10.1")
  956. (source
  957. (origin
  958. ;; The archive on pypi does not include all required files.
  959. (method git-fetch)
  960. (uri (git-reference
  961. (url "https://github.com/modin-project/modin")
  962. (commit version)))
  963. (file-name (git-file-name name version))
  964. (sha256
  965. (base32
  966. "128ghfb9ncmnn8km409xjcdppvn9nr9jqw8rkvsfavh7wnwlk509"))))
  967. (build-system python-build-system)
  968. (arguments
  969. `(#:phases
  970. (modify-phases %standard-phases
  971. (add-after 'unpack 'make-files-writable
  972. (lambda _
  973. (for-each make-file-writable (find-files "."))))
  974. (replace 'check
  975. (lambda* (#:key tests? #:allow-other-keys)
  976. (when tests?
  977. (setenv "MODIN_ENGINE" "dask")
  978. (invoke "python" "-m" "pytest"
  979. "modin/pandas/test/test_concat.py")
  980. (setenv "MODIN_ENGINE" "python")
  981. (invoke "python" "-m" "pytest"
  982. "modin/pandas/test/test_concat.py")))))))
  983. (propagated-inputs
  984. `(("python-cloudpickle" ,python-cloudpickle)
  985. ("python-dask" ,python-dask)
  986. ("python-distributed" ,python-distributed)
  987. ("python-numpy" ,python-numpy)
  988. ("python-packaging" ,python-packaging)
  989. ("python-pandas" ,python-pandas)))
  990. (native-inputs
  991. `(("python-coverage" ,python-coverage)
  992. ("python-jinja2" ,python-jinja2)
  993. ("python-lxml" ,python-lxml)
  994. ("python-matplotlib" ,python-matplotlib)
  995. ("python-msgpack" ,python-msgpack)
  996. ("python-openpyxl" ,python-openpyxl)
  997. ("python-psutil" ,python-psutil)
  998. ("python-pyarrow" ,python-pyarrow)
  999. ("python-pytest" ,python-pytest)
  1000. ("python-pytest-benchmark" ,python-pytest-benchmark)
  1001. ("python-pytest-cov" ,python-pytest-cov)
  1002. ("python-pytest-xdist" ,python-pytest-xdist)
  1003. ("python-scipy" ,python-scipy)
  1004. ("python-sqlalchemy" ,python-sqlalchemy)
  1005. ("python-tables" ,python-tables)
  1006. ("python-tqdm" ,python-tqdm)
  1007. ("python-xarray" ,python-xarray)
  1008. ("python-xlrd" ,python-xlrd)))
  1009. (home-page "https://github.com/modin-project/modin")
  1010. (synopsis "Make your pandas code run faster")
  1011. (description
  1012. "Modin uses Ray or Dask to provide an effortless way to speed up your
  1013. pandas notebooks, scripts, and libraries. Unlike other distributed DataFrame
  1014. libraries, Modin provides seamless integration and compatibility with existing
  1015. pandas code.")
  1016. (license license:asl2.0)))