Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
mkemeter
Product and Topic Expert
Product and Topic Expert


Photo by Geio Tischler on Unsplash


 

The SAP HANA Client for Python as of now is only available for x86 Macs. While the client team is planning to release universal binaries, you can continue your work in Python also on the M1 by using Apple's Rosetta technology.

There are many descriptions out there, which explain how to run x86 Python libraries on an M1 chip. The general idea is to install a Python environment, that runs on Rosetta, which again emulates the x86 architecture. I found, that this blog was quite helpful (Please leave some claps for Danny on Medium).

However, if you're simple-minded like I am, you'd prefer a step-by-step guide describing the bare minimum to get hdbcli and dependent clients like the Python Machine Learning Client for SAP HANA working on your machine.

So here is how I got hdbcli running on an Apple M1 chip (..in less than 5 minutes):

  1. Install Rosetta on your Mac by executing the following on the terminal:
    softwareupdate --install-rosetta​

     

  2. Open Finder and go to Applications > Utilities. Right-click the Terminal.app and choose Duplicate.

  3. Rename the duplicate to Terminal_x86.app (or whatever name you like). Right-click and choose Get Info.

  4. In section General make sure to check Open using Rosetta.

  5. Open the newly created Terminal_x86.app and install Brew by running
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"​

    Note, that you also need to do this, in case you have had installed Brew before. This command will install Brew for x86.

     

  6. Still in the Terminal_x86.app, use Brew to install Python:
    brew install python3​

    Remember the install location to not get confused with other Python installations. The blog linked above gives some more insights on how to properly manage several installations. However, I want to keep the description to a minimum here.

     

  7. You're done! You can use the new installation for example in your Jupyter Notebooks and install hdbcli, hana-ml or other x86 Python libraries. Note, that you can just use it as usual - there is no need to care about running stuff with Rosetta anymore. Also, you may want to double-check, that this has worked out by using the Platform package in Python.


Hope, that gets you back on track for Python development with SAP HANA on your new M1! If the above does not work for you, you can also check out an alternative approach by vitaliy.rudnytskiy.