pypa / build

A simple, correct Python build frontend

Home Page:https://build.pypa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'tarfile' has no attribute 'data_filter' while building

jolanta-precisionlife opened this issue · comments

Hi,
I faced the issue while building the package. Please find the logs for build-1.0.3 below. It works fine for build-0.10.0.

Installing collected packages: zipp, tomli, pyproject-hooks, packaging, importlib-metadata, build
Successfully installed build-1.0.3 importlib-metadata-6.8.0 packaging-23.2 pyproject-hooks-1.0.0 tomli-2.0.1 zipp-3.17.0
Building Python wheel.
Traceback (most recent call last):
  File "/home/jolanta/.conan/data/cpython/3.9.7/_/_/package/0830d571bdfb6b94a6d1b7c7f36ec7f140dda55c/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/jolanta/.conan/data/cpython/3.9.7/_/_/package/0830d571bdfb6b94a6d1b7c7f36ec7f140dda55c/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/jolanta/.conan/data/cpython/3.9.7/_/_/package/0830d571bdfb6b94a6d1b7c7f36ec7f140dda55c/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/home/jolanta/Search2-build/pysearchPackage/PySearchVEnv/Debug/lib/python3.9/site-packages/build/__init__.py", line 26, in <module>
    from . import env
  File "/home/jolanta/Search2-build/pysearchPackage/PySearchVEnv/Debug/lib/python3.9/site-packages/build/env.py", line 20, in <module>
    from ._util import check_dependency
  File "/home/jolanta/Search2-build/pysearchPackage/PySearchVEnv/Debug/lib/python3.9/site-packages/build/_util.py", line 84, in <module>
    class TarFile(tarfile.TarFile):
  File "/home/jolanta/Search2-build/pysearchPackage/PySearchVEnv/Debug/lib/python3.9/site-packages/build/_util.py", line 85, in TarFile
    extraction_filter = staticmethod(tarfile.data_filter)
AttributeError: module 'tarfile' has no attribute 'data_filter'

I would like to use the newest build version but I cannot install it die to the issue above.

What is sys.version_info? Is it possible you have a modern Python (3.9.18+) but it's using an old 3.9.7 standard library somehow? This should be protected via #675.

Thank you for the prompt answer. I am using a virtual environment with python 3.9.18 (sys.version_info(major=3, minor=9, micro=18, releaselevel='final', serial=0)) on a machine that has default python3 set as 3.10.12 (sys.version_info(major=3, minor=10, micro=12, releaselevel='final', serial=0)). There is no older python version installed on the machine.

Then why this in your traceback:

File "/home/jolanta/.conan/data/cpython/3.9.7/_/_/package/0830d571bdfb6b94a6d1b7c7f36ec7f140dda55c/lib/python3.9/runpy.py
                                        ^^^^^

Conan seems to be causing Python 3.9.18 to be pulling in 3.9.7's standard library, which of course breaks things, this happens to be the first.

Oh, now I see it's a problem with my configuration. Thank you for your help and I am sorry for bothering you.