Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20.09] pythonPackages.pymc3: fix build, init pythonPackages.fastprogress at 1.0.0 #100955

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion pkgs/development/python-modules/Theano/default.nix
Expand Up @@ -10,6 +10,7 @@
, scipy
, six
, libgpuarray
, libredirect
, cudaSupport ? false, cudatoolkit
, cudnnSupport ? false, cudnn
, nvidia_x11
Expand Down Expand Up @@ -68,9 +69,22 @@ in buildPythonPackage rec {
--replace 'StrParam(default_dnn_base_path)' 'StrParam('\'''${cudnn}'\''')'
'';

preCheck = ''
# Needs to be postFixup so it runs before pythonImportsCheck even when
# doCheck = false (meaning preCheck would be disabled).
# This branch is missing #97597 (and its predecessor #93560), meaning only
# "/tmp" is exempt from NIX_ENFORCE_PURITY's objections when theano is
# imported from within a nix build environment. Therefore use libredirect
# to convince the wrapper we are actually accessing "/tmp".
postFixup = ''
mkdir -p check-phase
export HOME=$(pwd)/check-phase

export NIX_REDIRECTS=/tmp=$TMPDIR
export LD_PRELOAD=${libredirect}/lib/libredirect.so
export TEMP=/tmp
export TEMPDIR=/tmp
export TMP=/tmp
export TMPDIR=/tmp
'';
doCheck = false;
# takes far too long, also throws "TypeError: sort() missing 1 required positional argument: 'a'"
Expand All @@ -81,6 +95,8 @@ in buildPythonPackage rec {
checkInputs = [ nose ];
propagatedBuildInputs = [ numpy numpy.blas scipy six libgpuarray_ ];

pythonImportsCheck = [ "theano" ];

meta = with stdenv.lib; {
homepage = "http://deeplearning.net/software/theano/";
description = "A Python library for large-scale array computation";
Expand Down
32 changes: 32 additions & 0 deletions pkgs/development/python-modules/fastprogress/default.nix
@@ -0,0 +1,32 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, numpy
, pytest
, pythonOlder
}:

buildPythonPackage rec {
pname = "fastprogress";
version = "1.0.0";
disabled = pythonOlder "3.6";

src = fetchPypi {
inherit pname version;
sha256 = "1zhv37q6jkqd1pfhlkd4yzrc3dg83vyksgzf32mjlhd5sb0qmql9";
};

propagatedBuildInputs = [ numpy ];

# no real tests
doCheck = false;
pythonImportsCheck = [ "fastprogress" ];

meta = with stdenv.lib; {
homepage = "https://github.com/fastai/fastprogress";
description = "Simple and flexible progress bar for Jupyter Notebook and console";
license = licenses.asl20;
maintainers = with maintainers; [ ris ];
};

}
22 changes: 20 additions & 2 deletions pkgs/development/python-modules/pymc3/default.nix
Expand Up @@ -14,6 +14,9 @@
, pytest
, nose
, parameterized
, fastprogress
, typing-extensions
, libredirect
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -41,6 +44,8 @@ buildPythonPackage rec {
h5py
arviz
packaging
fastprogress
typing-extensions
];

checkInputs = [
Expand All @@ -52,11 +57,24 @@ buildPythonPackage rec {
# The test suite is computationally intensive and test failures are not
# indicative for package usability hence tests are disabled by default.
doCheck = false;
pythonImportsCheck = [ "pymc3" ];

# For some reason tests are run as a part of the *install* phase if enabled.
# Theano writes compiled code to ~/.theano hence we set $HOME.
preInstall = "export HOME=$(mktemp -d)";
postInstall = "rm -rf $HOME";
# This branch is missing #97597 (and its predecessor #93560), meaning only
# "/tmp" is exempt from NIX_ENFORCE_PURITY's objections when theano is
# imported from within a nix build environment. Therefore use libredirect
# to convince the wrapper we are actually accessing "/tmp".
preInstall = ''
export HOME=$(mktemp -d)

export NIX_REDIRECTS=/tmp=$TMPDIR
export LD_PRELOAD=${libredirect}/lib/libredirect.so
export TEMP=/tmp
export TEMPDIR=/tmp
export TMP=/tmp
export TMPDIR=/tmp
'';

meta = {
description = "Bayesian estimation, particularly using Markov chain Monte Carlo (MCMC)";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Expand Up @@ -1972,6 +1972,8 @@ in {

fastpbkdf2 = callPackage ../development/python-modules/fastpbkdf2 { };

fastprogress = callPackage ../development/python-modules/fastprogress { };

fastrlock = callPackage ../development/python-modules/fastrlock { };

fasttext = callPackage ../development/python-modules/fasttext { };
Expand Down