'poetry install' 命令失败; *.whl 文件未找到
'poetry install' command fails; *.whl files are not found
我正在通过 Poetry 管理我的 Python 项目中的依赖关系。
现在我想 运行 在与我的开发机器不同的机器上运行这个项目。要安装依赖项,我只需从根目录 运行 这个命令:
$ poetry install
但随后会引发以下错误:
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 70 installs, 0 updates, 0 removals
• Installing colorama (0.4.4)
• Installing tzdata (2021.1)
ValueError
File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifactse\b3d87ac44fdb2d557301f1f4086a37c080d1482a98751abe7cdbabbad26\colorama-0.4.4-py2.py3-none-any.whl does not exist
at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
36│ except FileNotFoundError:
37│ raise ValueError("Directory {} does not exist".format(self._path))
38│
39│ if not self._full_path.exists():
→ 40│ raise ValueError("File {} does not exist".format(self._path))
41│
42│ if self._full_path.is_dir():
43│ raise ValueError("{} is a directory, expected a file".format(self._path))
44│
ValueError
File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifactsd\cb43e36999e7ab3926d5385dfac9ee9ea2a62f8111ff71abb6aff70674\tzdata-2021.1-py2.py3-none-any.whl does not exist
at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
36│ except FileNotFoundError:
37│ raise ValueError("Directory {} does not exist".format(self._path))
38│
39│ if not self._full_path.exists():
→ 40│ raise ValueError("File {} does not exist".format(self._path))
41│
42│ if self._full_path.is_dir():
43│ raise ValueError("{} is a directory, expected a file".format(self._path))
44│
最好知道这些 *.whl 是什么以及 Poetry 如何使用它们。
根据https://github.com/python-poetry/poetry/issues/4163,这似乎是一个有待解决的问题。
作为解决方法,通过 poetry
:
将依赖项转储到 requirements.txt
文件
$ poetry export -f requirements.txt --output requirements.txt --without-hashes
然后通过 pip
安装它们,对我有用:
$ pip install -r requirements.txt
好像跟诗歌缓存有关。对我来说,如果我转到 User\user\AppData\Local\pypoetry
并删除缓存文件夹,它会按预期工作。
具体来说,我发现删除 AppData\Local\pypoetry\Cache\artifacts
文件夹(我在 Windows 10)对我有用。其他项目的 virtualenvs 可能在 AppData\Local\pypoetry\Cache\virtualenvs
中,因此您可能不想完全删除 AppData\Local\pypoetry\Cache
中的根缓存文件夹。
对我来说,随着最新诗歌的发布,这个错误已经消失了 >=1.1.12
所以 运行 poetry self update
应该修复它。
已解决问题:https://github.com/python-poetry/poetry/pull/4549
1.1.12诗歌发布:https://github.com/python-poetry/poetry/releases/tag/1.1.12
所以事实证明我缺少这个问题所述的 visualstudio 构建工具。
我下载并安装了它,现在一切正常。
我正在通过 Poetry 管理我的 Python 项目中的依赖关系。
现在我想 运行 在与我的开发机器不同的机器上运行这个项目。要安装依赖项,我只需从根目录 运行 这个命令:
$ poetry install
但随后会引发以下错误:
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 70 installs, 0 updates, 0 removals
• Installing colorama (0.4.4)
• Installing tzdata (2021.1)
ValueError
File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifactse\b3d87ac44fdb2d557301f1f4086a37c080d1482a98751abe7cdbabbad26\colorama-0.4.4-py2.py3-none-any.whl does not exist
at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
36│ except FileNotFoundError:
37│ raise ValueError("Directory {} does not exist".format(self._path))
38│
39│ if not self._full_path.exists():
→ 40│ raise ValueError("File {} does not exist".format(self._path))
41│
42│ if self._full_path.is_dir():
43│ raise ValueError("{} is a directory, expected a file".format(self._path))
44│
ValueError
File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifactsd\cb43e36999e7ab3926d5385dfac9ee9ea2a62f8111ff71abb6aff70674\tzdata-2021.1-py2.py3-none-any.whl does not exist
at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
36│ except FileNotFoundError:
37│ raise ValueError("Directory {} does not exist".format(self._path))
38│
39│ if not self._full_path.exists():
→ 40│ raise ValueError("File {} does not exist".format(self._path))
41│
42│ if self._full_path.is_dir():
43│ raise ValueError("{} is a directory, expected a file".format(self._path))
44│
最好知道这些 *.whl 是什么以及 Poetry 如何使用它们。
根据https://github.com/python-poetry/poetry/issues/4163,这似乎是一个有待解决的问题。
作为解决方法,通过 poetry
:
requirements.txt
文件
$ poetry export -f requirements.txt --output requirements.txt --without-hashes
然后通过 pip
安装它们,对我有用:
$ pip install -r requirements.txt
好像跟诗歌缓存有关。对我来说,如果我转到 User\user\AppData\Local\pypoetry
并删除缓存文件夹,它会按预期工作。
具体来说,我发现删除 AppData\Local\pypoetry\Cache\artifacts
文件夹(我在 Windows 10)对我有用。其他项目的 virtualenvs 可能在 AppData\Local\pypoetry\Cache\virtualenvs
中,因此您可能不想完全删除 AppData\Local\pypoetry\Cache
中的根缓存文件夹。
对我来说,随着最新诗歌的发布,这个错误已经消失了 >=1.1.12
所以 运行 poetry self update
应该修复它。
已解决问题:https://github.com/python-poetry/poetry/pull/4549
1.1.12诗歌发布:https://github.com/python-poetry/poetry/releases/tag/1.1.12
所以事实证明我缺少这个问题所述的 visualstudio 构建工具。
我下载并安装了它,现在一切正常。