<h3 dir="auto">Describe the bug</h3>
<p dir="auto">If we take a look into master of sqlalchemy it defines following install_requires:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="greenlet != 0.4.17;(platform_machine=='aarch64' or (platform_machine=='ppc64le' or (platform_machine=='x86_64' or (platform_machine=='amd64' or (platform_machine=='AMD64' or (platform_machine=='win32' or platform_machine=='WIN32'))))))"><pre class="notranslate"><code class="notranslate">greenlet != 0.4.17;(platform_machine=='aarch64' or (platform_machine=='ppc64le' or (platform_machine=='x86_64' or (platform_machine=='amd64' or (platform_machine=='AMD64' or (platform_machine=='win32' or platform_machine=='WIN32'))))))
</code></pre></div>
<p dir="auto">Thus because platform_machine is not one of the above, greenlet is never installed. I was told that platform_machine for such macos is <code class="notranslate">arm64</code> (I do not have Mac M1 at hand)</p>
<p dir="auto">This in effect prevents sqlalchemy from running.</p>
<p dir="auto">Fix is easy by <code class="notranslate">pip install greenlet</code> and then everything is back to normal.</p>
<h3 dir="auto">To Reproduce</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
$ pip install sqlalchemy[asyncio]

$ pip show

    SQLAlchemy==1.4.35

While it should be:

$ pip show

    greenlet==1.1.2
    SQLAlchemy==1.4.35"><pre class="notranslate">$ <span class="pl-s1">pip</span> <span class="pl-s1">install</span> <span class="pl-s1">sqlalchemy</span>[<span class="pl-s1">asyncio</span>]

$ <span class="pl-s1">pip</span> <span class="pl-s1">show</span>

    <span class="pl-v">SQLAlchemy</span><span class="pl-c1">==</span><span class="pl-c1">1.4</span>.<span class="pl-c1">35</span>

<span class="pl-v">While</span> <span class="pl-s1">it</span> <span class="pl-s1">should</span> <span class="pl-s1">be</span>:

$ <span class="pl-s1">pip</span> <span class="pl-s1">show</span>

    <span class="pl-s1">greenlet</span><span class="pl-c1">==</span><span class="pl-c1">1.1</span>.<span class="pl-c1">2</span>
    <span class="pl-v">SQLAlchemy</span><span class="pl-c1">==</span><span class="pl-c1">1.4</span>.<span class="pl-c1">35</span></pre></div>
<h3 dir="auto">Error</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="N/A"><pre class="notranslate"><code class="notranslate">N/A
</code></pre></div>
<h3 dir="auto">Versions</h3>
<ul dir="auto">
<li>OS: MacOS</li>
<li>Python: Python3.9+</li>
<li>SQLAlchemy: SQLAlchemy = {version = "^1.4.35", extras = ["asyncio"]}</li>
<li>Database: Postgres</li>
<li>DBAPI (eg: psycopg, cx_oracle, mysqlclient): postgresql+asyncpg</li>
</ul>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Describe the bug</h3>
<p dir="auto">When installing SQLAlchemy 1.4.x with the <code class="notranslate">asyncio</code> extra on a Apple M1 machine the <code class="notranslate">greenlet</code> package is not installed even if it's listed in the requirements and for <code class="notranslate">aarch64</code> architectures.</p>
<h3 dir="auto">To Reproduce</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# On a Apple M1, inside a Docker container running Python in a linux distro
$ docker run --rm -it python:3.10 /bin/bash
root@afbf52f73731:/# pip install sqlalchemy==1.4.31
root@afbf52f73731:/# pip list | grep greenlet
greenlet   1.1.2

# On a Apple M1, in the local environment
$ pip install sqlalchemy==1.4.31
$ pip list | grep greenlet
# no output"><pre class="notranslate"><span class="pl-c"># On a Apple M1, inside a Docker container running Python in a linux distro</span>
$ <span class="pl-s1">docker</span> <span class="pl-s1">run</span> <span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-s1">rm</span> <span class="pl-c1">-</span><span class="pl-s1">it</span> <span class="pl-s1">python</span>:<span class="pl-c1">3.10</span> <span class="pl-c1">/</span><span class="pl-s1">bin</span><span class="pl-c1">/</span><span class="pl-s1">bash</span>
<span class="pl-s1">root</span>@<span class="pl-s1">afbf52f73731</span>:<span class="pl-c1">/</span><span class="pl-c"># pip install sqlalchemy==1.4.31</span>
<span class="pl-s1">root</span>@<span class="pl-s1">afbf52f73731</span>:<span class="pl-c1">/</span><span class="pl-c"># pip list | grep greenlet</span>
<span class="pl-s1">greenlet</span>   <span class="pl-c1">1.1</span><span class="pl-c1">.2</span>

<span class="pl-c"># On a Apple M1, in the local environment</span>
$ <span class="pl-s1">pip</span> <span class="pl-s1">install</span> <span class="pl-s1">sqlalchemy</span><span class="pl-c1">==</span><span class="pl-c1">1.4</span>.<span class="pl-c1">31</span>
$ <span class="pl-s1">pip</span> <span class="pl-s1">list</span> <span class="pl-c1">|</span> <span class="pl-s1">grep</span> <span class="pl-s1">greenlet</span>
<span class="pl-c"># no output</span></pre></div>
<h3 dir="auto">Error</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=".venv/lib/python3.10/site-packages/alembic/command.py:320: in upgrade
    script.run_env()
.venv/lib/python3.10/site-packages/alembic/script/base.py:563: in run_env
    util.load_python_file(self.dir, &quot;env.py&quot;)
.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py:92: in load_python_file
    module = load_module_py(module_id, path)
