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

paraview: include numpy in python environment #37595

Merged
merged 1 commit into from Apr 14, 2018

Conversation

SFrijters
Copy link
Member

Motivation for this change

The Python filter functionality in Paraview requires numpy, which is currently not included.
This PR aims to add numpy, based on the discussion in #37118 .

@dguibert @viric could you please review?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

"-DPARAVIEW_ENABLE_EMBEDDED_DOCUMENTATION=OFF"
];
# numpy is needed for the Python filters
pythonWithNumpy = python.withPackages (ps: with ps; [ numpy ]);
Copy link
Member

Choose a reason for hiding this comment

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

The name pythonEnv is used more commonly.

Note though, that because in the wrapper we need to set pythonsitePackages, there is actually no need anymore to create such an env.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I probably misunderstand something then: I thought we need pythonEnv both to add numpy as a dependency so it's available anywhere at all, and then needed to set the PYTHONPATH so that paraview & friends look into the correct side-packages directory to actually find it.

Copy link
Member

Choose a reason for hiding this comment

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

During build time numpy can be found by simply adding it to buildInputs`. For runtime, simply adding the specific site-packages to PYTHONPATH is sufficient as paraview already knows about CPython site-packages.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I think I understand and I'll try to fix up my commit a bit more.

# so we need to put the correct sitePackages (with numpy) back on the path
postInstall = ''
wrapProgram $out/bin/paraview \
--prefix PYTHONPATH ":" "${pythonWithNumpy}/${pythonWithNumpy.sitePackages}"
Copy link
Member

Choose a reason for hiding this comment

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

We prefer to use --set instead so that one cannot break the wrapper.

@SFrijters SFrijters force-pushed the paraview-numpy branch 2 times, most recently from 55027d5 to acd70a7 Compare March 22, 2018 10:41
@SFrijters
Copy link
Member Author

@FRidh Is this more like what you had in mind?

@SFrijters
Copy link
Member Author

Is there anything else I can do to move this forward?

];
cmakeFlags = [
"-DPARAVIEW_ENABLE_PYTHON=ON"
"-DPYTHON_EXECUTABLE=${python.interpreter}"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that's needed

stdenv, fetchFromGitHub, cmake
,qtbase, qttools, python, libGLU_combined
stdenv, fetchFromGitHub, cmake, makeWrapper
,qtbase, qttools, python, pythonPackages, libGLU_combined
Copy link
Member

Choose a reason for hiding this comment

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

drop python

Copy link
Member

Choose a reason for hiding this comment

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

Actually, you should probably keep python and drop pythonPackages. You can use python.pkgs instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've applied your comments - is anything else needed?

The Python filter functionality in Paraview requires numpy, which is currently not included.
Changes are based on the discussion in issue NixOS#37118.
Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

LGTM.
@FRidh I'll let you merge this one.

@dotlambda dotlambda merged commit 054f4f9 into NixOS:master Apr 14, 2018
@SFrijters SFrijters deleted the paraview-numpy branch September 30, 2020 13:23
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