[Python] Nixpacks build hangs when venv directory exists in Python project

Discussão em 'Python' iniciado por Stack, Maio 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using Nixpacks to build a Docker image from a Python project. The build works fine when my project directory does not contain a local virtual environment. However, if I create a virtual environment (e.g., with python -m venv venv), the build hangs indefinitely at the Building Nixpacks image... step.

    Steps to reproduce:

    Project structure before creating the virtual environment:

    .
    ├── main.py
    └── requirements.txt


    Build command (works fine):

    sudo nixpacks build . -t image1


    Create a virtual environment:

    $ python -m venv venv


    Now the directory structure is:

    .
    ├── main.py
    ├── requirements.txt
    └── venv/


    Run the same build command again:

    sudo nixpacks build . -t image1


    The build hangs at Building Nixpacks image... and never completes.

    Why does the presence of the venv directory cause Nixpacks to hang?

    Is there a recommended way to exclude the local venv directory from the build context, or configure Nixpacks to ignore it?

    Is this expected behavior, or am I missing a configuration step?

    Continue reading...

Compartilhe esta Página