Nix builtin buildPythonPackage does not work in a default.nix

Problem description:
Nix builtin buildPythonPackage breaks Repl and gets stuck on pythonCatchConflictsStage.

Expected behavior:
Enter a Nix Shell.

Actual behavior:
Stuck on pythonCatchConfictStage

Steps to reproduce:

{ pkgs ? import <nixpkgs> {} }:
  VERSION = "0.0.1";
	my-python-packages = ps: with ps; [
		(buildPythonPackage rec {
				pname = "SpeechRecognition";
				version = "3.10.0";
				src = fetchPypi {
						inherit pname version;
						sha256 = "sha256-FBMRVeiougDq0be5saL6cchF5Ntfml9mozob1sVcbDU=";
				doCheck = false;
				buildInputs = with pkgs; [
						# Specify dependencies
		(buildPythonPackage rec {
				pname = "discord";
				version = "2.2.2";
				src = fetchGit {
						url = "";
						ref = "voice-receive";
				doCheck = false;
				buildInputs = with pkgs; [
						# Specify dependencies
	my-python = pkgs.python39.withPackages my-python-packages;
in pkgs.mkShell {
	nativeCheckInputs = with pkgs; [
    # Deps
  packages = with pkgs; [
	doCheck = true;
  shellHook = ''
	  echo "Please see for a full explanation!"

You can run this in a blank Repl and it gets stuck. No error, just stuck. However, as of today, this executes perfectly fine on NixOS and Nix (Ubuntu WSL). The Repl also correctly enters the shell fine by removing the buildPythonPackage snippets, which is why I believe this is the issue.

What are you trying to do here? Install python packages through nix? You should be using pip or poetry for that AFAIK. As for why it freezes, the repl probably ran out of CPU or RAM.

You can use pip, but this defeats the point of using Nix in the first place. Nix is known for solving dependency hell, and pip is known for causing it.

I believe the Repl is fine, I have a 4x boost in place and the CPU + RAM usage still reports - reporting normal levels.

so is poetry, which is what the import guesser and Tools > Packages use (on the Python template).

if you must use Nix, make sure it’s using instead of Simple index. Or just use Git if possible

1 Like

I agree on both points, I’m just a Nix fanatic who prefers to use it whenever possible and wants to see Replit succeed using it.

It seems to be an issue with buildPythonPackage specifically - reproducible by commenting SpeechRecognition and leaving the second custom package (discord) in.
Although using fetchGit (no Pypi usage), it still has the same issue.