My OS is Mac OS X 10.13.6. If I run your python commands it shows this message:
This program needs access to the screen. Please run with a Framework
build of python, and only when you are logged in on the main display
of your Mac.
It’s because it needs a python compile with Framework enabled. I’m trying with this shell.nix
where I’m overlaying python to enable framework:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
my_pkgs = import sources.nixpkgs {
overlays = [
(
final: prev: {
python38 = prev.python38.overrideAttrs (oldAttrs: rec{
configureFlags = [
"--enable-framework=${placeholder "out"}/Framework/"
"--with-threads"
"--without-ensurepip"
"--with-system-expat"
"--with-system-ffi"
"--with-openssl=${prev.openssl.dev}"
"--prefix=${placeholder "out"}"
"--datarootdir=${placeholder "out"}/share"
"--datadir=${placeholder "out"}/share"
"--libdir=${placeholder "out"}/lib"
"--includedir=${placeholder "out"}/include"
#"--bindir=${placeholder "out"}/bin"
];
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [
prev.darwin.DarwinTools
];
buildInputs = oldAttrs.buildInputs ++ [
pkgs.darwin.apple_sdk.frameworks.Foundation
pkgs.darwin.apple_sdk.frameworks.Cocoa
];
installPhase = ''
make install PYTHONAPPSDIR=${placeholder "out"}
ln -s ${placeholder "out"}/Framework/Python.framework/Versions/3.8/lib/*.dylib ${placeholder "out"}/lib/
ln -s ${placeholder "out"}/Framework/Python.framework/Versions/3.8/lib/python3.8/* ${placeholder "out"}/lib/python3.8/
'';
});
}
)
];
};
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.1.1";
}) {
pkgs = my_pkgs;
python = "python38";
};
customPython = mach-nix.mkPython {
requirements = ''
pillow
wxpython==4.1.0
numpy
scipy
scikit-image
scikit-learn
imageio
h5py==2.10.0
pyserial
psutil
nibabel
configparser
PyPubsub
vtk
gdcm
plaidml
plaidml-keras
cython
ipython
Theano
'';
_.enum34.phases = "installPhase";
_.enum34.installPhase = "mkdir $out";
_.plaidml.pipInstallFlags = "--no-deps";
_.plaidml-keras.pipInstallFlags = "--no-deps";
_.gdcm.cmakeFlags = [
"-DGDCM_BUILD_APPLICATIONS=OFF"
"-DGDCM_BUILD_SHARED_LIBS=ON"
"-DGDCM_USE_VTK=OFF"
"-DGDCM_WRAP_PYTHON:BOOL=ON"
"-DGDCM_INSTALL_PYTHONMODULE_DIR=${placeholder "out"}/lib/python3.8/site-packages/"
];
};
in pkgs.mkShell {
name = "invesalius";
buildInputs = with pkgs; [
customPython
];
}
It’s compiling python but it’s not compiling libxml2, maybe I need to change more things yet.