scicloj / scicloj.ml.top2vec

Use top2vec model from Clojure
Eclipse Public License 1.0
4 stars 0 forks source link

Docker build no longer works due to numpy package specification #1

Open respatialized opened 8 months ago

respatialized commented 8 months ago

Problem context + description

Attempting to install dependencies for top2vec ran me into a plethora of issues with my current platform. I wanted to use the provided Dockerfile to isolate my system from these issues, but I cannot reproduce the build.

Environment

System: M2 MacBook, Ventura Docker context: colima container runtime (v0.6.8), Docker (25.0.3), installed via Homebrew and running locally.

Reproducing the problem

Assuming both the Dockerfile and requirements.txt are in the working directory, run the following:

docker build --no-cache --build-arg GROUP_ID=230 --build-arg=USER_ID=230 -t scicloj.ml.top2vec:latest .

On my system, it produces the following error when installing gensim:

Collecting gensim==3.8.3 (from -r requirements.txt (line 13))
  Downloading gensim-3.8.3.tar.gz (23.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.4/23.4 MB 21.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      running dist_info
      creating /tmp/pip-modern-metadata-ls4wh7_z/gensim.egg-info
      writing /tmp/pip-modern-metadata-ls4wh7_z/gensim.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-modern-metadata-ls4wh7_z/gensim.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-modern-metadata-ls4wh7_z/gensim.egg-info/requires.txt
      writing top-level names to /tmp/pip-modern-metadata-ls4wh7_z/gensim.egg-info/top_level.txt
      writing manifest file '/tmp/pip-modern-metadata-ls4wh7_z/gensim.egg-info/SOURCES.txt'
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/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/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 367, in <module>
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/command/dist_info.py", line 90, in run
          self.egg_info.run()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 321, in run
          self.find_sources()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 329, in find_sources
          mm.run()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 550, in run
          self.add_defaults()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/command/sdist.py", line 102, in add_defaults
          super().add_defaults()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 335, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "/tmp/pip-build-env-dhymu7ln/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
          self.finalize_options()
        File "<string>", line 111, in finalize_options
      AttributeError: 'dict' object has no attribute '__NUMPY_SETUP__'
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The command '/bin/sh -c unbuffer pip3 install -r requirements.txt' returned a non-zero code: 1

As far as I can tell from reading this issue on the gensim tracker, a change to the way python dependencies are specified has broken compatibility across python versions. Fixing it may involve adding a pyproject.toml file, but I am not clear on the details.

behrica commented 8 months ago

I confirm, I get the same. Not sure why we get it know, and did not get it in the past, as I thought I freeze all package version in requirement.txt