5/4/2023 0 Comments Python mac m1 download![]() We use Docker Compose to run integration tests for some of our services, particularly our “engine” that runs on Dask. This might warrant some future investigation. Interestingly, the gas tests are a bit slower on native Python 3.8 - while the super slow electricity tests are finishing significantly faster. | Repository | 3.7 | 3.7 | 3.8 | | - | - | - | - | | Gas | 100.77 s | 44.74 s | 47.65 s | | Electricity | 296.42 s | 122.90 s | 89.42 s |Įven with Rosetta enabled, we see speed improvements of almost 60%! We need to run these tests at least once before every deployment (in CI) to catch integration errors, but we sometimes also run them locally before committing. We compared their test suite run times on our old and new laptops, and also to native Python 3.8.13 (without Rosetta). We benchmarked two of our largest repositories of algorithms for gas and electricity pricing (implemented in Pandas). ![]() We had to run some quick benchmarks to ensure we made the right call saying goodbye to the touch bar. BenchmarksĪfter going through all this trouble we started reconsidering our switch to the shiny new platform. QA is particularly important with these sorts of platform upgrades, since problems could be hiding anywhere in the codebase. Some libraries needed an upgrade as well, particularly for 3.10 support. The few code changes we had to make were related to type checking. To save you (and our teammates) some trouble, we’ve bundled all steps into a shell script that should just work: #!/bin/sh softwareupdate -install-rosetta # Install pyenv (and initialize it): git clone ~/.pyenv (cd ~/.pyenv & src/configure & make -C src) alias pyenv86="arch -x86_64 pyenv" export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv86 init -path)" eval "$(pyenv86 init -)" # Install homebrew for x86_64: arch -x86_64 /bin/bash -c "$(curl -fsSL )" alias brew86="arch -x86_64 /usr/local/bin/brew" # Install dependencies for building Python: libs="openssl readline sqlite3 xz zlib gettext" brew86 install $libs # Set compiler and linker flags: for lib in $libs do prefix="$(brew86 -prefix $lib)" export CFLAGS="$CFLAGS -I$prefix/include" export LDFLAGS="$LDFLAGS -L$prefix/lib" done pyenv86 install 3.7.13 pyenv86 global 3.7.13 Upgrading to Python 3.8 and beyondĪ few days later, after running our test suites using Python 3.8, 3.9, and 3.10, we realized that upgrading wouldn’t be too painful. Our version of pyenv (installed with Homebrew) did not yet contain the latest patches for Python 3.7.13, so we had to reinstall pyenv using the Basic GitHub Checkout method.Īfter fixing these issues we got Python 3.7.13 to build.The Python build failed because gettext was missing, which we had to install with Homebrew.We were a little confused by this, but after some hair pulling we figured it out. The article gave an example of how to set compiler and linker flags, but it didn’t include all the required ones.This article by Sixty North was a great help, but we still ran into some problems: Thankfully, we learned we could install the x84_64 version and run it through Rosetta instead. Why didn’t we upgrade to 3.8, 3.9, or 3.10 sooner? Upgrading now on a whim was not an option we had to get 3.7 working somehow. Even though 3.7 is still actively maintained, building it for arm64 on macOS didn’t work at all. To our surprise, we hit our first roadblock installing Python 3.7 using pyenv. We pulled it off, but let’s just say more hours went into it than expected. The plan was to migrate everything from our 2019 MacBooks in a day or two before handing them in. Supposedly they’re fast too, so we were really excited to try them. These laptops are thick there’s definitely a battery in there. Our team recently switched to the 2021 MacBook Pro with Apple’s M1 chip.
0 Comments
Leave a Reply. |