devenv
devenv copied to clipboard
languages.python with unstable package crashes
Describe the bug
I want to use devenv to setup a development environment for a Python project. Instead of the somewhat outdated Python 3.12.x version from the stable nixpkgs input, I want to use the latest Python version from nixpkgs-unstable. Somehow, there is an error with setting up the Python virtual environment:
Logs
direnv: loading ~/projets/SportsTracker/.envrc
direnv: loading https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc (sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=)
direnv: using devenv
direnv: .envrc changed, reloading
warning: creating lock file '/home/dany/projets/SportsTracker/devenv.lock'
direnv: ([/nix/store/kj5k2wvwvqh2vnfndm82dpcr4canwyrn-direnv-2.34.0/bin/direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
• Using Cachix: devenv
copying path '/nix/store/wwrqmysh0dfkszbal1kdk3qid2xa95fx-devenv-1.3.1' from 'https://devenv.cachix.org'
building '/nix/store/vj4hlgba88342g1gxlmn77mqiqy1zf1f-devenv-python-virtualenv.drv'
building '/nix/store/pw1cpxi2w5gsvz2zg7rmgn6cksmp9cxy-devenv-shell-env.drv'
direnv: updated devenv shell cache
Running tasks devenv:enterShell
Failed devenv:python:virtualenv 113ms
Dependency failed devenv:enterShell
1 Failed, 1 Dependency Failed 113.22ms
--- devenv:python:virtualenv failed with error: Task exited with status: exit status: 134
--- devenv:python:virtualenv stdout:
0000.11: ~/projets/SportsTracker ~/projets/SportsTracker
0000.10: Python interpreter changed, rebuilding Python venv...
0000.10: /nix/store/k47xf6hdvrl1w363ldj1zk977jvdwmdc-python3-3.12.6-env/bin/python3.12 -m venv --upgrade-deps /home/dany/projets/SportsTracker/.devenv/state/venv
--- devenv:python:virtualenv stderr:
0000.10: *** stack smashing detected ***: terminated
0000.00: /nix/store/zb4qc5rxr4888rk42mrnfj5y6p61vjw6-devenv-python-virtualenv: line 29: 102657 Aborted (core dumped) /nix/store/k47xf6hdvrl1w363ldj1zk977jvdwmdc-python3-3.12.6-env/bin/python3.12 -m venv --upgrade-deps "$VENV_PATH"
---
To reproduce
devenv.nix
{ pkgs, lib, config, inputs, ... }:
let
# To use packages from nixpkgs-unstable
pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };
in
{
# Setup languages and their tools - https://devenv.sh/languages/
languages.python = {
enable = true;
package = pkgs-unstable.python312;
# Enable Python virtual environment
venv = {
enable = true;
requirements = ./requirements.txt;
};
};
}
devenv.yaml
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
nixpkgs-unstable:
url: github:nixos/nixpkgs/nixpkgs-unstable
devenv.lock
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1730676843,
"owner": "cachix",
"repo": "devenv",
"rev": "7250dbb33f62c30dec5cf1191b0947b76bec5248",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716977621,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1730327045,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "080166c15633801df010977d9d7474b4a6c549d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1730272153,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1730302582,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}
Version
1.3.1
Could you try using languages.python.version = "3.12.7";? Does that work?
I would like to avoid specifying the Python version, since it's building a derivation which takes about 10 minutes to complete. It does work, but it's not a great developer experience.
Which architecture and OS are you running? These should be substituted from our cache if I remember correctly.
My OS is NixOS and the architecture is x86_64.
You can try using https://github.com/cachix/devenv-nixpkgs/pull/9
Just did some debugging with @domenkozar in Discord and we found that disabling manylinux (languages.python.manylinux.enable = false) fixed the issue for me. I can now run python --version without a coredump. May be worth trying @dmarcoux. I did not need the rolling-bump branch of the nixpkgs either.
I've applied false as a default in https://github.com/cachix/devenv-nixpkgs/pull/9
Closing, as the issue is somewhat resolved and too stale to debug further. Future readers: please open a new issue if you encounter something similar.