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 .
But if I try to run
poetry add ctcdecode
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
But this way is not suitable for sharing with other devs. Can I do it with pyproject.toml somehow?
poetry add <packagename>
adds and installs a dependency available on pypi (or if configured other package repositories) to you project.
If you want to add a package, where the source code is located in a git repository use poetry add git+<url_of_git>
.
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.
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>