Its the first time that I have to use the content of an old git repository in the one that I'm actually working. I decided to try to create a Python Package of it to import in the new as a library (I am using gitlab).
I've searched info to do it but it is so hard to find a consistent solution.
I've first tried to build the package locally, by executing:
python setup.py bdist_wheel
And then:
python3 -m build
The package should build dependencies for wheel, but it crashes when trying to find the requirements.txt file.
I see previously that the command writes the egg-info files, creates the package, and copies files from local to the package:
(venv) acivit@odin:~/projects/mechanized-number-recognition$ python3 -m build
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting build dependencies for sdist...
running egg_info
writing acivit.mechanized_number_recognition.egg-info/PKG-INFO
writing dependency_links to acivit.mechanized_number_recognition.egg-info/dependency_links.txt
writing requirements to acivit.mechanized_number_recognition.egg-info/requires.txt
writing top-level names to acivit.mechanized_number_recognition.egg-info/top_level.txt
reading manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing acivit.mechanized_number_recognition.egg-info/PKG-INFO
writing dependency_links to acivit.mechanized_number_recognition.egg-info/dependency_links.txt
writing requirements to acivit.mechanized_number_recognition.egg-info/requires.txt
writing top-level names to acivit.mechanized_number_recognition.egg-info/top_level.txt
reading manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
running check
creating acivit.mechanized_number_recognition-0.0.3
creating acivit.mechanized_number_recognition-0.0.3/config
creating acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
creating acivit.mechanized_number_recognition-0.0.3/models
creating acivit.mechanized_number_recognition-0.0.3/utils
creating acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
copying files to acivit.mechanized_number_recognition-0.0.3...
copying LICENSE.md -> acivit.mechanized_number_recognition-0.0.3
copying README.md -> acivit.mechanized_number_recognition-0.0.3
copying setup.py -> acivit.mechanized_number_recognition-0.0.3
copying config/__init__.py -> acivit.mechanized_number_recognition-0.0.3
copying config/modules_config.py -> acivit.mechanized_number_recognition-0.0.3/config
copying acivit.mechanized_number_recognition.egg-info/PKG-INFO -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/SOURCES.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/dependency_links.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/not-zip-safe -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/requires.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/top_level.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying models/__init__.py -> acivit.mechanized_number_recognition-0.0.3/models
copying models/common.py -> acivit.mechanized_number_recognition-0.0.3/models
copying models/experimental.py -> acivit.mechanized_number_recognition-0.0.3/models
copying models/yolo.py -> acivit.mechanized_number_recognition-0.0.3/models
copying utils/__init__.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/activations.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/add_nms.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/autoanchor.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/camera.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/datasets.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/general.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/google_utils.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/loss.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/metrics.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/plots.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/py_save.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/torch_utils.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/wandb_logging/__init__.py -> acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
copying utils/wandb_logging/log_dataset.py -> acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
copying utils/wandb_logging/wandb_utils.py -> acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
Writing acivit.mechanized_number_recognition-0.0.3/setup.cfg
Creating tar archive
removing 'acivit.mechanized_number_recognition-0.0.3' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting build dependencies for wheel...
Traceback (most recent call last):
File "/home/acivit/projects/mechanized-number-recognition/venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/acivit/projects/mechanized-number-recognition/venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/acivit/projects/mechanized-number-recognition/venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/build-env-6rchc20e/lib/python3.8/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/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/tmp/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 484, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 6, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
The project structure is:
MechanizedNumberPackage
README requirements.txt utils config models main.py
The setup.py file:
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("requirements.txt", "r") as fh:
install_requires = fh.read()
setuptools.setup(
name="acivit.mechanized_number_recognition",
version="0.0.3",
author="Acivit",
description="`System to detect the Mechanized Number",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://gitlab.com/acivit/project/ai_systems/mechanized-number-recognition",
# Disable zip_safe to allow compatibility with mypy.
# See: https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages
zip_safe=False,
package_data={"mechanized_number_recognition": ["py.typed"]},
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
install_requires=install_requires,
)
Any idea why this happens? Or any other method to build the package?
Thanks
Making a wild guess that your MANIFEST.in
does not have requirements.txt in include
.. something like this:
include *.md LICENSE requirements.txt CHANGELOG