Opened 3 weeks ago

Last modified 3 weeks ago

#19262 assigned defect

bundle_builder_toml.py should raise an error to help debug build failures

Reported by: Tom Goddard Owned by: Zach Pearson
Priority: moderate Milestone: 1.11
Component: Build System Version:
Keywords: Cc: rohou.alexis@…, tcroll@…, Eric Pettersen
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Alexis Rohou was trying to build Clipper and an error caused it to fail but that error was suppressed and a confusing later error then made it hard to debug. Below Tristan and Alexis figured out where the error is being suppressed and suggest it should raise an error immediately so the problem can be more easily debugged.

From Alexis:

Tristan (CCed) worked out change that revealed the actual exception. In file bundle_builder_toml.py, after line 788, he added the raises below, which revealed that the exception was due to a missing src/docs directory:

except Exception:

raise
traceback.print_exc()
return None, False

except SystemExit:

raise
return None, False

Hope this helps. Tom is CCed just in case.

Cheers,
Alexis

On Tue, Oct 28, 2025 at 3:50 PM Zach Pearson <zjp@…> wrote:
Hi Alexis,

I have a local copy of the Clipper repo. I just pulled and tried to build it with my developer build of ChimeraX, which would have worked except I forgot to adjust the version of the ChimeraX-Core dependency.

How recent is your checkout? TOML bundle builder would throw that error if there was no version specified in the pyproject.toml file, or if you have “version” in project.dynamic and there is no version in src/init.py (or if it’s there but it’s not the first uncommented line).

— Zach

On 28 Oct 2025, at 15:43, Alexis Rohou <rohou.alexis@…> wrote:

Hi Zach,

Trying to build clipper from source and at the last stage, packaging, hitting the following error -what do you recommend?

Traceback (most recent call last):

File "/Users/rohoua/work/git/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/devel.py", line 180, in _run

unbound_method(bb, *args, kw)

File "/Users/rohoua/work/git/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/bundle_builder/bundle_builder_toml.py", line 564, in make_wheel

self.build_wheel(debug=debug, release=release)

File "/Users/rohoua/work/git/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/bundle_builder/bundle_builder_toml.py", line 878, in build_wheel

self.version = dist.get_version()


AttributeError: 'NoneType' object has no attribute 'get_version'

--
Alexis Rohou

Change History (2)

comment:1 by Zach Pearson, 3 weeks ago

Cc: Eric Pettersen added

I silenced SystemExit, which is raised on a compiler error, at Eric's request. I'm not sure what the context was anymore (I should be writing more detailed commit message bodies).

Do you remember, Eric?

comment:2 by Eric Pettersen, 3 weeks ago

It was because of this:

Not long ago, when compiling my C++ parser extension to core, any C++ errors were obvious because they were very close to the end of the output. Recently, the errors are now followed by many other useless Python bundle-builder tracebacks, forcing me to scroll several pages back to find the "real" error (and very much misleading me the first time it happened). Is there anything we can do to reduce the extraneous traceback output?

I've added an example of the output below.

--Eric

building 'chimerax.core._spec_parser' extension
creating build/temp.macosx-10.9-universal2-cpython-311/core_cpp/spec_parser
clang++ -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -I/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/include -I/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -I/Users/pett/src/chimerax/ChimeraX.app/Contents/include/python3.11 -c core_cpp/spec_parser/module.cpp -o build/temp.macosx-10.9-universal2-cpython-311/core_cpp/spec_parser/module.o -std=c++11 -stdlib=libc++ -std=c++17 -mmacos-version-min=11
core_cpp/spec_parser/module.cpp:382:45: error: use of undeclared identifier 'session'; did you mean 'setsid'?

382 | if (!PyArg_ParseTuple(args, "OspOOpp", &session, &text, &c_quoted, &parse_error_class,

|
| setsid

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:481:8: note: 'setsid' declared here

481 | pid_t setsid(void);

|

core_cpp/spec_parser/module.cpp:387:5: error: use of undeclared identifier 'add_implied'; did you mean 'c_add_implied'?

387 | add_implied = static_cast<bool>(c_add_implied);

|
| c_add_implied

core_cpp/spec_parser/module.cpp:380:19: note: 'c_add_implied' declared here

380 | int c_quoted, c_add_implied;

|

core_cpp/spec_parser/module.cpp:400:6: error: expected ';' at end of declaration

400 | }

|
| ;

3 errors generated.
Traceback (most recent call last):

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/spawn.py", line 87, in spawn

subprocess.check_call(cmd, env=_inject_macos_ver(env))

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call

raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['/usr/bin/clang++', '-Wsign-compare', '-Wunreachable-code', '-fno-common', '-dynamic', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-Wall', '-arch', 'arm64', '-arch', 'x86_64', '-g', '-DMAJOR_VERSION=1', '-DMINOR_VERSION=0', '-I/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/include', '-I/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11', '-I/Users/pett/src/chimerax/ChimeraX.app/Contents/include/python3.11', '-c', 'core_cpp/spec_parser/module.cpp', '-o', 'build/temp.macosx-10.9-universal2-cpython-311/core_cpp/spec_parser/module.o', '-std=c++11', '-stdlib=libc++', '-std=c++17', '-mmacos-version-min=11']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/compilers/C/unix.py", line 217, in _compile

self.spawn(

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/compilers/C/base.py", line 1158, in spawn

spawn(cmd, dry_run=self.dry_run, kwargs)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/spawn.py", line 93, in spawn

raise DistutilsExecError(

distutils.errors.DistutilsExecError: command '/usr/bin/clang++' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 202, in run_commands

dist.run_commands()

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands

self.run_command(cmd)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/dist.py", line 1104, in run_command

super().run_command(command)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command

cmd_obj.run()

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 135, in run

self.run_command(cmd_name)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command

self.distribution.run_command(command)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/dist.py", line 1104, in run_command

super().run_command(command)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command

cmd_obj.run()

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 99, in run

_build_ext.run(self)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 368, in run

self.build_extensions()

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 484, in build_extensions

self._build_extensions_serial()

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 510, in _build_extensions_serial

self.build_extension(ext)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 264, in build_extension

_build_ext.build_extension(self, ext)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension

super(build_ext, self).build_extension(ext)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 565, in build_extension

objects = self.compiler.compile(


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/compilers/C/base.py", line 655, in compile

self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile

raise CompileError(msg)

distutils.compilers.C.errors.CompileError: command '/usr/bin/clang++' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/bundle_builder/bundle_builder_toml.py", line 779, in _run_setup

dist = setuptools.setup(kw)


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/init.py", line 117, in setup

return distutils.core.setup(attrs)


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 186, in setup

return run_commands(dist)


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 216, in run_commands

raise SystemExit("error: " + str(msg))

SystemExit: error: command '/usr/bin/clang++' failed with exit code 1
Traceback (most recent call last):

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>

main()

File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main

json_outreturn_val = hook(hook_inputkwargs)


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel

return _build_backend().build_wheel(


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/bundle_builder/cx_pep517.py", line 37, in build_wheel

wheel = bundle.build_wheel()


File "/Users/pett/src/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/bundle_builder/bundle_builder_toml.py", line 868, in build_wheel

self.version = dist.get_version()


AttributeError: 'NoneType' object has no attribute 'get_version'

ERROR Backend subprocess exited when trying to invoke build_wheel
make: * [wheel] Error 1

Note: See TracTickets for help on using tickets.