Issue 1:
Describe the bug

If we take a look into master of sqlalchemy it defines following install_requires:

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'))))))

Thus because platform_machine is not one of the above, greenlet is never installed. I was told that platform_machine for such macos is arm64 (I do not have Mac M1 at hand)

This in effect prevents sqlalchemy from running.

Fix is easy by pip install greenlet and then everything is back to normal.

To Reproduce

$ pip install sqlalchemy[asyncio]

$ pip show

SQLAlchemy==1.4.35

While it should be:

$ pip show

greenlet==1.1.2
SQLAlchemy==1.4.35

Error

N/A

Versions

OS: MacOS

Python: Python3.9+

SQLAlchemy: SQLAlchemy = {version = "^1.4.35", extras = ["asyncio"]}

Database: Postgres

DBAPI (eg: psycopg, cx_oracle, mysqlclient): postgresql+asyncpg

Additional context

No response

Issue 2:
Describe the bug

When installing SQLAlchemy 1.4.x with the asyncio extra on a Apple M1 machine the greenlet package is not installed even if it's listed in the requirements and for aarch64 architectures.

To Reproduce

# 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

Error

.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 <module>
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:
> 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

Versions

OS: OS X 12.2

Python: 3.10

SQLAlchemy: 1.4.31

Database: not applicable

DBAPI not applicable

Additional context

The issue seems related to the way platform.machine() reports the underlying architecture, on Linux it reports aarch64 and on OS X reports arm64, but the requirements contains only aarch64 for greenlet https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4_31/setup.cfg#L44