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
Conversation
"-DPARAVIEW_ENABLE_EMBEDDED_DOCUMENTATION=OFF" | ||
]; | ||
# numpy is needed for the Python filters | ||
pythonWithNumpy = python.withPackages (ps: with ps; [ numpy ]); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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.
55027d5
to
acd70a7
Compare
@FRidh Is this more like what you had in mind? |
Is there anything else I can do to move this forward? |
]; | ||
cmakeFlags = [ | ||
"-DPARAVIEW_ENABLE_PYTHON=ON" | ||
"-DPYTHON_EXECUTABLE=${python.interpreter}" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop python
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
acd70a7
to
dff672e
Compare
There was a problem hiding this 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.
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
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)