mach-nix
mach-nix copied to clipboard
Unable to mkPython python38 with Ansible - infinite recursion
trafficstars
mach-nix is my preferred method for Python environment management in nix. I'd value any assistance resolving this infinite recursion error.
Given
System:
- macOS 12.2.1 (21D62)
- Apple M1 Pro
I use niv to pin nix dependencies:
- nixpkgs release-21.11 d2caa9377539e3b5ff1272ac3aa2d15f3081069f
- mach-nix v3.4.0 fe5255e6fd8df57e9507b7af82fc59dda9e9ff2b
$ niv show
nixpkgs
url: https://github.com/NixOS/nixpkgs/archive/d2caa9377539e3b5ff1272ac3aa2d15f3081069f.tar.gz
owner: NixOS
branch: release-21.11
repo: nixpkgs
type: tarball
sha256: 0syx1mqpdm37zwpxfkmglcnb1swqvsgf6sff0q5ksnsfvqv38vh0
rev: d2caa9377539e3b5ff1272ac3aa2d15f3081069f
homepage:
url_template: https://github.com/<owner>/<repo>/archive/<rev>.tar.gz
description: Nix Packages collection
mach-nix
url: https://github.com/DavHau/mach-nix/archive/fe5255e6fd8df57e9507b7af82fc59dda9e9ff2b.tar.gz
owner: DavHau
branch: master
repo: mach-nix
type: tarball
sha256: 19vh5qfqlml22d6mpi34nnbh71i259sh223l4dr4axar3byy1408
rev: fe5255e6fd8df57e9507b7af82fc59dda9e9ff2b
homepage:
url_template: https://github.com/<owner>/<repo>/archive/<rev>.tar.gz
description: Create highly reproducible python environments
niv
url: https://github.com/nmattia/niv/archive/5912c378c2f87e911f1bc7236202f69581406c9d.tar.gz
owner: nmattia
branch: master
repo: niv
type: tarball
sha256: 1jhs562k3pk0xgwyf0m1h2bck4rivv9f3aznz8dslgby9g5mdnda
rev: 5912c378c2f87e911f1bc7236202f69581406c9d
homepage: https://github.com/nmattia/niv
url_template: https://github.com/<owner>/<repo>/archive/<rev>.tar.gz
description: Easy dependency management for Nix projects
When
Contents of shell.nix
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
mach-nix = import sources.mach-nix {
inherit pkgs;
python = "python38";
};
customPython = mach-nix.mkPython {
requirements = ''
ansible==5.3.0
'';
};
in
pkgs.mkShell {
buildInputs = [
customPython
];
}
nix/sources.json and nix/sources.nix attached for reference: nix.zip
Then
Output from nix-shell
$ nix-shell
trace: removing dependency python3.8-pycrypto-3.11.0 from ansible
trace:
applying fix 'no-rust-build' (nativeBuildInputs) for cryptography:3.3.2
trace: removing dependency python3.8-setuptools-rust-0.12.1 from cryptography
trace: removing dependency python3.8-paramiko-2.7.2 from ansible
trace: removing dependency python3.8-Cython-0.29.24 from pyyaml
trace: removing dependency python3.8-httplib2-0.20.1 from ansible
trace: removing dependency python3.8-netaddr-0.8.0 from ansible
trace: removing dependency python3.8-dnspython-2.1.0 from ansible
trace: removing dependency python3.8-jmespath-0.10.0 from ansible
trace: removing dependency python3.8-dopy-2016-01-04 from ansible
trace: removing dependency python3.8-ncclient-0.6.12 from ansible
error: infinite recursion encountered
at /nix/store/ngbrnnj9p9vpqcd3kv6zfaz6lcnw4950-nixpkgs-src/pkgs/stdenv/generic/make-derivation.nix:170:8:
169| (map (drv: drv.__spliced.hostHost or drv) depsHostHostPropagated)
170| (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
| ^
171| ]
(use '--show-trace' to show detailed location information)
I have also tried various combinations of:
- python39
- multiple earlier versions of ansible (back to v3.4.0)
- nixpkgs-unstable
- mach-nix v3.3.0 (different error)
ERROR: MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl is not a supported wheel on this platform. - mach-nix latest 7b0e7f6f58f7332c1b8347e2673036eada1a6998 (at time of writing)
Can confirm the same error given older MacBook Pro system:
- macOS 11.6.4 (20G417)
- Intel CPU
A temporary fix would be to use nixpkgs provider. The version of ansible in nixpkgs is older though.
can confirm the same error with the following shell.nix on NixOS amd64
## cf https://nixos.org/manual/nix/stable/command-ref/nix-shell.html
let
nixpkgs-version = "21.11";
pkgs =
import (fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-${nixpkgs-version}.tar.gz") {};
mach-nix =
import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix";
ref = "refs/tags/3.4.0";
}) {
inherit pkgs;
python = "python39";
};
pythonEnv = mach-nix.mkPython {
requirements = ''
pillow
numpy
requests
python-vagrant
openshift
netaddr
jmespath
ansible
ansible-lint
molecule==3.5.2
molecule-vagrant
molecule-docker
pylint
'';
};
in
pkgs.mkShell {
name = "pythonEnv";
buildInputs = [
# Change your python version here
pythonEnv
# Add non-python packages here
#pkgs.ansible
#pkgs.ansible-lint
];
}