Installation of different Python versions?

Hello,

I am trying to install a different version of Python, but I am running into several questions. I have read the documentation and I am using pyenv. As Python is installed globally, the easiest way would be to install this via Dockerfile, correct?
When I am trying to replicate what you are doing in workspace-images/Dockerfile at master · gitpod-io/workspace-images · GitHub inside my Dockerfile, I get workspaces that are not starting (for example: blue-muskox-188osg9a).

What is the best and/or preferred way to install other Python versions? Do I have to do this on Prebuild or can I also do this inside the Dockerfile?

Best regards,

Jonas

Hi @j0nes2k!

Yes, I’d say a Dockerfile is the best way to install custom Python versions.

Out of curiosity, which version are you trying to install?

Could you please share a link to your repository? I’d love to take a look at your setup, to see if I can spot any errors, and also try opening it myself in Gitpod to reproduce the error you’re seeing.

Hello @jan ,

thanks for having a look into this! I am trying to install Python v3.6.9 at the moment. Unfortunately I cannot share a repository link as this is a private repository, but here are the relevant sections - pretty standard, I think.

gitpod.yml:

tasks:
  - init: |
      some_prebuild_task.sh
    command: |
      some_frontend_task.sh

gitpod.Dockerfile:

FROM gitpod/workspace-mysql

USER root

RUN some_root_tasks.sh

USER gitpod

RUN sudo apt-get -q update && \
    sudo apt-get install -yq a_list_of_packages && \
    some_other_gitpod_user_task.sh && \ 
    pyenv update  && \
    pyenv install 3.6.9  && \
    pyenv global 3.6.9  && \
    # does not matter if I comment pip installation in or not, workspace will not launch
    # python3 -m pip install --no-cache-dir --upgrade pip  && \
    # python3 -m pip install --no-cache-dir --upgrade setuptools wheel virtualenv pipenv pylint rope flake8 mypy autopep8 pep8 pylama pydocstyle bandit notebook twine && \
    sudo rm -rf /tmp/

Is the workspace ID as given above sufficient for you to debug this? If not please let me know what else you need.

Thank you in advance for your help!

Just a short update: everything is working as given above. There were errors in my scripts (some_xxxx_task.sh), which lead to the behavior mentioned. I can now install other Python versions via Dockerfile as expected. Sorry for the inconvenience!