Skip to content

Conversation

@peanutfun
Copy link
Member

@peanutfun peanutfun commented Sep 28, 2023

Changes proposed in this PR:

  • Allow users to create environments for Python 3.9, 3.10, and 3.11, reverting part of the changes from 185ef96

PR Author Checklist

PR Reviewer Checklist

@emanuel-schmid
Copy link
Collaborator

With the current configuration this leads to Jenkins running all tests with Python 3.11 and I think for now it should stay at 3.9 there.
The installation scripts script/jenkins/install_env.sh of both petals and core need to be modified. I was thinking of something like

#!/bin/bash -e

mamba remove --name climada_env --all
mamba env create -f <(sed 's/ - python.*$/ - python=3.9/' requirements/env_climada.yml) --name climada_env

source activate climada_env
python -m pip install -e "./[test]"

make install_test

conda deactivate

but it doesn't look so nice, does it?

@peanutfun
Copy link
Member Author

peanutfun commented Sep 28, 2023

Damn, sorry about that! 🙈 In the tests, I was relying on adding specs to the environment file definitions, see docs and https://github.com/CLIMADA-project/climada_python/blob/main/.github/workflows/ci.yml#L42

Apparently, this is an exclusive feature of micromamba. With Conda/Mamba, one can only define environments by either package specs or an environment file, but never both at the same time. So if you want to set a specific Python version, you have to create a clean environment first in which you pin the python version and then update it with the spec file:

mamba create -y -n climada_env python=3.9
mamba env update -n climada_env -f requirements/env_climada.yml

Edit: does not work, see below

@peanutfun
Copy link
Member Author

Oh no, the solution above still upgrades Python in mamba env update. This is super annoying. I'll try to find a solution...

@peanutfun
Copy link
Member Author

@emanuel-schmid This works, but it's annoying because it first creates the environment with Python 3.11 and then re-installs all packages for Python 3.9:

mamba env create -y -n climada_env -f requirements/env_climada.yml
mamba install -n climada_env python=3.9

@peanutfun
Copy link
Member Author

Can we maybe just remove the Python version? We have a version requirement in the setup.py. The only issue is that the error of a wrong version will trigger only after creating an environment

@emanuel-schmid
Copy link
Collaborator

emanuel-schmid commented Sep 29, 2023

Removing the Python version seems to work.

In any case we should update the Advanced Instrucions as well, otherwise they result in an environment with the Python version from the base environment. We certainly don't want that for Python 3.12 or 3.8.

@emanuel-schmid
Copy link
Collaborator

should be: "Removing the whole Python entry seems to work"

@peanutfun
Copy link
Member Author

peanutfun commented Sep 29, 2023

Alright. So the resolution is

  • Remove python from requirements in env_climada.yml
  • Update advanced installation instructions to do the following:
    mamba create -n climada_env python=X.Y  # Python version of choice
    mamba env update -n climada_env -f requirements/env_climada.yml
    mamba activate climada_env
    python -m pip install -e ./  # This will throw an error if the Python version is not supported

@chahank Is that okay for you?

@chahank
Copy link
Member

chahank commented Sep 29, 2023

Hihi! I think the #Python version of choice line must be clearer. What versions are recommended? What versions are working?

Otherwise good for me.

@peanutfun
Copy link
Member Author

Yes, of course, we will list the supported versions (3.9, 3.10, 3.11 at the moment) ✌️

* Add instructions for choosing Python version.
* Fix update instructions: No env_developer.yml for Petals anymore.
* Add setup instructions to VSCode for Petals.
@peanutfun
Copy link
Member Author

@chahank
Copy link
Member

chahank commented Oct 2, 2023

Thanks @peanutfun . So, we have to remember to ALWAYS update this line with new releases. I think the naming is a bit confusing though with Supported and allowed .

@peanutfun
Copy link
Member Author

I did not want to call the other Python versions "Supported", because that implies that we can support people with any kind of issues occurring with these versions. I think we are not ready for that, yet.

emanuel-schmid and others added 3 commits October 2, 2023 14:09
@emanuel-schmid
Copy link
Collaborator

So, we have to remember to ALWAYS update this line with new releases.

Er - how is that?

@peanutfun
Copy link
Member Author

@chahank Are you referring to Python releases? These occur once a year.

@chahank
Copy link
Member

chahank commented Oct 2, 2023

I am referring to CLIMADA release. We have to update these installation instructions in case we support new versions of Python and if we do not support any more other versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants