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/make.py", line 75, in init
    init(
  File "/usr/local/lib/python3.11/site-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/utils/system.py", line 66, in init
    bench.setup.env(python=python)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/bench.py", line 362, in env
    self.run(f"{venv} env", cwd=self.bench.name)
  File "/usr/local/lib/python3.11/site-packages/bench/bench.py", 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/__init__.py", 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 https://raw.githubusercontent.com/frappe/bench/develop/easy-install.py 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…

1 Like