Reputation: 1961
I have configured my files according to the PyPi documentation for building a pip package and it worked once to build when I was creating my test server package. I made a couple of changes and am now trying to build again, but it is failing with the following error
Found existing installation: setuptools 44.0.0
Uninstalling setuptools-44.0.0:
Successfully uninstalled setuptools-44.0.0
Collecting setuptools>=42
Using cached setuptools-57.4.0-py3-none-any.whl (819 kB)
Collecting wheel
Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: setuptools, wheel
Successfully installed setuptools-57.4.0 wheel-0.36.2
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pep517/in_process/_in_process.py", line 349, in <module>
main()
File "/usr/local/lib/python3.8/dist-packages/pep517/in_process/_in_process.py", line 331, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.8/dist-packages/pep517/in_process/_in_process.py", line 284, in get_requires_for_build_sdist
return hook(config_settings)
File "/tmp/build-env-s1i_b_fr/lib/python3.8/site-packages/setuptools/build_meta.py", line 159, in get_requires_for_build_sdist
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/build-env-s1i_b_fr/lib/python3.8/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires
self.run_setup()
File "/tmp/build-env-s1i_b_fr/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 19, in <module>
packages=setuptools.find_packages(where="ontology_processing"),
NameError: name 'setuptools' is not defined
ERROR Backend subproccess exited when trying to invoke get_requires_for_build_sdist
I already have setup tools in both my pyproject.toml
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
and included it in my setup.py file
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="ontology_processing",
version="1.0.0",
description="Climate Mind ontology processing code.",
author="ClimateMind",
author_email="[email protected]",
url="https://github.com/ClimateMind/climatemind-ontology-processing",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
package_dir={"": "src"},
packages=setuptools.find_packages(where="ontology_processing"),
python_requires=">=3.6",
)
I've tried changing the versions of setuptools, but nothing has worked so far. I don't understand why this worked once, but is no longer working. Any suggestions are appreciated.
Upvotes: 2
Views: 2325
Reputation: 1
I had the same error, but it was due to the inline comments I had written in the setup.cfg
file.
Upvotes: 0
Reputation: 1961
Okay I screwed up.
At the top I have
from setuptools import setup, find_packages
but I am not importing setuptools itself
Upvotes: 2