Cookiecutter Backend Build - python version problem

Installing cookieplone project locally on my laptop [Ubuntu 22.04] with:

"plone_version": "6.1.2",
"volto_version": "18.24.0",

While building the backend, I keep getting:

uv venv /home/flipmcf/WebDev/pilot-demo/backend/.venv
Using CPython 3.10.12 interpreter at: /usr/bin/python3
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
+ uv pip install -r requirements-mxdev.txt
  × No solution found when resolving dependencies:
   ╰─▶ Because only pilot-demo[test]==1.0.0a0 is available and the current Python version (3.10.12) does not satisfy Python>=3.12 (blah blah....)

I installed a 3.12.11 virtualenv, but not sure how to get cookiecutter or the backend to recognize it’s what I want.

Any suggestions?

flipmcf@flipmcf-GF63:~/WebDev/pilot-demo/backend$ pyenv virtualenvs
3.12.11/envs/plone (created from /home/flipmcf/.pyenv/versions/3.12.11)
plone (created from /home/flipmcf/.pyenv/versions/3.12.11)

Cookiecutter replay:

{
"cookiecutter": {
"title": "Pilot Demo",
"description": "Pilot Project Demo for JM",
"project_slug": "pilot-demo",
"hostname": "``pilot-demo.flipmcf.com``",
"author": "Michael McFadden (flipmcf)",
"email": "``flipmcf@gmail.com``",
"use_prerelease_versions": "No",
"plone_version": "6.1.2",
"volto_version": "18.24.0",
"python_package_name": "pilot.demo",
"frontend_addon_name": "volto-pilot-demo",
"language_code": "en",
"github_organization": "flipmcf",
"container_registry": "github",
"devops_storage": "relstorage",
"devops_cache": "1",
"devops_ansible": "1",
"devops_gha_deploy": "1",
"initialize_documentation": "1",
"__project_slug": "pilot-demo",
"__repository_url": "``https://github.com/flipmcf/pilot-demo``",
"__repository_git": "``git@github.com``:flipmcf/pilot-demo",
"__version_package": "1.0.0a0",
"__version_frontend_package": "1.0.0-alpha.0",
"__feature_headless": "1",
"__feature_distribution": "0",
"__backend_managed_by_uv": "false",
"__npm_package_name": "volto-pilot-demo",
"__folder_name": "pilot-demo",
"__python_package_name_upper": "Pilot.Demo",
"__python_version": "3.12",
"__node_version": "22",
"__version_plone_volto": "18.24.0",
"__version_pnpm": "9.1.1",
"__container_registry_prefix": "``ghcr.io/``",
"__container_image_prefix": "``ghcr.io/flipmcf/pilot-demo``",
"__profile_version": "20250830001",
"__profile_language": "en",
"__locales_language": "en",
"__gha_version_checkout": "v4",
"__gha_version_setup_node": "v4",
"__gha_version_setup_uv": "v5",
"__gha_version_cache": "v4",
"__gha_version_docker_stack": "v1.2.0",
"__gha_version_docker_metadata": "v5",
"__gha_version_docker_qemu": "v3",
"__gha_version_docker_buildx": "v3",
"__gha_version_docker_login": "v3",
"__gha_version_docker_build_push": "v6",
"__gha_version_paths_filter": "v3",
"__devops_host": "pilot-demo",
"__devops_compose_name": "pilot-demo",
"__devops_stack_name": "pilot-demo-flipmcf-com",
"__devops_swarm_public_network": "nw-public",
"__devops_swarm_stack_network": "nw-internal",
"__devops_traefik_version": "v2.11",
"__devops_traefik_local_include_ui": "yes",
"__devops_traefik_stack_include_ui": "no",
"__devops_traefik_docker_network": "pilot-demo-flipmcf-com_nw-internal",
"__devops_varnish_version": "7.6",
"__devops_db_version": "14.15",
"__devops_db_password": "YMFWDZIFNSgA",
"__devops_zeo_version": "6.0.0",
"__backend_addon_git_initialize": "0",
"__backend_addon_format": "1",
"__project_git_initialize": "1",
"_copy_without_render": [
"devops/etc",
"devops/playbooks",
"devops/requirements",
"devops/tasks",
"devops/inventory/group_vars/all/users.yml",
"news/.changelog_template.jinja"
],
"_extensions": [
"cookieplone.filters.use_prerelease_versions",
"cookieplone.filters.node_version_for_volto",
"cookieplone.filters.extract_host",
"cookieplone.filters.image_prefix",
"cookieplone.filters.pascal_case",
"cookieplone.filters.locales_language_code",
"cookieplone.filters.gs_language_code",
"cookieplone.filters.latest_volto",
"cookieplone.filters.latest_plone"
],
"__cookieplone_subtemplates": [
[
"add-ons/backend",
"Setup Backend",
"1"
],
[
"add-ons/frontend",
"Setup Frontend",
"1"
],
[
"docs/starter",
"Generate documentation scaffold",
"1"
],
[
"sub/cache",
"Setup Cache",
"1"
],
[
"sub/project_settings",
"Setup Project Settings",
"1"
]
],
"__cookieplone_repository_path": "/home/flipmcf/.cookiecutters/cookieplone-templates",
"__cookieplone_template": "project",
"__generator_sha": "8004290a4abc3f581e3111b973522c64c3463683",
"__generator_template_url": "``https://github.com/plone/cookieplone-templates/tree/main/project``",
"__generator_date_long": "2025-08-30 21:08:04",
"__generator_signature": "Generated using Cookieplone (0.9.7)andcookieplone-templates (8004290) on 2025-08-30 17:06:59.159471",
"_template": "gh:plone/cookieplone-templates",
"_output_dir": "/home/flipmcf/WebDev",
"_repo_dir": "/tmp/cookiecutter2yv5p4mq/monorepo",
"_checkout": "main"
},
"_cookiecutter": {
"title": "Pilot Demo",
"description": "Pilot Project Demo for JM",
"project_slug": "pilot-demo",
"hostname": "``pilot-demo.flipmcf.com``",
"author": "Michael McFadden (flipmcf)",
"email": "``flipmcf@gmail.com``",
"use_prerelease_versions": "No",
"plone_version": "6.1.2",
"volto_version": "18.24.0",
"python_package_name": "pilot.demo",
"frontend_addon_name": "volto-pilot-demo",
"language_code": "en",
"github_organization": "flipmcf",
"container_registry": "github",
"devops_storage": "relstorage",
"devops_cache": "1",
"devops_ansible": "1",
"devops_gha_deploy": "1",
"initialize_documentation": "1"
}
}

