Frappe Docker - Development Container Windows

Hi All,

So I’ve been having issues creating a development container on Windows 11 using Docker and WSL.

I always get stuck during the bench init process trying to generate a python venv env.

This is where I’m currently stuck:

I’ve tried creating it using the official frappe/bench:latest image.

$ python3 -m venv env
Error: Command '['/workspace/development/frappe-bench/env/bin/python3', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
subprocess.CalledProcessError: Command 'python3 -m venv env' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bench/commands/", line 75, in init
  File "/usr/local/lib/python3.11/site-packages/bench/utils/", line 105, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/", line 66, in init
  File "/usr/local/lib/python3.11/site-packages/bench/utils/", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/bench/", line 362, in env"{venv} env",
  File "/usr/local/lib/python3.11/site-packages/bench/", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/", line 158, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: python3 -m venv env

ERROR: There was a problem while creating frappe-bench

I’ve also tried using a custom docker build to ensure all the prerequisites are installed correctly based on the python:3.11-slim-bullseye image.

If I try running python3 -m ensurepip --upgrade --default-pip manually, I get a response of:

$ python3 -m ensurepip --upgrade --default-pip
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmp2h508xul
Requirement already satisfied: setuptools in /usr/local/lib/python3.11/site-packages (65.5.1)
Requirement already satisfied: pip in /usr/local/lib/python3.11/site-packages (23.2.1)

I’m really not sure what I’m doing wrong and how to resolve this issue. Can someone advise?

Edit 1:

Using works if I use --prod however, if I am trying to develop, running --prod is not a good :slight_smile:

It does, however show that it should work…