14 , cudaSupport ? false, cudaPackages ? {}
15 , cudnnSupport ? false
19 inherit (cudaPackages) cudatoolkit cudnn;
22 assert cudnnSupport -> cudaSupport;
25 wrapped = command: buildTop: buildInputs:
26 runCommandCC "${command}-wrapped" { inherit buildInputs; } ''
27 type -P '${command}' || { echo '${command}: not found'; exit 1; }
30 $(declare -xp | sed -e '/^[^=]\+="\('"''${NIX_STORE//\//\\/}"'\|[^\/]\)/!d')
31 declare -x NIX_BUILD_TOP="${buildTop}"
32 $(type -P '${command}') "\$@"
37 # Theano spews warnings and disabled flags if the compiler isn't named g++
39 if stdenv.cc.isGNU then "g++" else
40 if stdenv.cc.isClang then "clang++" else
41 throw "Unknown C++ compiler";
42 cxx_compiler = wrapped cxx_compiler_name "\\$HOME/.theano"
43 ( lib.optional cudaSupport libgpuarray_
44 ++ lib.optional cudnnSupport cudnn );
46 # We need to be careful with overriding Python packages within the package set
47 # as this can lead to collisions!
48 libgpuarray_ = libgpuarray.override { inherit cudaSupport cudaPackages; };
50 in buildPythonPackage rec {
54 disabled = isPyPy || pythonOlder "2.6" || (isPy3k && pythonOlder "3.3");
57 inherit pname version;
58 sha256 = "129f43ww2a6badfdr6b88kzjzz2b0wk0dwkvwb55z6dsagfkk53f";
62 substituteInPlace theano/configdefaults.py \
63 --replace 'StrParam(param, is_valid=warn_cxx)' 'StrParam('\'''${cxx_compiler}'\''', is_valid=warn_cxx)' \
64 --replace 'rc == 0 and config.cxx != ""' 'config.cxx != ""'
65 '' + lib.optionalString cudaSupport ''
66 substituteInPlace theano/configdefaults.py \
67 --replace 'StrParam(get_cuda_root)' 'StrParam('\'''${cudatoolkit}'\''')'
68 '' + lib.optionalString cudnnSupport ''
69 substituteInPlace theano/configdefaults.py \
70 --replace 'StrParam(default_dnn_base_path)' 'StrParam('\'''${cudnn}'\''')'
73 # needs to be postFixup so it runs before pythonImportsCheck even when
74 # doCheck = false (meaning preCheck would be disabled)
77 export HOME=$(pwd)/check-phase
80 # takes far too long, also throws "TypeError: sort() missing 1 required positional argument: 'a'"
81 # when run from the installer, and testing with Python 3.5 hits github.com/Theano/Theano/issues/4276,
82 # the fix for which hasn't been merged yet.
84 # keep Nose around since running the tests by hand is possible from Python or bash
85 checkInputs = [ nose ];
86 # setuptools needed for cuda support
87 propagatedBuildInputs = [
96 pythonImportsCheck = [ "theano" ];
99 homepage = "https://github.com/Theano/Theano";
100 description = "A Python library for large-scale array computation";
101 license = licenses.bsd3;