You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/08/04 19:36:58 UTC

[airflow] 03/07: Better warning and instructions in case someone runs emulated Python (#25482)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit fe841e3c713215a32ab4eb7e38cc0002d4e86bae
Author: Jarek Potiuk <ja...@polidea.com>
AuthorDate: Tue Aug 2 19:17:21 2022 +0200

    Better warning and instructions in case someone runs emulated Python (#25482)
    
    It seems that the problem with runnig an emulated Python with rosetta
    on Macs M1/M2 might be more widespread. There are various scenarios
    where people could get the emulated Python:
    
    * Installing application with pre-bundled Intel Python (Intellj/PyCharm)
    * Installing older Python via anaconda
    * Transferring the configuration from Intel based Macs (yes, Apple
      will NOT warn you when you are copying brew, python and other
      binaries during the Apple-blessed "Transfer my Mac").
    
    This means that proably quite a number of people currently runs
    Intel, emulated version of Python on their shiny new M1s which
    slows the Python (and thus Airflow) more than 10x.
    
    We alredy had a warning about it, but now it is more explicit, telling
    the user what exactly should be checked and how to rectify from
    the situation (basically nuking the development environment including
    brew and restarting from scratch is the best option you have).
    
    (cherry picked from commit ee03c2b693577d72365baa47d5209f1246e405b3)
---
 dev/breeze/src/airflow_breeze/commands/main_command.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/dev/breeze/src/airflow_breeze/commands/main_command.py b/dev/breeze/src/airflow_breeze/commands/main_command.py
index f4adab3c15..3eb14ccd30 100644
--- a/dev/breeze/src/airflow_breeze/commands/main_command.py
+++ b/dev/breeze/src/airflow_breeze/commands/main_command.py
@@ -157,15 +157,21 @@ def check_for_rosetta_environment():
             from airflow_breeze.utils.console import get_console
 
             get_console().print(
-                '\n\n[error]You are starting breeze in `rosetta 2` emulated environment on Mac[/]'
+                '\n\n[error]You are starting breeze in `rosetta 2` emulated environment on Mac[/]\n'
             )
             get_console().print(
-                '[warning]This is very bad and your Python is 10x slower as it is emulated[/]'
+                '[warning]This is very bad and your Python is 10x slower as it is emulated[/]\n'
             )
             get_console().print(
-                '[warning]You likely have wrong architecture-based IDE (PyCharm/VSCode/Intellij) that '
-                'you run it on\n'
-                'You should download the right architecture for your Mac (Apple Silicon or Intel)[/]\n'
+                'You have emulated Python interpreter (Intel rather than ARM). You should check:\n\n'
+                '  * Your IDE (PyCharm/VSCode/Intellij): the "About" window should show `aarch64` '
+                'not `x86_64` in "Runtime version".\n'
+                '  * Your python: run  "python -c '
+                'import platform; print(platform.uname().machine)"). '
+                'It should show `arm64` not `x86_64`.\n'
+                '  * Your `brew`: run "brew config" and it should show `arm` in CPU line not `x86`.\n\n'
+                'If you have mixed Intel/ARM binaries installed you should likely nuke and '
+                'reinstall your development environment (including brew and Python) from scratch!\n\n'
             )
             from inputimeout import inputimeout