Alembic: Alembic 1.4.2 breaks pip-compile

Created on 3 Jul 2020  路  4Comments  路  Source: sqlalchemy/alembic

Describe the bug

I use pip-compile to pin the versions.

To Reproduce

  • pip install pip-tools==5.2.1
  • Create an empty directory, put a requirements.in with alembic==1.4.2 as the only content in it
  • Switch in that directory and execute pip-compile

Expected behavior

With alembic==1.4.1 I get the following requirements.txt. I expected something similar:

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile
#
alembic==1.4.1            # via -r requirements.in
mako==1.1.3               # via alembic
markupsafe==1.1.1         # via mako
python-dateutil==2.8.1    # via alembic
python-editor==1.0.4      # via alembic
six==1.15.0               # via python-dateutil
sqlalchemy==1.3.18        # via alembic

Error

$ pip-compile
    ERROR: Command errored out with exit status 1:
     command: /home/math/.pyenv/versions/3.8.1/bin/python3.8 /home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-27xtrkc1/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
         cwd: None
    Complete output (44 lines):
    Traceback (most recent call last):
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 193, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/__main__.py", line 26, in <module>
        sys.exit(_main())
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
        command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
        module = importlib.import_module(module_path)
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 783, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
        from pip._internal.cli.req_command import RequirementCommand, with_cleanup
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 16, in <module>
        from pip._internal.index.package_finder import PackageFinder
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 21, in <module>
        from pip._internal.index.collector import parse_links
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 14, in <module>
        from pip._vendor import html5lib, requests
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_vendor/requests/__init__.py", line 114, in <module>
        from . import utils
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_vendor/requests/utils.py", line 25, in <module>
        from . import certs
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_vendor/requests/certs.py", line 15, in <module>
        from pip._vendor.certifi import where
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_vendor/certifi/__init__.py", line 1, in <module>
        from .core import contents, where
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_vendor/certifi/core.py", line 12, in <module>
        from importlib.resources import read_text
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/importlib/resources.py", line 11, in <module>
        from typing import Iterable, Iterator, Optional, Set, Union   # noqa: F401
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/typing.py", line 1357, in <module>
        class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
      File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/typing.py", line 1005, in __new__
        self._abc_registry = extra._abc_registry
    AttributeError: type object 'Callable' has no attribute '_abc_registry'
    ----------------------------------------
Traceback (most recent call last):
  File "/home/math/.pyenv/versions/3.8.1/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/home/math/.local/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/math/.local/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/math/.local/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/math/.local/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/math/.local/lib/python3.8/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/scripts/compile.py", line 444, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/resolver.py", line 169, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/resolver.py", line 274, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/resolver.py", line 380, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/repositories/local.py", line 74, in get_dependencies
    return self.repository.get_dependencies(ireq)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/repositories/pypi.py", line 228, in get_dependencies
    self._dependencies_cache[ireq] = self.resolve_reqs(
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/piptools/repositories/pypi.py", line 181, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 487, in prepare_linked_requirement
    abstract_dist = _get_prepared_distribution(
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 91, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py", line 38, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py", line 66, in _setup_isolation
    self.req.build_env.install_requirements(
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/build_env.py", line 199, in install_requirements
    call_subprocess(args, spinner=spinner)
  File "/home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py", line 241, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /home/math/.pyenv/versions/3.8.1/bin/python3.8 /home/math/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-27xtrkc1/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

Versions.

  • OS: Ubuntu 18.04
  • Python: 3.8.1 (pyenv)
  • Alembic: --
  • SQLAlchemy: --
  • Database: --
  • DBAPI: --

Additional context

Have a nice day!

duplicate installation

Most helpful comment

also alembic 1.4.3 will ensure the pyproject.toml file is not part of the installation tar.gz.

All 4 comments

hi there -

please ensure your tool uses --no-use-pep517 for the installation, this will workaround the bug in pip-tools / pip.

the "bug" is not in Alembic, it's in the installation ecosystem that is having trouble adapting to pep 517. as alembic 1.4.2 includes a blank pyproject.toml file, pep-517 mode is turned on implicitly for pip.

see #672 .

also alembic 1.4.3 will ensure the pyproject.toml file is not part of the installation tar.gz.

alembic 1.4.3 has removed the pyproject.toml from the pypi archive, so the issue should be solved.

please reopen if it still happens

Was this page helpful?
0 / 5 - 0 ratings

Related issues

am17torres picture am17torres  路  7Comments

cozos picture cozos  路  5Comments

sqlalchemy-bot picture sqlalchemy-bot  路  9Comments

rjaduthie picture rjaduthie  路  9Comments

Ahtii picture Ahtii  路  8Comments