python-science.scm 38 KB

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