.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py:108: in load_module_py
    spec.loader.exec_module(module)  # type: ignore
migrations/env.py:86: in &lt;module&gt;
    asyncio.run(run_migrations_online())
../../../.pyenv/versions/3.10.2/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
../../../.pyenv/versions/3.10.2/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
migrations/env.py:71: in run_migrations_online
    engine_from_config(
.venv/lib/python3.10/site-packages/sqlalchemy/engine/create.py:755: in engine_from_config
    return create_engine(url, **options)
.venv/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py:309: in warned
    return fn(*args, **kwargs)
.venv/lib/python3.10/site-packages/sqlalchemy/engine/create.py:672: in create_engine
    event.listen(pool, &quot;connect&quot;, on_connect)
.venv/lib/python3.10/site-packages/sqlalchemy/event/api.py:115: in listen
    _event_key(target, identifier, fn).listen(*args, **kw)
.venv/lib/python3.10/site-packages/sqlalchemy/event/registry.py:232: in listen
    self.dispatch_target.dispatch._listen(self, *args, **kw)
.venv/lib/python3.10/site-packages/sqlalchemy/pool/events.py:63: in _listen
    event_key.base_listen(**kw)
.venv/lib/python3.10/site-packages/sqlalchemy/event/registry.py:270: in base_listen
    for_modify._set_asyncio()
.venv/lib/python3.10/site-packages/sqlalchemy/event/attr.py:274: in _set_asyncio
    self._exec_once_mutex = AsyncAdaptedLock()
.venv/lib/python3.10/site-packages/sqlalchemy/util/concurrency.py:67: in AsyncAdaptedLock
    _not_implemented()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def _not_implemented():
        # this conditional is to prevent pylance from considering
        # greenlet_spawn() etc as &quot;no return&quot; and dimming out code below it
        if have_greenlet:
            return None
    
        if not compat.py3k:
            raise ValueError(&quot;Cannot use this function in py2.&quot;)
        else:
&gt;           raise ValueError(
                &quot;the greenlet library is required to use this function.&quot;
                &quot; %s&quot; % greenlet_error
                if greenlet_error
                else &quot;&quot;
            )
E           ValueError: the greenlet library is required to use this function. No module named 'greenlet'

.venv/lib/python3.10/site-packages/sqlalchemy/util/concurrency.py:47: ValueError"><pre class="notranslate"><code class="notranslate">.venv/lib/python3.10/site-packages/alembic/command.py:320: in upgrade
    script.run_env()
.venv/lib/python3.10/site-packages/alembic/script/base.py:563: in run_env
    util.load_python_file(self.dir, "env.py")
.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py:92: in load_python_file
    module = load_module_py(module_id, path)
.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py:108: in load_module_py
    spec.loader.exec_module(module)  # type: ignore
migrations/env.py:86: in &lt;module&gt;
    asyncio.run(run_migrations_online())
../../../.pyenv/versions/3.10.2/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
../../../.pyenv/versions/3.10.2/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
migrations/env.py:71: in run_migrations_online
    engine_from_config(
.venv/lib/python3.10/site-packages/sqlalchemy/engine/create.py:755: in engine_from_config
    return create_engine(url, **options)
.venv/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py:309: in warned
    return fn(*args, **kwargs)
.venv/lib/python3.10/site-packages/sqlalchemy/engine/create.py:672: in create_engine
    event.listen(pool, "connect", on_connect)
.venv/lib/python3.10/site-packages/sqlalchemy/event/api.py:115: in listen
    _event_key(target, identifier, fn).listen(*args, **kw)
.venv/lib/python3.10/site-packages/sqlalchemy/event/registry.py:232: in listen
    self.dispatch_target.dispatch._listen(self, *args, **kw)
.venv/lib/python3.10/site-packages/sqlalchemy/pool/events.py:63: in _listen
    event_key.base_listen(**kw)
.venv/lib/python3.10/site-packages/sqlalchemy/event/registry.py:270: in base_listen
    for_modify._set_asyncio()
.venv/lib/python3.10/site-packages/sqlalchemy/event/attr.py:274: in _set_asyncio
    self._exec_once_mutex = AsyncAdaptedLock()
.venv/lib/python3.10/site-packages/sqlalchemy/util/concurrency.py:67: in AsyncAdaptedLock
    _not_implemented()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def _not_implemented():
        # this conditional is to prevent pylance from considering
        # greenlet_spawn() etc as "no return" and dimming out code below it
        if have_greenlet:
            return None
    
        if not compat.py3k:
            raise ValueError("Cannot use this function in py2.")
        else:
&gt;           raise ValueError(
                "the greenlet library is required to use this function."
                " %s" % greenlet_error
                if greenlet_error
                else ""
            )
E           ValueError: the greenlet library is required to use this function. No module named 'greenlet'

.venv/lib/python3.10/site-packages/sqlalchemy/util/concurrency.py:47: ValueError
</code></pre></div>
<h3 dir="auto">Versions</h3>
<ul dir="auto">
<li>OS: OS X 12.2</li>
<li>Python: 3.10</li>
<li>SQLAlchemy: 1.4.31</li>
<li>Database: not applicable</li>
<li>DBAPI not applicable</li>
</ul>
<h3 dir="auto">Additional context</h3>
<p dir="auto">The issue seems related to the way <code class="notranslate">platform.machine()</code> reports the underlying architecture, on Linux it reports <code class="notranslate">aarch64</code> and on OS X reports <code class="notranslate">arm64</code>, but the requirements contains only <code class="notranslate">aarch64</code> for <code class="notranslate">greenlet</code> <a href="https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4_31/setup.cfg#L44">https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4_31/setup.cfg#L44</a></p>