ValueError: 在系统路径中找不到libcublas.so.*[0-9]

huangapple go评论69阅读模式
英文:

ValueError: libcublas.so.*[0-9] not found in the system path

问题

我正在尝试在我的Django Rest Framework项目中导入并使用Ultralytics库,我使用Poetry作为我的依赖管理器,我使用poetry add ultralytics安装了Ultralytics,并在尝试在我的代码中导入该库时收到以下错误信息:

ValueError: libcublas.so.*[0-9] not found in the system path [我的项目和虚拟环境路径]

我该如何解决这个问题?

英文:

I'm trying to import and use ultralytics library in my Django rest framework project, I use poetry as my dependency manager, I installed ultralytics using poetry add ultralytics and on trying to import the library in my code I recieve this error

ValueError: libcublas.so.*[0-9] not found in the system path [my project and virtual environment paths]

how can I solve that?

答案1

得分: 30

自 2023 年 5 月 9 日以来,存在一个 与 PyTorch 2.0.1 有关的开放问题,导致 poetry lockpoetry.lock 中删除了 libcublas。虽然他们的 wheel 包含这个依赖项,但他们的 PyPi 上传没有包含它。

一个解决方法是在 pyproject.toml 中跳过这个版本:

torch = ">=2.0.0, !=2.0.1"

确保在进行更改后运行以下命令以正确更新您的 poetry 环境:

poetry lock --no-update
poetry install
英文:

Since May 9 2023 there is an open issue with PyTorch 2.0.1 causing poetry lock to delete libcublas from poetry.lock. Their wheel contains the dependency, but their PyPi upload did not get it.

A workaround would be to skip this version in pyproject.toml:

torch = ">=2.0.0, !=2.0.1"

Make sure to run the following to correctly update your poetry env after making the change

poetry lock --no-update
poetry install

答案2

得分: 1

你需要在你的系统上安装cuda。

例如,在Ubuntu上:

sudo apt-get安装nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc

英文:

You have to install cuda on your system.

E.g. on ubuntu:

sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc

答案3

得分: 1

如果你来到这里并且在使用poetry时遇到了与其他库相关的问题,请尝试直接在.venv中安装它。对我来说,解决方法是:

pip3 install "transformers[torch]"
英文:

If you come here and have this problem with some other library while using poetry, try to install it directly in .venv. For me that was:

   pip3 install "transformers[torch]"

huangapple
  • 本文由 发表于 2023年5月25日 05:09:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76327419.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定