Search code examples
pyenvgitpod

`pyenv install` on `.gitpod.yml` has no effect


I'm trying to configure my Gitpod workspace to install a new Python version like this:

image: gitpod/workspace-python-3.10:2023-03-06-18-43-51

tasks:
- name: install-mamba
  init: |
    pyenv install mambaforge-22.9.0-2
    pyenv uninstall -f 3.8.16 || true
  command: |
    pyenv global mambaforge-22.9.0-2
    mamba --version
github:
  prebuilds:
    # explicitly enable prebuilds for the main branch
    main: true

However, when I open the workspace, I see a message indicating that these command are in the history (/workspace/.gitpod/src-0), but pyenv versions does not show the version I wanted to install.

Maybe I'm misunderstanding something about how this is supposed to work?


Solution

  • pyenv installs outside /workspace, so changes are not persistent. The solution is to create a custom Docker image as explained here: https://www.gitpod.io/docs/introduction/languages/python#python-versions