如何使用诗歌进行递归安装? [英] How to use poetry for recursive installation?

查看:41
本文介绍了如何使用诗歌进行递归安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用诗歌包管理器安装 this 存储库.以下是使用 pip 的方法:

I'm trying to install this repository using poetry package manager. Here's how it's done using pip:

git clone --recursive https://github.com/parlance/ctcdecode.git
cd ctcdecode && pip install .

但是如果我试着跑

poetry add ctcdecode

它因大量回溯而失败(我认为超过 200 行).所以我用

It fails with big traceback (over 200 lines I think). So I installed it with

poetry run git clone --recursive https://github.com/parlance/ctcdecode.git
poetry run pip install ./ctcdecode

但是这种方式不适合与其他开发者共享.我可以用 pyproject.toml 以某种方式做到这一点吗?

But this way is not suitable for sharing with other devs. Can I do it with pyproject.toml somehow?

推荐答案

poetry add 将 pypi 上可用的依赖项(或如果配置了其他包存储库)添加并安装到您的项目中.

poetry add <packagename> adds and installs a dependency available on pypi (or if configured other package repositories) to you project.

如果要添加包,其中源代码位于 git 存储库中,请使用 poetry add git+.

If you want to add a package, where the source code is located in a git repository use poetry add git+<url_of_git>.

ctcdecode 在两种方式中的问题在于,它需要构建.为此,需要 torch.根据 PEP 518.

The problem with ctcdecode in both ways is, that it needs to be build. For this torch is needed. ctcdecode doesn't declare this build dependency in a pyproject.toml according to PEP 518.

您可以通过克隆 git 存储库并将包含此内容的 pyproject.toml 放入项目文件夹来解决此问题:

You can work around it, by clone the git repository and put a pyproject.toml with this content into the project's folder:

[build-system]
requires = ["setuptools", "torch"]
build-backend = "setuptools.build_meta"

然后返回到您当前的项目并添加本地路径依赖项,如下所示:

Then go back to your current project and add the local path dependency like this:

$ poetry add <relative_path_to_ctcdecode>

这篇关于如何使用诗歌进行递归安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