Upgrade to Python 3.9

What's new in Python 3.9

 

Related ticket(s):

Related repos:

 

$ docker images | grep python3.9 hysds/cuda-pge-base python3.9 ############ 20 hours ago 3.84GB hysds/pge-base python3.9 ############ 20 hours ago 3.41GB hysds/verdi python3.9 ############ 20 hours ago 3.25GB hysds/cuda-dev python3.9 ############ 21 hours ago 4.92GB hysds/dev python3.9 ############ 21 hours ago 3.15GB hysds/cuda-base python3.9 ############ 21 hours ago 3.44GB hysds/base python3.9 ############ 21 hours ago 2.85GB

if you want to test your PGEs with the hysds/pge-base:python3.9 docker image you can SSH into CI and export the image with docker save and import it with docker load

You can build the docker images yourself if you don’t want to export/import image elsewhere, you would have to run (w/ branch HC-385) in your CI instance

  • warning: it can take a while to build the images & there are a lot of steps as well (some missing from here)

  • example Circle CI build taking 2+ hrs

cd puppet-verdi/ $ ./build_docker.sh python3.9

will build the images for with Dockerfile, Dockerfile.pge-base, Dockerfile.cuda-pge-base

 

able to confirm python 3.9 running in all docker images

$ docker run -it hysds/base:python3.9 ops@3951c4870953:~$ python --version Python 3.9.5 $ docker run -it hysds/dev:python3.9 ops@102228433e3b:~$ python --version Python 3.9.5 $ docker run -it hysds/cuda-base:python3.9 ops@66324a20369b:~$ python --version Python 3.9.5 $ docker run -it hysds/cuda-dev:python3.9 ops@22cecadebfe2:~$ python --version Python 3.9.5 $ docker run -it hysds/verdi:python3.9 bash ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519 ops@0625c883075b:~$ python --version Python 3.9.5 $ docker run -it hysds/cuda-pge-base:python3.9 bash pythoops@666f74ab8432:~$ python --version Python 3.9.5 $ docker run -it hysds/pge-base:python3.9 bash ops@16a9019779f0:~$ python --version Python 3.9.5

 

Make sure all your python dependencies are compatible with 3.9:

  • numpy 1.19.2 only supports 3.6-3.8, make sure to fix it to numpy>1.19.2 in your requirements.txt or setup.py to avoid this error:

  • Some libraries that are compatible with 3.9:

    • pytest

    • scripttest

    • mock

    • mockito

    • flake8

    • pytest-cov

    • flake8-junit-report

    • flake8-string-format

    • xmltodict

    • yamale==2.0.1

    • ruamel.yaml

    • elasticmock

    • geopandas

    • gdal (it works in NISAR but would have to do some more digging)

    • elasticsearch (use version <7.14.0 b/c of licensing issues)

  • if you’re using conda and the cffi library, make sure to update the version to 1.14.6

    • 1.14.0 does not work with python 3.9 (haven't tested 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5)

A kluge was added to both pcm-releaser and puppet-hysds_base to allow the provisioner to install the latest version of miniconda which uses python 3.9

Testing

Was able to run a dev-e2e (both fwd and reprocessing for NISAR), the output logs are attached in the NSDS-1555 ticket

  • all dataset checks passed

  • no jobs failed

docker images built for nisar-pcm and CNM_product_delivery

  • after fixing the versions for dependencies

No core functionality broke:

 

Note: JPL employees can also get answers to HySDS questions at Stack Overflow Enterprise: