Python package "is not a supported wheel on this platform."

I’ve been trying to package a project of mine with nix on Mac OS. This project uses numpy distutils rather than setuptools since it has some Fortran code embedded in it. Here is the nix I am using (I’m on the release-20.09 channel):

with import <nixpkgs> {};
with pkgs.python3Packages;

buildPythonPackage rec {
  name = "mypackage";
  src = ./.;
  nativeBuildInputs = [ gfortran stdenv ];
  propagatedBuildInputs = [ pytest numpy  dask click appdirs requests h5py
  xarray scikitimage scipy  toolz pooch intake zarr ];
}

nix-build successully builds the wheel, compiling the Fortran code, but then fails to install the wheel in the nix-store with this error message:

Finished executing setuptoolsBuildPhase
installing
Executing pipInstallPhase
/private/tmp/nix-build-python3.8-mypackage.drv-0/vcm/dist /private/tmp/nix-build-python3.8-mypackage.drv-0/vcm
ERROR: vcm-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl is not a supported wheel on this platform.

I have verified that this wheel can be installed a typical virtualenv so I am not sure what the problem is or how to debug nix’s sandboxed builds. I would appreciate some pointers. Thanks.

I think the issue here is that python3Packages is pointing to python38, but your wheel is for python37. You could use python37Packages.

Thanks. Using python37Packages fixes the issue. But, how do I make sure the wheel is built with python38?

It’s not really clear to me where this wheel is coming from. Is it shipped as part of the code?

I fixed this by using pkgs.python38Packages.buildPythonPackage. I think using a callPackage approach will clean this up. Thanks.

1 Like