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

pythonPackages.qutip: init at 4.5.2 #103412

Closed
wants to merge 3 commits into from
Closed

pythonPackages.qutip: init at 4.5.2 #103412

wants to merge 3 commits into from

Conversation

mcncm
Copy link

@mcncm mcncm commented Nov 11, 2020

  • Does not use OpenMP by default
  • May be overly conservative in disabling python versions older than 3.5
  • Note that build time is a bit long, in part due to tests. It might be
    preferable to disable these in the future.
Motivation for this change

This is a fairly popular quantum simulation package that it would be nice to have easy access to.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • [ ] Tested execution of all binary files (usually in ./result/bin/) (N/A)
  • Built the package with nix-shell -p 'python$X.withPackages (ps: [ ps.qutip ])', for X={36,37,38}, and imported the module in a repl of the respective Python version.
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

* Does not use OpenMP by default
* May be overly conservative in disabling python versions older than 3.5
* Note that build time is a bit long, in part due to tests. It might be
  preferable to disable these in the future.
* Overridden `buildPhase` to build with openmp support
* As this does not appear to work with the Pypi version, which lacks
  certain .cpp source files, `fetchPypi` has been replaced with
  `fetchGitHub`.
* The correct tests have been added, but disabled, as they add a
  considerable amount of time after an already quite long build phase.
@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 103412 run on x86_64-linux 1

2 packages built:
  • python37Packages.qutip
  • python38Packages.qutip

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 103412 run on x86_64-darwin 1

2 packages failed to build:
  • python37Packages.qutip
  • python38Packages.qutip

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow CONTRIBUTING.md and manual#submitting-changes-making-patches and squash the fix-up commits.

git rebase -i is a powerful command which achieves this, I created a small video demonstrating it's use here. A more indepth text tutorial can be found here

${python.interpreter} setup.py --with-openmp bdist_wheel
'';

doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please leave a comment saying why tests werent ran

Comment on lines +46 to +48
buildPhase = ''
${python.interpreter} setup.py --with-openmp bdist_wheel
'';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buildPhase = ''
${python.interpreter} setup.py --with-openmp bdist_wheel
'';
setupPyGlobalFlags = "--with-openmp";

Comment on lines +1 to +14
{ stdenv
, python
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, setuptoolsBuildHook
, gcc
, hypothesis
, numpy
, scipy
, matplotlib
, cython
, pytest
}:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ stdenv
, python
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, setuptoolsBuildHook
, gcc
, hypothesis
, numpy
, scipy
, matplotlib
, cython
, pytest
}:
{ stdenv
, python
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, setuptoolsBuildHook
, hypothesis
, numpy
, scipy
, matplotlib
, cython
, openmp
, sysctl
}:

--replace "numpy>=1.12" "numpy" \
--replace "scipy>=1.0" "scipy"
'';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nativeBuildInputs = [ setuptoolsBuildHook ];
buildInputs = stdenv.lib.optionals stdenv.isDarwin [ openmp ];

Comment on lines +41 to +42

nativeBuildInputs = [ numpy scipy cython pytest setuptoolsBuildHook ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nativeBuildInputs = [ numpy scipy cython pytest setuptoolsBuildHook ];

Comment on lines +49 to +50

doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
doCheck = false;
doCheck = false;

Tests fail one darwin and linux.


doCheck = false;

checkInputs = [ hypothesis ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
checkInputs = [ hypothesis ];
checkInputs = [ hypothesis sysctl ];

@@ -6116,6 +6116,8 @@ in {

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

qutip = callPackage ../development/python-modules/qutip { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
qutip = callPackage ../development/python-modules/qutip { };
qutip = callPackage ../development/python-modules/qutip {
inherit (pkgs.llvmPackages) openmp;
};

@jonringer
Copy link
Contributor

to allow tests:

diff --git a/pkgs/development/python-modules/qutip/default.nix b/pkgs/development/python-modules/qutip/default.nix
index 14a13683272..b8a104d8cc7 100644
--- a/pkgs/development/python-modules/qutip/default.nix
+++ b/pkgs/development/python-modules/qutip/default.nix
@@ -43,17 +43,14 @@ buildPythonPackage rec {

   enableParallelBuilding = true;

-  buildPhase = ''
-  ${python.interpreter} setup.py --with-openmp bdist_wheel
-  '';
-
-  doCheck = false;
+  setupPyBuildFlags = "--with-openmp";

   checkInputs = [ hypothesis ];

   checkPhase = ''
     runHook preCheck
     pushd dist
+    HOME=$TMPDIR
     ${python.interpreter} -c 'import qutip.testing as qt; qt.run()'
     popd
     runHook postCheck

@SuperSandro2000
Copy link
Member

@mcncm ping

@stale
Copy link

stale bot commented Jul 11, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 11, 2021
@FabianGD
Copy link
Contributor

FabianGD commented Nov 2, 2021

Closing this, as a newer version of the package is provided by #144102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants