英文:
Failed building wheel for backports-zoneinfo
问题
EDIT
我尝试[清除我的pip缓存][1],因为出现了错误行Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
(可能缓存版本损坏/旧版与其他包不兼容) - 但这只是除去了那行之外没有任何改变。
CONTEXT
在安装Python 3.9
之后,我遇到了依赖性问题(在[这里][2]和[这里][3]讨论过)。链接帖子中的问题已经解决,但我正在卸载和重新安装通过pip
安装的软件包,以确保它们与我的新Python版本兼容。我正在尝试这样做的软件包之一是backports-zoneinfo
。我知道我[不真正需要它][4],但我打算仍然保留它,以防我编写一些需要与旧版Python兼容的东西。
ISSUE:
我已卸载了backports-zoneinfo
,然后尝试重新安装它,但在帖子底部收到了错误消息。然后,根据错误消息,我安装了[2022年的构建工具][5],并尝试再次安装backports-zoneinfo
,但仍然收到相同的错误消息。请有人帮助我诊断和修复这个问题?
Uninstall message:
C:\Users\u03132tk>pip uninstall backports-zoneinfo
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
Found existing installation: backports.zoneinfo 0.2.1
Uninstalling backports.zoneinfo-0.2.1:
Would remove:
c:\anaconda3\lib\site-packages\backports.zoneinfo-0.2.1.dist-info\*
c:\anaconda3\lib\site-packages\backports\*
Would not remove (might be manually added):
c:\anaconda3\lib\site-packages\backports\functools_lru_cache.py
c:\anaconda3\lib\site-packages\backports\tempfile.py
c:\anaconda3\lib\site-packages\backports\weakref.py
Proceed (Y/n)? Y
Successfully uninstalled backports.zoneinfo-0.2.1
Reinstall error
C:\Users\u03132tk>pip install backports-zoneinfo
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
Collecting backports-zoneinfo
Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: backports-zoneinfo
Building wheel for backports-zoneinfo (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for backports-zoneinfo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
C:\Users\u03132tk\AppData\Local\Temp\pip-build-env-0o6uoggk\overlay\Lib\site-packages\setuptools\config\setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
!!
********************************************************************************
The license_file parameter is deprecated, use license_files instead.
By 2023-Oct-30, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
********************************************************************************
!!
parsed = self parsers.get(option_name, lambda x: x)(value)
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-39
creating build\lib.win-amd64-cpython-39\backports
copying src\backports\__init__.py -> build\lib.win-amd64-cpython-39\backports
creating build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_common.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_tzpath.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_version.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_zoneinfo.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\__init__.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
<details>
<summary>英文:</summary>
***EDIT***
I tried [clearing my pip cache][1] due to the error line `Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)` (maybe the cached version is broken/old and incompatible with other packages) - but this made no difference other than removing that line
***CONTEXT***
I've been having dependency issues after installing `Python 3.9` (discussed [here][2] and [here][3]). The issues in the linked posts have been fixed, but I am uninstalling and re-installing my `pip`-installed packages to make sure they are compatible with my new python version. One of the packages I am trying to do this with is `backports-zoneinfo`. I am aware I [don't really need this][4], but I was going to keep it anyway in case I write something needing compatibility with older python versions.
***ISSUE:***
I have uninstalled `backports-zoneinfo`, and then tried to reinstall it, but get the error message at the bottom of this post. I then installed [build tools 2022][5] as per the error message and tried to re-install `backports-zoneinfo` again, but got the same error. Please can someone help me to diagnose and fix the issue?
***Uninstall message:***
C:\Users\u03132tk>pip uninstall backports-zoneinfo
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
Found existing installation: backports.zoneinfo 0.2.1
Uninstalling backports.zoneinfo-0.2.1:
Would remove:
c:\anaconda3\lib\site-packages\backports.zoneinfo-0.2.1.dist-info\*
c:\anaconda3\lib\site-packages\backports\*
Would not remove (might be manually added):
c:\anaconda3\lib\site-packages\backports\functools_lru_cache.py
c:\anaconda3\lib\site-packages\backports\tempfile.py
c:\anaconda3\lib\site-packages\backports\weakref.py
Proceed (Y/n)? Y
Successfully uninstalled backports.zoneinfo-0.2.1
***Reinstall error***
C:\Users\u03132tk>pip install backports-zoneinfo
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
Collecting backports-zoneinfo
Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: backports-zoneinfo
Building wheel for backports-zoneinfo (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for backports-zoneinfo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
C:\Users\u03132tk\AppData\Local\Temp\pip-build-env-0o6uoggk\overlay\Lib\site-packages\setuptools\config\setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
!!
********************************************************************************
The license_file parameter is deprecated, use license_files instead.
By 2023-Oct-30, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
********************************************************************************
!!
parsed = self.parsers.get(option_name, lambda x: x)(value)
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-39
creating build\lib.win-amd64-cpython-39\backports
copying src\backports\__init__.py -> build\lib.win-amd64-cpython-39\backports
creating build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_common.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_tzpath.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_version.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\_zoneinfo.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\__init__.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
running egg_info
writing src\backports.zoneinfo.egg-info\PKG-INFO
writing dependency_links to src\backports.zoneinfo.egg-info\dependency_links.txt
writing requirements to src\backports.zoneinfo.egg-info\requires.txt
writing top-level names to src\backports.zoneinfo.egg-info\top_level.txt
reading manifest file 'src\backports.zoneinfo.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.png' under directory 'docs'
warning: no files found matching '*.svg' under directory 'docs'
no previously-included directories found matching 'docs\_build'
no previously-included directories found matching 'docs\_output'
adding license file 'LICENSE'
adding license file 'licenses/LICENSE_APACHE'
writing manifest file 'src\backports.zoneinfo.egg-info\SOURCES.txt'
copying src\backports\zoneinfo\__init__.pyi -> build\lib.win-amd64-cpython-39\backports\zoneinfo
copying src\backports\zoneinfo\py.typed -> build\lib.win-amd64-cpython-39\backports\zoneinfo
running build_ext
building 'backports.zoneinfo._czoneinfo' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for backports-zoneinfo
Failed to build backports-zoneinfo
ERROR: Could not build wheels for backports-zoneinfo, which is required to install pyproject.toml-based projects
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
[1]: https://stackoverflow.com/a/61762308/11357695
[2]: https://stackoverflow.com/questions/76320554/import-errors-after-updating-spyder-and-python?noredirect=1#comment134584293_76320554
[3]: https://stackoverflow.com/questions/76314158/spyder-kernels-anaconda-and-python-3-9/76320534?noredirect=1#comment134585043_76320534
[4]: https://stackoverflow.com/a/72796492/11357695
[5]: https://visualstudio.microsoft.com/visual-cpp-build-tools/?fbclid=IwAR2CjL1xcjVN8PCHAszkPfVFix-1Iosqn_wbvp9Ij8whDsQyTKDNe-66nfs
</details>
# 答案1
**得分**: 0
要实际解决这个特定的错误,你需要在你的Windows机器上安装一个可用的编译器:
> 需要 Microsoft Visual C++ 14.0 或更高版本。获取它使用 "Microsoft C++ Build Tools":https://visualstudio.microsoft.com/visual-cpp-build-tools/
为此,你需要点击链接,下载并安装构建工具,然后再试一次。
这个特定的`pip`包在python3.9上没有whl文件,同时它的源分发包含部分用C/C++编写的部分。因此,现在`pip`需要调用一个编译器来构建适用于你的机器的源分发包。
要避免这个问题,你有几个选择:
1. 与其使用`pip`,你可以尝试使用 `conda install -c conda-forge backports.zoneinfo` 安装相同的包。
2. 由于`zoneinfo`已成为标准库的一部分,你也可以尝试将你的`import backports.zoneinfo` 替换为 `import zoneinfo`。使用这种方法,你无需进一步安装。
<details>
<summary>英文:</summary>
To actually fix this specific error, you would need a working compiler on your windows machine:
> Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
For that you would need to follow the link, download and install the build tools and try again.
this particular `pip` package does not have a whl file for python3.9 and at the same time has a source distribution that has parts written in C/C++. Therefore `pip` now needs to call a compiler to build the source distribution for your machine.
To avoid this, you have a few options though:
1. Instead of `pip`, you could try installing the same package using `conda install -c conda-forge backports.zoneinfo`
2. Since `zoneinfo` has become part of the stdlib, you can also try replacing your `import backports.zoneinfo` to `import zoneinfo`. With this method, you would need no further installation.
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论