I have a weird error when trying to install fastavro==1.7.3
(as part of poetry install
) on a pyenv
-managed Python 3.10.12. However, it installs fine on the same machine using Python 3.11.4. Any idea what is happening in 3.10?
$ pip install fastavro==1.7.3
Collecting fastavro==1.7.3
Using cached fastavro-1.7.3.tar.gz (791 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: fastavro
Building wheel for fastavro (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for fastavro (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [150 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13.5-arm64-cpython-310
creating build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_schema_common.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_schema_py.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_logical_writers_py.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/json_read.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/write.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_write_common.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_write_py.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/__init__.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_read_py.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/types.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/json_write.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_read_common.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_validate_common.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_logical_readers_py.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/utils.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/logical_writers.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/_validation_py.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/__main__.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/logical_readers.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/const.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/schema.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/read.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
copying fastavro/validation.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
creating build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/binary_decoder.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/__init__.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/binary_encoder.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/parser.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/symbols.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/json_encoder.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
copying fastavro/io/json_decoder.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/io
creating build/lib.macosx-13.5-arm64-cpython-310/fastavro/repository
copying fastavro/repository/__init__.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/repository
copying fastavro/repository/flat_dict.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/repository
copying fastavro/repository/base.py -> build/lib.macosx-13.5-arm64-cpython-310/fastavro/repository
copying fastavro/py.typed -> build/lib.macosx-13.5-arm64-cpython-310/fastavro
running build_ext
Error compiling Cython file:
------------------------------------------------------------
...
writer_schema, named_schemas, offset, size, return_record_name, return_record_name_override
)
class Block:
def __init__(
^
------------------------------------------------------------
fastavro/_read.pyx:976:4: Compiler crash in AnalyseDeclarationsTransform
File 'ModuleNode.py', line 203, in analyse_declarations: ModuleNode(_read.pyx:1:0,
doc = 'Python code for reading AVRO files',
full_module_name = 'fastavro._read')
File 'Nodes.py', line 393, in analyse_declarations: StatListNode(_read.pyx:10:0)
File 'Nodes.py', line 393, in analyse_declarations: StatListNode(_read.pyx:975:0)
File 'Nodes.py', line 5121, in analyse_declarations: PyClassDefNode(_read.pyx:975:0,
name = 'Block')
File 'Nodes.py', line 393, in analyse_declarations: StatListNode(_read.pyx:976:4)
File 'Nodes.py', line 2710, in analyse_declarations: CFuncDefNode(_read.pyx:976:4,
args = [...]/11,
modifiers = [...]/0,
outer_attrs = [...]/2,
overridable = True,
visibility = 'private')
File 'Nodes.py', line 2721, in declare_cpdef_wrapper: CFuncDefNode(_read.pyx:976:4,
args = [...]/11,
modifiers = [...]/0,
outer_attrs = [...]/2,
overridable = True,
visibility = 'private')
File 'Nodes.py', line 2787, in call_self_node: CFuncDefNode(_read.pyx:976:4,
args = [...]/11,
modifiers = [...]/0,
outer_attrs = [...]/2,
overridable = True,
visibility = 'private')
Compiler crash traceback from this point on:
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/Cython/Compiler/Nodes.py", line 2787, in call_self_node
type_entry = self.type.args[0].type.entry
AttributeError: 'PyObjectType' object has no attribute 'entry'
Compiling fastavro/_read.pyx because it changed.
[1/1] Cythonizing fastavro/_read.pyx
Traceback (most recent call last):
File "/Users/test/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/test/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/test/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 416, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
self.run_setup()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
exec(code, locals())
File "<string>", line 37, in <module>
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
return distutils.core.setup(**attrs)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 346, in run
self.run_command("build")
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
self.build_extensions()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
self._build_extensions_serial()
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
self.build_extension(ext)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
_build_ext.build_extension(self, ext)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
new_ext = cythonize(
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
cythonize_one(*args)
File "/private/var/folders/98/t4j615w14737x8f1qv8rynlm0000gq/T/pip-build-env-itnk3zqh/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: fastavro/_read.pyx
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fastavro
Failed to build fastavro
ERROR: Could not build wheels for fastavro, which is required to install pyproject.toml-based projects
The solution from the Github issue that worked for me:
pip install setuptools wheel 'Cython<3'
pip install --no-build-isolation fastavro==1.7.3
Explanation: Cython used for fastavro
building is the latest regardless of what is installed locally. The --no-build-isolation
flag tells pip
to use local dependencies.