NicolasHug / Surprise

A Python scikit for building and analyzing recommender systems
http://surpriselib.com
BSD 3-Clause "New" or "Revised" License
6.42k stars 1.02k forks source link

How to remove NumPy installation in setup.py #466

Closed tpian928 closed 6 months ago

tpian928 commented 1 year ago

Description

When trying to build a wheel, an error occurred during the process of getting requirements. The error message indicates that the installation of NumPy is causing the problem, which is believed to be caused by the installation code in setup.py. It is suggested to remove related code in setup.py such as dist.Distribution().fetch_build_eggs(["numpy>=1.17.3"]) and install NumPy through requirements.txt instead. As the user is not sure how to solve this issue, they are seeking advice on whether it is possible to remove the code in setup.py and how to do so. The user has also checked issue #447 for similar issues but has not found a working solution.

  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      <string>:65: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
      /usr/share/pyenv/versions/3.9.16/bin/python3.9: No module named pip
      Traceback (most recent call last):
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/installer.py", line 96, in _fetch_build_egg_no_warn
          subprocess.check_call(cmd)
        File "/usr/share/pyenv/versions/3.9.16/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/share/pyenv/versions/3.9.16/bin/python3.9', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpuf06aqtw', '--quiet', 'numpy>=1.17.3']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "/usr/share/pyenv/versions/3.9.16/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/share/pyenv/versions/3.9.16/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/share/pyenv/versions/3.9.16/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 65, in <module>
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/pkg_resources/__init__.py", line 827, in resolve
          dist = self._resolve_dist(
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1133, in best_match
          return self.obtain(req, installer)
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1145, in obtain
          return installer(requirement)
        File "/tmp/pip-build-env-9vlro0sa/overlay/lib/python3.9/site-packages/setuptools/installer.py", line 98, in _fetch_build_egg_no_warn
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/usr/share/pyenv/versions/3.9.16/bin/python3.9', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpuf06aqtw', '--quiet', 'numpy>=1.17.3']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Steps/Code to Reproduce

Start building a wheel Observe the error message during the process of getting requirements

Expected Results

The requirements should be successfully obtained, and the wheel should be built without any issue. Actual Results An error occurred during the process of getting requirements. The error message suggests that the installation of NumPy is causing the problem, which is believed to be caused by the installation code in setup.py.

Versions

Python version: 3.9.6 Surprise version: 1.1.3

joaomiguelol commented 1 year ago

Any updates on this error?

jujujizi commented 1 year ago

Any updates on this error?

post2web commented 1 year ago

+1

arunkhattri commented 10 months ago

+1

NicolasHug commented 6 months ago

Hi all, thanks for the report. This should be fixed with the v1.1.4 that I just released today. I'll close this issue but please open another one if you are still experiencing installation issues.