# Upgrading from Python 3.7 to 3.9

**URL:** <https://forum.opencv.org/t/upgrading-from-python-3-7-to-3-9/14748>\
**Category:** Python\
**Created:** [October 4, 2023, 9:00pm UTC](https://forum.opencv.org/t/upgrading-from-python-3-7-to-3-9/14748 "2023-10-04T21:00:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lselkins](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/lselkins/32/8850_2.png) [@lselkins](https://forum.opencv.org/u/lselkins)\
**Post date:** [October 4, 2023, 9:00pm UTC](https://forum.opencv.org/t/upgrading-from-python-3-7-to-3-9/14748/1 "2023-10-04T21:00:28Z")

</div>

Hi,

I am working on upgrading some applications we have that are running in AWS Lambda docker images from python 3.7 to python 3.9. The docker images are listed as below:

- Python 3.7
  - public.ecr.aws/lambda/python:3.7

- Python 3.9
  - public.ecr.aws/lambda/python:3.9

Previously we were using `opencv-python==4.3.0.36`, however python 3.9 does not support this version so I had to upgrade to the next closest version, which was `4.3.0.38`. When doing this upgrade, opencv now compiles from source when trying to `pip install`.

I am not sure why it is not choosing the appropriate whl file since the linux distro the docker image uses didn’t change (to my knowledge).

Hoping for insight.

Thanks!  
Logan Elkins

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 4, 2023, 9:40pm UTC](https://forum.opencv.org/t/upgrading-from-python-3-7-to-3-9/14748/2 "2023-10-04T21:40:38Z")

</div>

don’t depend on so old a version.

those old versions don’t have binaries for python 3.9 because python 3.9 wasn’t available then.

none of the files for 4.3.0.38 mention `abi3` so they aren’t forward-compatible.

every time pip tries to build from source, you’re trying to match versions that don’t match.

you _must_ pick a newer version. while you’re at it, pick the current release.

---

<div class="post-metadata">

**Author:** ![lselkins](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/lselkins/32/8850_2.png) [@lselkins](https://forum.opencv.org/u/lselkins)\
**Post date:** [October 4, 2023, 9:52pm UTC](https://forum.opencv.org/t/upgrading-from-python-3-7-to-3-9/14748/3 "2023-10-04T21:52:02Z")

</div>

Gotcha. We also depend on a large number of other packages so our dependency trees are quite tightly knit but I will do my best to upgrade to a newer version.

Thank you!

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 5, 2023, 8:01am UTC](https://forum.opencv.org/t/upgrading-from-python-3-7-to-3-9/14748/4 "2023-10-05T08:01:30Z")

</div>

if you use aruco, perhaps stop at 4.5.something because after that is when that module was severely manhandled. the dust seems to have settled now though.