My Answer:

after cookiecutter completes, edit ./backend Makefile
target ‘$(VENV_FOLDER):' and add the python version 3.12 to make a 3.12 virtualenv

Seems like a hack, Is this a bug?

$(VENV_FOLDER): requirements-mxdev.txt ## Install dependencies
@echo "$(GREEN)==> Install environment$(RESET)"
@uv venv --python 3.12 $(VENV_FOLDER)
@uv pip install -r requirements-mxdev.txt

Result:

==> Install environment
+ uv venv --python 3.12 /home/flipmcf/WebDev/pilot-demo/backend/.venv
Using CPython 3.12.11
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
+ uv pip install -r requirements-mxdev.txt
Resolved 288 packages in 1.24s
      Built pilot-demo @ file:///home/flipmcf/WebDev/pilot-demo/backend
      Built sgmllib3k==1.0.0
Prepared 282 packages in 9.10s
Installed 288 packages in 147ms
 + accesscontrol==7.2
 + acquisition==6.1
...

In the recent past, I changed the Makefile generated by cookieplone-templates to explicitly pin one of the Python versions supported by the selected Plone version (like you did manually): Be explicit about the Python version when running uv venv by davisagli · Pull Request #255 · plone/cookieplone-templates · GitHub

But then we realized that this caused problems when trying to test the project in CI with a matrix of different Python versions, so we removed it again: Don't specify Python version in Makefile by davisagli · Pull Request #265 · plone/cookieplone-templates · GitHub

That means it’s currently your responsibility to make sure that uv will pick an appropriate Python version when it creates the virtualenv. I think one way to do this is with uv python pin 3.12, which creates a .python-version file in the current folder as a hint to uv. Python versions | uv

1 Like

Now that we don’t have to install a Python before running cookieplone, we could make it a question in the template. Otherwise we’ll need to document it and tell people to manually specify their Python version.

What do you think of this?

[8/20] Plone Version (6.1.1):
[9/20] Supported Python version (uv default):

…where a numeric answer to that question would create a .python-version file containing a specific supported version number, else use what uv discovers or creates. It’s not great UI, but a starting point, at least.

Then with CI, would you be able to pass a matrix of versions into a question? Sorry, I’m not too familiar with the problem space. Just thinking out loud.

First off thanks David for letting me know that I’m on the right path. I wanted to make sure I wasn’t in inventing my own idioms.

Steve, I saw this user path too. Have cookieplone ask the user for a python version.

(default to something sane)

As for the CI matrix… I understand the need, but not yet the problem. Maybe someday I will have to support the build system or have a need to support multiple versions at the same time.

I’m not sure if I want that responsibility. I’m glad David’s around for those tough things.

I’m glad we’re all here Make America Plone Again.

this was fixed in: Be explicit about the Python version when running uv venv locally in backend by wesleybl · Pull Request #269 · plone/cookieplone-templates · GitHub

1 Like

Ah indeed I had the same problem and posted about it here Plone 6.1.2 apparently does not support Python 3.10 or 3.11? (cookieplone)