OpenCV-Python for Apples M1 Chip: A Detective Story With A Happy Ending

I believe I followed your instructions correctly, at least as best as I understood them. Hoping also that mac utility homebrew finally native silicon this process documentation is useful for others. That issue is closed for a reason, the list is outdated.

Using this Ansible collection that allows you to install any GUI application from Apple store we will set up XCode which is, of course, Apple’s recommended IDE. Using the above tools, we have all we need to set up our requirements and move on to building. I started with the official tutorial on building the current version of OpenCV for macOS. However, for our continuous integration machine, we need to do a few additional steps. Since we want to support multiple Python versions, chances are we’ll have more machines in the future, so we’ll want to automate the environment setup. Homebrew, thankfully, prebuilds the binaries, so you don’t have to build from source code on your local machine.

This module is essential for us, as it is with any binary library for Python (since the data exchange relies on the C-compatible interfaces and C data types). In other words, it means we can’t use numpy or OpenCV without ctypes. First I tried to export the same variables which solved the 3.8 build, and… nothing. Looking at the build log, I found an attempt to build _ctypes. However, the code said that it’s impossible to have macOS/OSX as an operating system and ARM as a platform (haha, not true anymore!).

Give it a try, and let me know what you think by leaving a comment below. If you’re already comfortable with Linux package managers, you may think Homebrew is too simple, but don’t mistake Homebrew’s ease of use for lack of features. Looking a little deeper reveals many advanced options that go far beyond what I showed you here. Adding -h to any brewsubcommand shows the rich features available to upgrade, remove, troubleshoot, and even contribute new formulas using templates.

This started after I reinstalled homebrew to switch to the M1 version. Mysql-client worked fine on my M1 Mac prior to reinstalling the m1 Homebrew. Homebrew boasts that it “installs the stuff you need that Apple didn’t” install by default. Installation happens with the brew command, which gives us access to thousands of command-line utilities, but not more complex applications.

grep mysql . DBngin is a convenient way to install multiple versions of MySQL and other database servers like PostgreSQL and Redis. Launch the terminal, type xcode-select –installand press Enter. Symlink /opt/homebrew/bin to /usr/local/bin with ln -s /opt/homebrew/bin /usr/local/bin.

They have a more complex directory hierarchy that is much more than a single binary. Popular macOS package management utility Homebrew has officially added support for Apple Silicon in its latest release. Predicating on processor architecture (e.g. to fence off formulae code for arch-specific behavior) was already present. While the code for universal binaries did get removed, this arch-selection functionality was mostly kept.

Homebrew and Docker were basically the only things left that I was waiting for and Docker honestly isn’t a dealbreaker. Even most of my music gear makers have provided M1-native drivers in the last few weeks. Roland just put one out for my 11 year old synthesizer. I figured the new architecture would have been the end of the line for that old thing. In celebrating the update, the Homebrew team gave “particular thanks” to MacStadium and to Apple.

Why are you using such an old version of mysqlclient? Works using an M1-native installation … IGeeksBlog has affiliate and sponsored partnerships. We may earn commissions on purchases made using our links.

Leave a Reply

Your email address will not be published. Required fields are marked *