benfred / implicit

Fast Python Collaborative Filtering for Implicit Feedback Datasets
https://benfred.github.io/implicit/
MIT License
3.57k stars 612 forks source link

Is it possible to release a v0.4.9 patch with `setuptools<65` pinned? #606

Closed deepyaman closed 2 years ago

deepyaman commented 2 years ago

Setuptools 65 includes a breaking change that affects implicit~=0.4.8.

It results in the following error in our (private) build that depends on implicit~=0.4.8:

    ERROR: Command errored out with exit status 1:
     command: /miniconda/envs/customerone/bin/python /miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmph23uf8h2
         cwd: /tmp/pip-resolver-kkp80k4s/implicit
    Complete output (19 lines):
    Traceback (most recent call last):
      File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
        main()
      File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 117, in get_requires_for_build_wheel
        return hook(config_settings)
      File "/tmp/pip-build-env-ns_s7r6x/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
        return self._get_build_requires(config_settings, requirements=['wheel'])
      File "/tmp/pip-build-env-ns_s7r6x/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
        self.run_setup()
      File "/tmp/pip-build-env-ns_s7r6x/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 483, in run_setup
        self).run_setup(setup_script=setup_script)
      File "/tmp/pip-build-env-ns_s7r6x/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 335, in run_setup
        exec(code, locals())
      File "<string>", line 10, in <module>
      File "/tmp/pip-resolver-kkp80k4s/implicit/cuda_setup.py", line 6, in <module>
        from distutils import ccompiler, errors, msvccompiler, unixccompiler
    ImportError: cannot import name 'msvccompiler' from 'distutils' (/tmp/pip-build-env-ns_s7r6x/overlay/lib/python3.7/site-packages/setuptools/_distutils/__init__.py)
    ----------------------------------------
Traceback (most recent call last):
  File "/miniconda/envs/customerone/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/scripts/compile.py", line 466, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/resolver.py", line 175, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/resolver.py", line 319, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/resolver.py", line 428, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/repositories/local.py", line 79, in get_dependencies
    return self.repository.get_dependencies(ireq)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 248, in get_dependencies
    download_dir, ireq, wheel_cache
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 210, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 370, in _resolve_one
    dist = self._get_dist_for(req_to_install)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 323, in _get_dist_for
    dist = self.preparer.prepare_linked_requirement(req)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 508, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 571, in _prepare_linked_requirement
    req, self.req_tracker, self.finder, self.build_isolation,
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 60, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/distributions/sdist.py", line 34, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/distributions/sdist.py", line 88, in _setup_isolation
    reqs = backend.get_requires_for_build_wheel()
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/wrappers.py", line 169, in get_requires_for_build_wheel
    'config_settings': config_settings
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/wrappers.py", line 321, in _call_hook
    extra_environ=extra_environ
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 278, in runner
    spinner=spinner,
  File "/miniconda/envs/customerone/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 244, in call_subprocess
    raise InstallationSubprocessError(proc.returncode, command_desc)
pip._internal.exceptions.InstallationSubprocessError: Command errored out with exit status 1: /miniconda/envs/customerone/bin/python /miniconda/envs/customerone/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmph23uf8h2 Check the logs for full command output.

Exited with code exit status 1
CircleCI received exit code 1

I was able to circumvent the issue by pinning to a commit on a fork: https://github.com/benfred/implicit/compare/v0.4.8...deepyaman:implicit:v0.4.9

Is it possible to release a v0.4.9 patch with setuptools<65 pinned (doing something like the above; you may have a more elegant solution for including cuda_setup)? I appreciate that it's an old release, and the team will look into upgrading in the meantime, but this would be super helpful. :)

benfred commented 2 years ago

Ouch - thats unfortunate. I hadn't even specified that setuptools was a dependency in v0.48 =( (though it is in the latest version, since we moved to skbuild for building)

Can you install by doing something like pip install implicit==0.4.8 setuptools\<65 ?

deepyaman commented 2 years ago

Can you install by doing something like pip install implicit==0.4.8 setuptools\<65 ?

Let me test on our build and get back to you!

deepyaman commented 2 years ago

@benfred Thanks, that worked! Much simpler. :)