0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】 uvでpyradiomicsがインストールできないのを解決してみた

Posted at

uvとは

poetryやpipのようなバージョン管理ツールであり、他ツールより高速に扱える。

問題点

uv add pyradiomics

でダウンロードしようとしても以下のエラーが出る。
原因は以下の2点

  • pyradiomcsの公式パッケージはpython3.9までしか対応していない
  • 3.10以降に対応するために必要なclangというC言語のコンパイラが入っていない
error: command 'clang' failed: No such file or directory

私の環境では、権限でpipを使うことができないため、uvでpyradiomicsをインストールするように四苦八苦した。

試したこと

以下3点を試した。clangとpyradiomicsの手動ダウンロードで解決した。

  • clangをuvでインストールする
  • clangを手動でインストールする
  • pyradiomicsを手動でインストールする

clangをuvでインストールする

以下のコマンドでpython内蔵のclangをインストールしたが、uvはあくまでもpythonパッケージをインストールするもので、clnagのようなCコンパイラを管理できない。

uv add clang

clangを手動でインストールする

上記理由から、clangをサイトからインストールした。
https://releases.llvm.org/download.html

そして、clangの環境パスを通した後、再度以下を実行した。

uv add pyradiomics

すると、このようなエラーが出た。

 × Failed to build pyradiomics==3.1.0
  ├─▶ The build backend returned an error
  ╰─▶ Call to setuptools.build_meta.build_wheel failed (exit status: 1)
-------------------------------------------------------------------
hint: This error likely indicates that you need to install a library that provides "cmatrices.h" for pyradiomics@3.0.1a1

Pypl公式のpyradiomicsをダウンロードするパッケージには"cmatrices.h"が含まれていない?ようだ。

pyradiomicsを手動でインストールする

Githubからpyradiomcsを直接ダウンロードする。

git clone https://github.com/Radiomics/pyradiomics.git
cd pyradiomics
python setup.py build
python setup.py install
uv pip install .

でGithubから直接インストールすることができる。
その後、再度uv addを唱え、無事にインストールできた。

uv add clang

まとめ

pyradiomicsをuvでインストールする方法についての備忘録である。
pipが使える環境であれば、苦労することがないと思うが、Githubから直接ライブラリをインストールする方法を習得できたので僥倖である。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?