Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test python 3.12 #1916

Closed
tcompa opened this issue Oct 14, 2024 · 2 comments · Fixed by #1946
Closed

Test python 3.12 #1916

tcompa opened this issue Oct 14, 2024 · 2 comments · Fixed by #1946
Assignees
Labels
dependencies Pull requests that update a dependency file maintenance python3.12 testing testing

Comments

@tcompa
Copy link
Collaborator

tcompa commented Oct 14, 2024

Requires #1874

@tcompa tcompa added testing testing dependencies Pull requests that update a dependency file labels Oct 14, 2024
@tcompa
Copy link
Collaborator Author

tcompa commented Oct 22, 2024

https://docs.python.org/3.12/whatsnew/3.12.html:

gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.

Thus we need to run pip install setuptools after creating a venv.

@tcompa
Copy link
Collaborator Author

tcompa commented Oct 25, 2024

Here is a recap of all quirks we observed with Python3.12 (work by @mfranzon in #1946):

  1. We had to add python3.12 to the ubuntu22slurm-multipy image from fractal-containers.

  2. We faced issues on the use of a single system pip (the one in /usr/lib/python3/dist-packages/pip) from multiple Python interpreters, which we solved by explicitly working from version specific venvs: https://github.com/fractal-analytics-platform/fractal-containers/blob/main/images/ubuntu22-slurm-multipy/Dockerfile. The reason why this works is that after creating (and activating) a python3.X venv, the pip that is used is specific (e.g. /tmp/venv312/lib/python3.12/site-packages).

  3. We explicitly included apt install python3.12-distutils in the base image, since this is not part of stdlib any more as of Python3.12.

  4. In the pip-install steps of task collection, we now also run pip install setuptools. Up to 3.11 this has no effect, while on python3.12 it may be needed (depending on which python interpreter is being used, e.g. whether it's a system one or a conda one).

  5. We also install setuptools in the CI Dockerfile - perhaps not required, TBD.

  6. When capping pip version to some "old" FRACTAL_MAX_PIP_VERSION, in the CI, we observed issues which were gone when we moved e.g. to 24.0. We did not explore this further, as there is no interest in using a very old pip in general.

  7. When installing fractal-tasks-core, which we do in some of the tests, using versions older than 1.3.2 leads to unexpected behavior - this is because up to 1.3.1 we were using pandas<2, but wheels for python3.12 are available only for pandas>=2.1.1. For this reason a given test has to be skipped for python3.12, but we can re-include it at the next fractal-tasks-core release (ref Re-include test, upon next fractal-tasks-core release #1958).

Notes:

  • The fractal-server app works with python3.12 out of the box, and the issues above only have to do with the creation of task virtual environments.
  • Most of the issues above would only appear in our CI. If the task-venv base interpeters are some conda envs (as we have in most/all active instances), these issues are gone. As a confirmation, I tried to collect fractal-tasks-core=1.3.2 on an active instance, with python3.12, and the collection went through with no apparent issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file maintenance python3.12 testing testing
Projects
Development

Successfully merging a pull request may close this issue.

2 participants