Problem Building Python 3.7.0 in Amazon Linux 2

I’m trying to build Python 3.7.0 in Amazon Linux 2 according to these instructions (yeah, I wrote them myself) and I’m having a strange problem: it works fine on a c5.large, but on any instance with about 16 GiB or more of RAM, such as an r5.large or an m5.xlarge, the build progresses up to test_socket, and then in “top” in another window I see the “buff/cache” memory start climbing until the system runs out of RAM and freezes. (It takes about 33 minutes for the build to get this far. I also tried using an x1.16xlarge, but it took an hour to get to 80 GiB and then I gave up.) I don’t know whether the problem is with Python or Amazon Linux 2, but I suspect the latter because it’s “buff/cache.” The Python process itself doesn’t seem to take excessive RAM.

Any ideas why this is happening or how to fix it?


Related discussions:

Is there no python 3 RPM?

sudo yum install python36 python36-virtualenv python36-pip

Maybe 37 is available by now.

Python 3.6.2 is available in the amazon-linux-extras. Python 3.7.0 is not yet available through yum.

Is there much difference?

yes

maybe crosspost /r/python they are extremely active

Maybe try pyenv. It builds any Python version for you. Before building make sure you have installed all build dependencies. Using pyenv-virtualenv you can activate the Python version for your virtual environment.

I’m a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

^(If you follow any of the above links, please respect the rules of reddit and don’t vote in the other threads.) ^(Info ^/ [1](/message/compose?to=/r/TotesMessenger))


  1. Contact ↩︎

Totally agree with this recommendation. I always use pyenv for everything and I have on Amazon Linux and it works perfectly.

in 7 y this is default python now there :slight_smile: 2025