setuptools: Trouble with the packaging tutorial (Exit Speed)
OS version
Raspbian GNU/Linux 10 (buster)
Python version
Python 3.7
Pip version
pip 21.3.1
Guide link
https://packaging.python.org/tutorials/packaging-projects
Problem description
I’m attempting to package the project I’ve been working at https://github.com/djhedges/exit_speed.
This commit shows the pyproject.toml and setup.cfg I wrote as well as the directory structure. https://github.com/djhedges/exit_speed/commit/7e0dd6f39e2ba2187c6c6aae217067b7139268d3#diff-fa602a8a75dc9dcc92261bac5f533c2a85e34fcceaff63b3a3a81d9acde2fc52
I even created a symlink to mimic the src/package layout from the documentation. I also tried setting package_dir and options.packages.find to exit_speed
and .
with no luck.
ls -l src/exit_speed
lrwxrwxrwx 1 pi pi 13 Jan 16 09:59 src/exit_speed -> ../exit_speed
ls -l src/exit_speed/__init__.py
-rwxr-xr-x 1 pi pi 668 Jan 16 09:53 src/exit_speed/__init__.py
pyproject.toml
cat pyproject.toml
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
setup.cfg
[metadata]
name = exit_speed
description = Race car telemetry with a Raspberry Pi
version = attr:exit_speed.__version__
author = Douglas Hedges
author_email = djhedges+exit-speed@gmail.com
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/djhedges/exit_speed
project_urls =
Travis CL = https://app.travis-ci.com/github/djhedges/exit_speed
classifiers =
Programming Language :: Python :: 3,
Programming Language :: Python :: 3.7,
License :: OSI Approved :: Apache Software License,
package_dir =
= src
packages = find:
python_requires = >=3.7
[options.packages.find]
where = src
I’m sure I’m overlooking something silly but any help would be appreciated.
Error message
pi@exitspeed:~/git/exit_speed $ python3 -m build
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools>=42, wheel)
* Getting dependencies for sdist...
running egg_info
writing manifest file 'exit_speed.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing manifest file 'exit_speed.egg-info/SOURCES.txt'
running check
creating exit_speed-2022.1.16
creating exit_speed-2022.1.16/exit_speed.egg-info
copying LICENSE -> exit_speed-2022.1.16
copying README.md -> exit_speed-2022.1.16
copying pyproject.toml -> exit_speed-2022.1.16
copying setup.cfg -> exit_speed-2022.1.16
copying exit_speed.egg-info/PKG-INFO -> exit_speed-2022.1.16/exit_speed.egg-info
copying exit_speed.egg-info/SOURCES.txt -> exit_speed-2022.1.16/exit_speed.egg-info
copying exit_speed.egg-info/dependency_links.txt -> exit_speed-2022.1.16/exit_speed.egg-info
copying exit_speed.egg-info/top_level.txt -> exit_speed-2022.1.16/exit_speed.egg-info
Creating tar archive
removing 'exit_speed-2022.1.16' (and everything under it)
* Building wheel from sdist
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools>=42, wheel)
* Getting dependencies for wheel...
Traceback (most recent call last):
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 419, in _parse_attr
return getattr(StaticModule(module_name), attr_name)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 27, in __init__
with open(spec.origin) as strm:
AttributeError: 'NoneType' object has no attribute 'origin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/home/pi/.local/lib/python3.7/site-packages/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/pi/.local/lib/python3.7/site-packages/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/build_meta.py", line 163, in get_requires_for_build_wheel
config_settings, requirements=['wheel'])
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 1, in <module>
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 122, in setup
dist.parse_config_files()
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/_virtualenv.py", line 21, in parse_config_files
result = old_parse_config_files(self, *args, **kwargs)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/dist.py", line 805, in parse_config_files
self, self.command_options, ignore_option_errors=ignore_option_errors
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 158, in parse_configuration
meta.parse()
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 498, in parse
section_parser_method(section_options)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 469, in parse_section
self[name] = value
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 222, in __setitem__
value = parser(value)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 599, in _parse_version
version = self._parse_attr(value, self.package_dir)
File "/tmp/build-env-trakv3e2/lib/python3.7/site-packages/setuptools/config.py", line 422, in _parse_attr
module = importlib.import_module(module_name)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'exit_speed'
ERROR Backend subproccess exited when trying to invoke get_requires_for_build_wheel
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (11 by maintainers)
Commits related to this issue
- Add a MANIFEST.in per suggestions from https://github.com/pypa/setuptools/issues/3030 — committed to djhedges/exit_speed by deleted user 2 years ago
- Ensure [options] is included in setup.cfg and drop the MANIFEST.in per https://github.com/pypa/setuptools/issues/3030#issuecomment-1014274774 — committed to djhedges/exit_speed by deleted user 2 years ago
Haha, I had a feeling I was doing something silly. Thanks for your help! That indeed was the needed fix.