I'm trying to install kornia
using poetry
.
System details
I've previously installed kornia
(poetry add kornia
) but for some unknown reason I'm now getting the following traceback:
RuntimeError
Unable to find installation candidates for nvidia-cudnn-cu11 (8.5.0.96)
at ~.poetry\lib\poetry\installation\chooser.py:72 in choose_for 68│ 69│ links.append(link) 70│ 71│ if not links: → 72│ raise RuntimeError( 73│ "Unable to find installation candidates for {}".format(package) 74│ )
Since this wasn't a very helpful traceback I thought I'd try to pip install to see if I could get kornia
installed somehow, then repeat the process using poetry
.
First I ran poetry run pip install nvidia-pyindex
, then poetry run pip install kornia
. kornia
was installed, giving me confidence that I might be able to do the same using poetry
.
So I ran poetry add nvidia-pyindex
which installed, but when I ran poetry add kornia
I got the same RuntimeError
.
I wondered if having poetry add
without pip uninstall
might have caused issues. So I started from scratch - I ran:
rm -rf ~/.cache/pypoetry/cache/repositories/pypi/
poetry rm {name of venv}
git checkout master pyproject.toml poetry.lock
poetry add nvidia-pyindex
which created the venv (by the same name as previously - not sure if this is an issue in itself, since the name of the venv was first created in PyCharm and I wonder if there are some files lingering in places I don't know that is the root of my problems?), then poetry add kornia
but got the same error.
I also tried to clear poetry's cache as suggested here but that didn't help. I didn't find a solution here. I don't believe this applies since poetry was installed properly and is working fine otherwise. I read through this but didn't see any working solution. I tried a fix mentioned here, which was to add
[[tool.poetry.source]]
name = "nvidia"
url = "https://pypi.ngc.nvidia.com"
secondary = true
to pyproject.toml
, hoping that it would avoid the error when poetry tries to install nvidia-cudnn-cu11
, but it didn't help either.
I tried poetry add nvidia-cudnn-cu11
and poetry add nvidia-cudnn-cu116
hoping that having added the ndvidia repo as a secondary source would get kornia
's dependencies installed before trying to install kornia
itself.
{I don't know if secondary sources are only used when poetry add
ing a package (i.e. kornia
) and "ignored" for installation of dependencies (nvidia-cudnn-cu11
) of the package to be installed (kornia
).}
In any case, that didn't work either.
Running poetry source add nvidia https://pypi.ngc.nvidia.com
didn't work - presumably because poetry source add
was added to poetry
v1.2 and was not part of v1.1.13.
I also tried poetry add --source nvidia https://pypi.ngc.nvidia.com
but I got
PermissionError
[Errno 13] Permission denied: 'C:\Users\...\AppData\Local\Temp\tmp2t6am7ei'
at ~.poetry\lib\poetry\utils\helpers.py:101 in download_file 97│ 98│ with get(url, stream=True) as response: 99│ response.raise_for_status() 100│ → 101│ with open(dest, "wb") as f: 102│ for chunk in response.iter_content(chunk_size=chunk_size): 103│ if chunk: 104│ f.write(chunk)
I'm out of ideas and hoped someone might help.
could this be related to this problem?
I had a similar issue and was able to fix it by making the torch dependency explicit and install torch version < 1.13:
[tool.poetry.dependencies]
...
torch = "~1.12.1"