rom1504 / embedding-reader

Efficiently read embedding in streaming from any filesystem
MIT License
92 stars 19 forks source link

1.7.0 published tarball does not include requirements.txt #47

Open charles-dyfis-net opened 7 months ago

charles-dyfis-net commented 7 months ago

The file https://files.pythonhosted.org/packages/source/e/embedding-reader/embedding_reader-1.7.0.tar.gz with sha256 ff07f7a3534860e69af9b585031bbd1b992e2b4105a47b7f9b471d68acd1bffb does not include a requirements.txt file, but its setup.py tries to read one:

python3.12-embedding-reader> Processing /private/tmp/nix-build-python3.12-embedding-reader-1.7.0.drv-0/embedding_reader-1.7.0
python3.12-embedding-reader>   Running command python setup.py egg_info
python3.12-embedding-reader>   Traceback (most recent call last):
python3.12-embedding-reader>     File "<string>", line 2, in <module>
python3.12-embedding-reader>     File "<pip-setuptools-caller>", line 34, in <module>
python3.12-embedding-reader>     File "/private/tmp/nix-build-python3.12-embedding-reader-1.7.0.drv-0/embedding_reader-1.7.0/setup.py", line 14, in <module>
python3.12-embedding-reader>       REQUIREMENTS = _read_reqs("requirements.txt")
python3.12-embedding-reader>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-embedding-reader>     File "/private/tmp/nix-build-python3.12-embedding-reader-1.7.0.drv-0/embedding_reader-1.7.0/setup.py", line 11, in _read_reqs
python3.12-embedding-reader>       with open(fullpath) as f:
python3.12-embedding-reader>            ^^^^^^^^^^^^^^
python3.12-embedding-reader>   FileNotFoundError: [Errno 2] No such file or directory: '/private/tmp/nix-build-python3.12-embedding-reader-1.7.0.drv-0/embedding_reader-1.7.0/requirements.txt'
python3.12-embedding-reader>   error: subprocess-exited-with-error
python3.12-embedding-reader>   × python setup.py egg_info did not run successfully.
python3.12-embedding-reader>   │ exit code: 1
python3.12-embedding-reader>   ╰─> See above for output.
rom1504 commented 7 months ago

hi, how are you installing it? I just tried pip install embedding-reader and it seems to work

charles-dyfis-net commented 7 months ago

Right -- installing from the wheel is fine, installing from the source tarball is not. (I'm using poetry2nix, which prefers the source tarball by default).

charles-dyfis-net commented 7 months ago

...that said, the problem can be reproduced with pip if you force it to use the tarball; note --no-binary :all: below:

$ pip install --no-binary :all: embedding-reader
  Downloading embedding_reader-1.7.0.tar.gz (14 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "/run/user/1000/tmp/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/run/user/1000/tmp/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/run/user/1000/tmp/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/run/user/1000/pip-build-env-dok27ny3/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/run/user/1000/pip-build-env-dok27ny3/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/run/user/1000/pip-build-env-dok27ny3/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/run/user/1000/pip-build-env-dok27ny3/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 14, in <module>
        File "<string>", line 11, in _read_reqs
      FileNotFoundError: [Errno 2] No such file or directory: '/run/user/1000/pip-install-hfl_y4yy/embedding-reader_5ea71c8fc6db43de81923f2a93730a87/requirements.txt'
      [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.
charles-dyfis-net commented 7 months ago

To propose a fix:

diff --git a/setup.py b/setup.py
index 4708b4a..d3a2492 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ if __name__ == "__main__":
         author="Romain Beaumont",
         author_email="romain.rom1@gmail.com",
         url="https://github.com/rom1504/embedding-reader",
-        data_files=[(".", ["README.md"])],
+        data_files=[(".", ["README.md", "requirements.txt"])],
         keywords=["machine learning"],
         install_requires=REQUIREMENTS,
         classifiers=[
charles-dyfis-net commented 7 months ago

Strike that, actually; having the README.md in data_files is itself a problem (we're getting the README installed into the destination tree, not just the source tarball). I'm going to poke at this and try to come back with a better solution.

charles-dyfis-net commented 7 months ago

Better:

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..b2672cc
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include README.md requirements.txt
diff --git a/setup.py b/setup.py
index 4708b4a..1bdbadf 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,6 @@ if __name__ == "__main__":
         author="Romain Beaumont",
         author_email="romain.rom1@gmail.com",
         url="https://github.com/rom1504/embedding-reader",
-        data_files=[(".", ["README.md"])],
         keywords=["machine learning"],
         install_requires=REQUIREMENTS,
         classifiers=[