pypa / packaging-problems

An issue tracker for the problems in packaging
150 stars 35 forks source link

ERROR Backend operation failed: CalledProcessError(1, ... #533

Closed 0LL13 closed 3 years ago

0LL13 commented 3 years ago

Thank you for providing feedback on Python packaging!

To help us help you, please fill out as much of the following as you can. If a question is not relevant, feel free to skip it.

  1. What is your operating system and version? Ubuntu 20.04.2 LTS

  2. What is your Python version? Python 3.8.10 (default, Jun 2 2021, 10:49:15)

  3. What version of pip do you have? pip 20.1

  4. If following an online tutorial or guide, please provide a link to the page or section giving you trouble:

  1. Could you describe your issue in as much detail as possible? python3 -m build will result in the error "Backend operation failed ... "

This is what I get using setup.cfg:

Error report________________________________________________
Collecting wheel
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting setuptools>=42
  Using cached setuptools-57.1.0-py3-none-any.whl (818 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-57.1.0 wheel-0.36.2
Traceback (most recent call last):
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 387, in _parse_attr
    return getattr(StaticModule(module_name), attr_name)
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 24, in __init__
    spec = importlib.util.find_spec(name)
  File "/usr/lib/python3.8/importlib/util.py", line 94, in find_spec
    parent = __import__(parent_name, fromlist=['__path__'])
ModuleNotFoundError: No module named '0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py", line 280, in <module>
    main()
  File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py", line 263, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py", line 236, in build_sdist
    return backend.build_sdist(sdist_directory, config_settings)
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/build_meta.py", line 225, in build_sdist
    return self._build_with_temp_dir(['sdist', '--formats', 'gztar'],
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
    self.run_setup()
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 1, in <module>
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 121, in setup
    dist.parse_config_files()
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/dist.py", line 778, in parse_config_files
    parse_configuration(self, self.command_options,
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 157, in parse_configuration
    meta.parse()
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 463, in parse
    section_parser_method(section_options)
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 436, in parse_section
    self[name] = value
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 220, in __setitem__
    value = parser(value)
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 557, in _parse_version
    version = self._parse_attr(value, self.package_dir)
  File "/tmp/build-env-jj0wsygq/lib/python3.8/site-packages/setuptools/config.py", line 390, in _parse_attr
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named '0'
Traceback (most recent call last):
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/build-env-jj0wsygq/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpx60r4lzn']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/build/__init__.py", line 226, in build
    raise BuildBackendException('Backend operation failed: {!r}'.format(e))
build.BuildBackendException: Backend operation failed: CalledProcessError(1, ['/tmp/build-env-jj0wsygq/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpx60r4lzn'])

ERROR Backend operation failed: CalledProcessError(1, ['/tmp/build-env-jj0wsygq/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py',
_____________________________________________________________________________Error report end

Using setup.py will get me this:

Error report_______________________
Collecting setuptools>=42
  Using cached setuptools-57.1.0-py3-none-any.whl (818 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.1.0 wheel-0.36.2
running sdist
running egg_info
error: error in 'egg_base' option: 'src' does not exist or is not a directory
Traceback (most recent call last):
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/build-env-d79ohixd/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpiqphhdyv']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/build/__init__.py", line 226, in build
    raise BuildBackendException('Backend operation failed: {!r}'.format(e))
build.BuildBackendException: Backend operation failed: CalledProcessError(1, ['/tmp/build-env-d79ohixd/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpiqphhdyv'])

ERROR Backend operation failed: CalledProcessError(1, ['/tmp/build-env-d79ohixd/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpiqphhdyv'])
_________________________________________________________Error report end

I have this tree structure with persontitles being the project directory:

persontitles/
├── data
│   ├── academic_uk.txt
│   ├── academic_us1.txt
│   ├── academic_us2.txt
│   ├── academic_us.txt
│   ├── degrees.json
│   ├── english_jobtitles.txt
│   ├── __init__.py
│   └── salutations.txt
├── __pycache__
│   ├── academic_degrees.cpython-38.pyc
│   ├── academic_uk.cpython-38.pyc
│   ├── academic_us.cpython-38.pyc
│   ├── __init__.cpython-38.pyc
└── src
    ├── degrees
    │   ├── academic_degrees.py
    │   ├── academic_uk.py
    │   ├── academic_us.py
    │   └── __init__.py
    ├── __init__.py
    ├── jobs
    │   ├── gov_jobs.py
    │   ├── __init__.py
    │   └── job_titles.py
    ├── __pycache__
    │   ├── academic_degrees.cpython-38.pyc
    │   ├── academic_uk.cpython-38.pyc
    │   ├── academic_us.cpython-38.pyc
    │   ├── gov_jobs.cpython-38.pyc
    │   ├── __init__.cpython-38.pyc
    │   ├── job_titles.cpython-38.pyc
    ├── salutations
    │   ├── __init__.py
    │   └── salutations.py
    └── titles
        ├── __init__.py
        ├── peertitles.py
        └── rel_titles.py

This is the content of setup.cfg:

[metadata]
name = persontitles
version = attr: 0.2.7
author = Oliver Stapel
author_email = hardy.ecc95@gmail.com
url = https://github.com/0LL13/persontitles
description = Collections of academic degrees, job (and peer) titles, and salutations.
long_description = file: README.rst
keywords = person, titles, degrees
license = MIT

[metadata.classifiers]
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3.8
Operating System :: POSIX :: Linux
Topic :: Other/Nonlisted Topic

[options]
zip_safe = False
include_package_data = True
python_requires = >= 3.8
packages = find:
scripts =
    src/degrees/academic_austria.py
    src/degrees/academic_degrees.py
    src/degrees/academic_german_drtitel.py
    src/degrees/academic_german.py
    src/degrees/academic_uk.py
    src/degrees/academic_us.py
    src/jobs/gov_jobs.py
    src/jobs/job_titles.py
    src/titles/peertitles.py
    src/titles/rel_titles.py
    src/salutations/salutations.py

[options.package_data]
* = *.txt, *.json

I put a init.py file into my src directory

0LL13 commented 3 years ago

Same error if I put

[options]
package_dir=
    =src
packages=find:

[options.packages.find]
where=src

into setup.cfg

layday commented 3 years ago

You have an attr: directive in version even though it's a just a version string. It should be:

version = 0.2.7
0LL13 commented 3 years ago

@layday Thanks, I removed the attr: part -- error remains though.

layday commented 3 years ago

The error in your report is related to that. What error are you getting now?

layday commented 3 years ago

It doesn't appear to be your intention to have an "src" folder inside the "persontitles" package. You should place "degrees", "titles", etc. under "persontitles", and place "persontitles" itself in an "src" folder. You will also need to create an __init__.py in "persontitles" so that it's picked up as a package.

0LL13 commented 3 years ago

I changed a few things to reflect the new tree in setup.cfg - so here's the error:

error start___- Collecting setuptools>=42 Using cached setuptools-57.1.0-py3-none-any.whl (818 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.1.0 wheel-0.36.2 Traceback (most recent call last): File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py", line 280, in main() File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py", line 236, in build_sdist return backend.build_sdist(sdist_directory, config_settings) File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/build_meta.py", line 225, in build_sdist return self._build_with_temp_dir(['sdist', '--formats', 'gztar'], File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir self.run_setup() File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 1, in File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/usr/lib/python3.8/distutils/core.py", line 121, in setup dist.parse_config_files() File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/dist.py", line 778, in parse_config_files parse_configuration(self, self.command_options, File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/config.py", line 157, in parse_configuration meta.parse() File "/tmp/build-env-5owdhvww/lib/python3.8/site-packages/setuptools/config.py", line 459, in parse raise DistutilsOptionError( distutils.errors.DistutilsOptionError: Unsupported distribution option section: [metadata.classifiers] Traceback (most recent call last): File "/usr/lib/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/tmp/build-env-5owdhvww/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpdx59i6bk']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/build/init.py", line 226, in build raise BuildBackendException('Backend operation failed: {!r}'.format(e)) build.BuildBackendException: Backend operation failed: CalledProcessError(1, ['/tmp/build-env-5owdhvww/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpdx59i6bk'])

ERROR Backend operation failed: CalledProcessError(1, ['/tmp/build-env-5owdhvww/bin/python', '/home/sam/.local/share/virtualenvs/persontitles-3KTRLSQ8/lib/python3.8/site-packages/pep517/_in_process.py', 'build_sdist', '/tmp/tmpdx59i6bk']) _____end error

changed setup.cfg:

packages_dir= =persontitles packages = degrees jobs titles salutations scripts = src/persontitles/degrees/academic_degrees.py src/persontitles/degrees/academic_uk.py src/persontitles/degrees/academic_us.py src/persontitles/jobs/gov_jobs.py src/persontitles/jobs/job_titles.py src/persontitles/titles/peertitles.py src/persontitles/titles/rel_titles.py src/persontitles/salutations/salutations.py

0LL13 commented 3 years ago

new tree:

persontitles/ ├── data │   ├── academic_uk.txt │   ├── academic_us1.txt │   ├── academic_us2.txt │   ├── academic_us.txt │   ├── degrees.json │   ├── english_jobtitles.txt │   ├── init.py │   ├── peertitles.json │   └── salutations.txt └── src ├── persontitles │   ├── degrees │   │   ├── academic_degrees.py │   │   ├── academic_uk.py │   │   ├── academic_us.py │   │   └── init.py │   ├── init.py │   ├── jobs │   │   ├── gov_jobs.py │   │   ├── init.py │   │   └── job_titles.py │   ├── salutations │   │   ├── init.py │   │   └── salutations.py │   └── titles │   ├── init.py │   ├── peertitles.py │   └── rel_titles.py

... with persontitles being a subdir of src

merwok commented 3 years ago

Two things look strange to me:

0LL13 commented 3 years ago

@merwok To be frank, I have no idea how to do that. I used setup.py before and it worked for the first 10 or so versions. How do I configure the layout? Like this? packages_dir= =src/persontitles

I removed the "scripts" section from setup.cfg and changed the packages_dir to src/persontitles but still no success.

0LL13 commented 3 years ago

@merwok So I thought about your remarks and changed the layout and after some rewriting of imports and stuff it finally worked! Thank you for giving me the right thing to look at!