Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.7.0 published tarball does not include requirements.txt #47

Open
charles-dyfis-net opened this issue Jan 22, 2024 · 6 comments · May be fixed by #48
Open

1.7.0 published tarball does not include requirements.txt #47

charles-dyfis-net opened this issue Jan 22, 2024 · 6 comments · May be fixed by #48

Comments

@charles-dyfis-net
Copy link

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
Copy link
Owner

rom1504 commented Jan 22, 2024

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

@charles-dyfis-net
Copy link
Author

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
Copy link
Author

charles-dyfis-net commented Jan 22, 2024

...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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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=[

charles-dyfis-net added a commit to charles-dyfis-net/embedding-reader that referenced this issue Jan 23, 2024
Fixes rom1504#47.

- `requirements.txt` being missing from the source tarball meant that this package was only possible to install from the wheel, not from the sdist; one can reproduce the problem by using `--no-binary :all:` as an argument to `pip`.
- Adding `README.md` to `data_files` meant that it was installed into site-packages instead of only being added to the source tarball; being at the root, it conflicted with any _other_ Python package trying to install a README.md when using a package manager that tracks such conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants