Skip to content

greenlet is not installed on Apple M1 #7714

@expobrain

Description

@expobrain

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    armissue related to the arm architectureexpected behaviorthat's how it's meant to work. consider the "documentation" label in additionmacOSplatform-specific issues and questions relating to macOSsetupissues related to installation and setupthird party integration issuesissues to do with other libraries and frameworks

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions