Ubuntu 26.04 に、天体画像処理ソフトを入れて、RTX5060で処理を行います。
Note: Starting with version 1.27, GPU packages published to PyPI (onnxruntime-gpu) and NuGet (Microsoft.ML.OnnxRuntime.Gpu) are built with CUDA 13.0 by default. Older GPU package versions are built with CUDA 12.8 by default.
バージョン 1.27 以降、PyPI(onnxruntime-gpu)および NuGet(Microsoft.ML.OnnxRuntime.Gpu)に公開されている GPU パッケージは、デフォルトで CUDA 13.0 を使用してビルドされています。それ以前のバージョンの GPU パッケージは、デフォルトで CUDA 12.8 を使用してビルドされています。
https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements
CUDA Toolkit 13系では、Cosmic Clarity Suiteが動作しない様なので、
CUDA Toolkit 12.8.2を用いて、Ubuntu + CUDA環境を作ります。
バージョンの組み合わせは、
https://docs.nvidia.com/deeplearning/cudnn/backend/v9.24.0/reference/support-matrix.html
福山大学 工学部 情報工学科 『金子邦彦研究室へようこそ』
こちらで綺麗にまとめられています。
「推奨フロー図解」は、作業の流れをつかみ易くしてくれます。
Ubuntu 24.04 開発・研究環境構築ガイド
https://www.kkaneko.jp/tools/ubuntu/ubuntu.html
インストールとインストール後の落ち穂拾い
時刻:ハードウェアクロック
Windows OSとLinux OSが、デュアルブートさせていると、時刻表示が日本標準時から8時間ずれる。
これを日本標準時(JST +9h)に指定します。
# ハードウェアクロックにローカルタイムを、ローカル時刻に指定
sudo timedatectl set-local-rtc 1
# ハードウェアクロックにローカルタイムを、UTC時刻に指定
sudo timedatectl set-local-rtc 0
C/C++コンパイラ、make、パッケージツール
sudo apt update
sudo apt install build-essential gcc g++ make libtool dpkg-dev pkg-config dkms
Ubuntuのリポジトリからnvidia-driver-580-open, CUDA 12.x の runfile をダウンロードし、インストール
# インストールされているCUDA関連パッケージを確認
dpkg -l | grep cuda
dpkg -l | grep nvidia
# NVIDIA関連パッケージを削除
sudo apt --purge remove '*nvidia*'
# CUDA はrunfile を用いてインストールしているので、"cuda-uninstaller"を使う
# sudo apt --purge remove '*cuda*'
sudo apt --purge remove '*cudnn*'
# 不要になった依存関係を自動削除
sudo apt autoremove --purge
# パッケージリストの情報を更新
sudo apt update
# Update device list 必要ならば
sudo update-pciids
ドライバのビルドに必要なカーネルヘッダー等をインストールする
sudo apt update
sudo apt -y install linux-headers-$(uname -r) build-essential dkms
# システムが認識しているGPUと利用可能なドライバを表示
ubuntu-drivers devices
driver : nvidia-driver-???-open - distro non-free recommended
# 2026年7月現在では、580
sudo apt install nvidia-driver-580-open
# initramfsを更新
sudo update-initramfs -u
# ドライバの有効化のためにシステムを再起動
reboot
NVIDIA製GPUの稼働状況やシステム情報を確認します。
nvidia-smi
Boot miss ! 起動しなくなったら、Boot Repair
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt update
sudo apt install boot-repair
boot-repair
sudo chroot "/mnt/boot-sav/sda2" dpkg --configure -a
sudo chroot "/mnt/boot-sav/sda2" apt-get install -fy
sudo chroot "/mnt/boot-sav/sda2" apt-get purge --allow-remove-essential -y grub-com*
sudo chroot "/mnt/boot-sav/sda2" apt-get purge --allow-remove-essential -y grub2-com*
sudo chroot "/mnt/boot-sav/sda2" apt-get purge --allow-remove-essential -y shim-signed
sudo chroot "/mnt/boot-sav/sda2" apt-get purge --allow-remove-essential -y grub-common:*
sudo chroot "/mnt/boot-sav/sda2" apt-get purge --allow-remove-essential -y grub2-common:*
sudo chroot "/mnt/boot-sav/sda2" apt-get install -y grub-efi
Boot successfully repaired.
A new file (/var/log/boot-repair/20260805_015552/Boot-Info_20260805_0155.txt) will open in your text viewer.
In case you still experience boot problem, indicate its content to:
boot.repair@gmail.com or to your favorite support forum.
Locked-NVram detected. Please do not forget to make your UEFI firmware boot on the Ubuntu 26.04 LTS entry (sda1/efi/ubuntu/grubx64.efi file) !
CUDA Toolkit 12.8.2 (April 2026)runfile
wget https://developer.download.nvidia.com/compute/cuda/12.8.2/local_installers/cuda_12.8.2_570.211.01_linux.run
sudo sh cuda_12.8.2_570.211.01_linux.run
先に、nvidia-driver-580-openをインストールしているので、Driverを外す。
環境変数を設定する
echo 'export CUDA_HOME=/usr/local/cuda-12.8' >> ${HOME}/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:${LD_LIBRARY_PATH}' >> ${HOME}/.bashrc
echo 'export PATH=/usr/local/cuda-12.8/bin:${PATH}' >> ${HOME}/.bashrc
# 確認
tail ${HOME}/.bashrc
# 設定を即時反映(現在のシェルのみ)
source ${HOME}/.bashrc
# 詳細バージョンを確認
cat /usr/local/cuda-12.8/version.json # version.json
# nvcc コマンドでバージョンを確認
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Fri_Feb_21_20:23:50_PST_2025
Cuda compilation tools, release 12.8, V12.8.93
Build cuda_12.8.r12.8/compiler.35583870_0
cuDNN
アーカイブからもダウンロード出来るでしょう。
https://developer.nvidia.com/cudnn-archive
# ローカルインストール (FULL)
wget https://developer.download.nvidia.com/compute/cudnn/9.24.0/local_installers/cudnn-local-repo-ubuntu2604-9.24.0_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2604-9.24.0_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2604-9.24.0/cudnn-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
# CUDA 12 をインストールするには、パッケージを指定します。
sudo apt-get install cudnn9-cuda-12
### CUDA 13 をインストールするには、パッケージを指定します。
### sudo apt-get install cudnn9-cuda-13
# cuDNN インストールを確認
dpkg -l | grep cudnn
ii cudnn-local-repo-ubuntu2604-9.24.0 1.0-1 amd64 cudnn-local repository configuration files
ii cudnn9-cuda-12 9.24.0.43-1 amd64 NVIDIA cuDNN for CUDA 12
ii cudnn9-cuda-12-9 9.24.0.43-1 amd64 NVIDIA cuDNN for CUDA 12.9
ii libcudnn9-cuda-12 9.24.0.43-1 amd64 cuDNN runtime libraries for CUDA 12.9
ii libcudnn9-dev-cuda-12 9.24.0.43-1 amd64 cuDNN development libraries for CUDA 12.9
ii libcudnn9-headers-cuda-12 9.24.0.43-1 amd64 cuDNN header files for CUDA 12.9
ii libcudnn9-static-cuda-12 9.24.0.43-1 amd64 cuDNN static libraries for CUDA 12.9
Siril Pytonスクリプトが GPUモードを設定
CPU内蔵グラフィックスが画面表示を行い、NVIDIA GeForceは計算ユニットとして使います。
On-demand mode (recommended for laptop users)
https://ubuntu.fan/en/docs/ref/hardware/nvidia#dual-gpu-switching-prime
# Check current mode
prime-select query
# On-demand mode (recommended for laptop users) #GPUモードを On-Demand に設定
sudo prime-select on-demand
# sudo reboot
CUDA、Python、Hashcatなどの場合では、TensorFlowやPyTorchやライブラリ経由でCUDAを使うならば、環境変数などの指定は要らないようです。
Dual GPU Intel-Nvidia / Prime Render Offloading / Ubuntu 20.04 – does not offload
https://forums.developer.nvidia.com/t/dual-gpu-intel-nvidia-prime-render-offloading-ubuntu-20-04-does-not-offload/166864
python version 3.12.13
# sudo make altinstall
ソースから構築したpython3.x コマンドはインストールされますが、python3 コマンドはインストールされません。
これにより、python3 コマンドでは主に使用するバージョンのPythonを起動し、それ以外のバージョンのPythonは、 python3.12 のように、バージョンを指定して実行します。
Ubuntu環境のPython
https://www.python.jp/install/ubuntu/index.html
sudo apt update
sudo apt install build-essential libbz2-dev libdb-dev \
libreadline-dev libffi-dev libgdbm-dev liblzma-dev \
libncursesw5-dev libsqlite3-dev libssl-dev \
zlib1g-dev uuid-dev tk-dev
cd Python-3.12.13
./configure
make
sudo make altinstall
python3.12 --version
Python 3.12.13
python アップデート (Python version 3.12.14)
make uninstallできるかな?- 手動でインストールされた関連ファイルを削除
cd /usr/local/bin実行ファイル(バイナリ)の削除- sudo rm -f /usr/local/bin/python3.12 /usr/local/bin/python3.12-config /usr/local/bin/pip3.12 /usr/local/bin/pydoc3.12 /usr/local/bin/idle3.12 /usr/local/bin/2to3-3.12
- ライブラリ(標準モジュール)の削除
- sudo rm -rf /usr/local/lib/python3.12
- ヘッダーファイルの削除
- sudo rm -rf /usr/local/include/python3.12
マニュアルページの削除- sudo rm -f /usr/local/share/man/man1/python3.12.1
- 共有ライブラリキャッシュの更新
- sudo ldconfig
- Python version 3.12.14をソースビルド、インストール
- sudo make altinstallを用いる
- Siril 1.5 仮想環境デイレクトリをワーキングディレクトリとする
- 仮想環境を 3.12.14 用に更新
python3.12 -m venv --upgradevenv
- 仮想環境を 3.12.14 用に更新
Siril 1.5 Python仮想環境を作ります
以下の作業は、仮想環境下で行います。
全ては、/home/$USER/.local/share/siril 以下にインストールされます。
# Siril 1.5 Python仮想環境ディレクトリを作成
mkdir -p /home/$USER/.local/share/siril
# Python 3.12.13 を使って指定パスに仮想環境を作成
python3.12 -m venv /home/$USER/.local/share/siril/venv
# 仮想環境を有効化 (アクティベート)
source /home/$USER/.local/share/siril/venv/bin/activate
### 仮想環境内にpip のベースを生成する
### python -m ensurepip --upgrade
# pip 自身をインストール、最新版にアップデートする
python -m pip install --upgrade pip
### pip 確認
pip3 --version
PyTorch のインストール
PyTorchの旧バージョンのインストール
最新バージョンのインストールを推奨しますが、便宜上、旧バージョンのバイナリおよびインストール手順を以下に掲載しています。
https://pytorch.org/get-started/previous-versions/
上記を参考にします。
# Siril 1.5 仮想環境で行う
python3.12 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
### python3.12 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
# インストールログ
Successfully installed MarkupSafe-3.0.3 cuda-bindings-12.9.4 cuda-pathfinder-1.2.2 cuda-toolkit-12.8.1 filelock-3.29.0 fsspec-2026.4.0 jinja2-3.1.6 mpmath-1.3.0 networkx-3.6.1 numpy-2.4.4 nvidia-cublas-cu12-12.8.4.1 nvidia-cuda-cupti-cu12-12.8.90 nvidia-cuda-nvrtc-cu12-12.8.93 nvidia-cuda-runtime-cu12-12.8.90 nvidia-cudnn-cu12-9.19.0.56 nvidia-cufft-cu12-11.3.3.83 nvidia-cufile-cu12-1.13.1.3 nvidia-curand-cu12-10.3.9.90 nvidia-cusolver-cu12-11.7.3.90 nvidia-cusparse-cu12-12.5.8.93 nvidia-cusparselt-cu12-0.7.1 nvidia-nccl-cu12-2.28.9 nvidia-nvjitlink-cu12-12.8.93 nvidia-nvshmem-cu12-3.4.5 nvidia-nvtx-cu12-12.8.90 pillow-12.2.0 setuptools-78.1.0 sympy-1.14.0 torch-2.11.0+cu128 torchaudio-2.11.0+cu128 torchvision-0.26.0+cu128 triton-3.6.0 typing-extensions-4.15.0
動作テスト
# インストール確認
python3.12 -c "import torch; print('PyTorch Version:', torch.__version__); print('CUDA Available:', torch.cuda.is_available()); print('GPU Device:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"
PyTorch Version: 2.11.0+cu128
CUDA Available: True
GPU Device: NVIDIA GeForce RTX 5060 Laptop GPU
ONNX Runtime GPU インストール
ONNX RuntimeとCUDAのバージョンの互換性
https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements
CUDA 12.X
https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#cuda-12x
Note: Starting with version 1.27, GPU packages published to PyPI (onnxruntime-gpu) and NuGet (Microsoft.ML.OnnxRuntime.Gpu) are built with CUDA 13.0 by default. Older GPU package versions are built with CUDA 12.8 by default.
バージョン 1.27 以降、PyPI(onnxruntime-gpu)および NuGet(Microsoft.ML.OnnxRuntime.Gpu)に公開されている GPU パッケージは、デフォルトで CUDA 13.0 を使用してビルドされています。それ以前のバージョンの GPU パッケージは、デフォルトで CUDA 12.8 を使用してビルドされています。
https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements
この互換性を元に、ONNX Runtime をインストールするのが大切らしい。
# Siril 仮想環境で行う
source /home/$USER/.local/share/siril/venv/bin/activate
# 以前にruntimeをインストールしているならば、バージョン確認
pip list | grep onnxruntime
pip show onnxruntime-gpu
### 以前にruntimeをインストールしているならば、その関連パッケージを削除
### python3.12 -m pip uninstall onnxruntime onnxruntime-gpu
# python3.12 -m pip install onnxruntime-gpu
# version 1.26をインストールします。
# これ以降のバージョンは、CUDA 13.0 を使用してビルドされています。
python3.12 -m pip install onnxruntime-gpu==1.26.0
Successfully installed flatbuffers-25.12.19 onnxruntime-gpu-1.26.0 packaging-26.3 protobuf-7.35.1
# 動作テスト
python3.12 -c "import onnxruntime as ort; print(ort.get_available_providers())"
CUDA 12.8に適合するPyTorch、ONNX、天体処理用ライブラリを導入
python3.12 -m pip install xisf tifffile astropy pillow pyqt6 sep lz4 zstandard
### python3.12 -m pip install onnxruntime-gpu xisf tifffile astropy pillow pyqt6 sep lz4 zstandard
# インストールログ
Installing collected packages: PyQt6-Qt6, flatbuffers, zstandard, tifffile, sep, PyYAML, PyQt6-sip, pyerfa, protobuf, packaging, lz4, astropy-iers-data, xisf, pyqt6, onnxruntime-gpu, astropy
Successfully installed PyQt6-Qt6-6.11.1 PyQt6-sip-13.12.0 PyYAML-6.0.3 astropy-8.0.1 astropy-iers-data-0.2026.8.3.0.53.6 flatbuffers-25.12.19 lz4-4.4.5 onnxruntime-gpu-1.28.0 packaging-26.3 protobuf-7.35.1 pyerfa-2.0.1.5 pyqt6-6.11.0 sep-1.4.1 tifffile-2026.7.31 xisf-0.9.7 zstandard-0.25.0
Siril 1.5
Siril 1.5 リビルド
sudo apt update
sudo apt install meson git cmake
sudo apt install libglib2.0-dev libgtk-3-dev libgsl-dev liblcms2-dev \
libcfitsio-dev libfftw3-dev libopencv-dev libgtksourceview-4-dev \
libexiv2-dev libraw-dev libjxl-dev libheif-dev libxisf-dev \
libpugixml-dev liblz4-dev libgit2-dev libffms2-dev libcurl4-gnutls-dev
#2026年7月 追加
sudo apt install wcslib-tools libgtk-4-dev libgtksourceview-5-dev
# Sirilソース
git clone --recurse-submodules https://gitlab.com/free-astro/siril.git
# Siril 開発版ビルド、インストール
cd siril
meson setup --prefix /usr/local --buildtype release _build
ninja -C _build
sudo ninja -C _build install
GraXpert
GraXpert 3.1.0rc2
Set GraXpert Executable にて GraXpertファイルを指定して、GraXpert 3.1.0rc2を使います。
# graxpert log
Starting script /home/minmin/.local/share/siril-scripts/processing/GraXpert-AI.py
Installing platformdirs. This may take a few seconds...
Collecting platformdirs
Downloading platformdirs-4.11.0-py3-none-any.whl.metadata (5.5 kB)
Downloading platformdirs-4.11.0-py3-none-any.whl (23 kB)
Installing collected packages: platformdirs
Successfully installed platformdirs-4.11.0
Successfully installed platformdirs
Installing onnx. This may take a few seconds...
Collecting onnx
Downloading onnx-1.22.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (8.5 kB)
Requirement already satisfied: numpy>=1.23.2 in /home/minmin/.local/share/siril/venv/lib/python3.12/site-packages (from onnx) (2.4.4)
Requirement already satisfied: protobuf>=4.25.1 in /home/minmin/.local/share/siril/venv/lib/python3.12/site-packages (from onnx) (7.35.1)
Requirement already satisfied: typing_extensions>=4.15.0 in /home/minmin/.local/share/siril/venv/lib/python3.12/site-packages (from onnx) (4.15.0)
Collecting ml_dtypes>=0.5.4 (from onnx)
Downloading ml_dtypes-0.5.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (8.9 kB)
Downloading onnx-1.22.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (19.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.1/19.1 MB 8.9 MB/s 0:00:02
17:49:44: Downloading ml_dtypes-0.5.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.0/5.0 MB 8.4 MB/s 0:00:00
Installing collected packages: ml_dtypes, onnx
Successfully installed ml_dtypes-0.5.4 onnx-1.22.0
Successfully installed onnx
Detected ONNX Runtime with providers: ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']
ONNX Runtime is already installed: onnxruntime-gpu
numpy is installed
astropy is installed
Installing appdirs. This may take a few seconds...
Collecting appdirs
Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)
Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Installing collected packages: appdirs
Successfully installed appdirs-1.4.4
Successfully installed appdirs
Installing opencv-python. This may take a few seconds...
Collecting opencv-python
Downloading opencv_python-5.0.0.93-cp37-abi3-manylinux_2_28_x86_64.whl.metadata (19 kB)
Requirement already satisfied: numpy>=2 in /home/minmin/.local/share/siril/venv/lib/python3.12/site-packages (from opencv-python) (2.4.4)
Downloading opencv_python-5.0.0.93-cp37-abi3-manylinux_2_28_x86_64.whl (73.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.8/73.8 MB 8.9 MB/s 0:00:08
Installing collected packages: opencv-python
Successfully installed opencv-python-5.0.0.93
Successfully installed opencv-python
PyQt6 is installed
Running command: requires
OK! This script is compatible with this version of Siril.
# Deconvolution log
Python communication worker finished...
Starting script /home/minmin/.local/share/siril-scripts/processing/GraXpert-AI.py
platformdirs is installed
onnx is installed
Detected ONNX Runtime with providers: ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']
ONNX Runtime is already installed: onnxruntime-gpu
numpy is installed
astropy is installed
appdirs is installed
opencv-python is installed
PyQt6 is installed
Running command: requires
OK! This script is compatible with this version of Siril.
Starting deconvolution
Calculated normalized PSFsize value: 0.2951167728237792
=== ONNX Execution Provider Tester ===
Creating ONNX model...
Model saved to temporary file: /tmp/tmpnm_0t04i.onnx
Running reference on CPU...
OK: CPU output computed.
Available execution providers:
- TensorrtExecutionProvider
- CUDAExecutionProvider
- CPUExecutionProvider
Testing each provider without fallback...
Testing TensorrtExecutionProvider...
*************** EP Error ***************
EP Error /onnxruntime_src/onnxruntime/python/onnxruntime_pybind_state.cc:534 void onnxruntime::python::RegisterTensorRTPluginsAsCustomOps(PySessionOptions&, const onnxruntime::ProviderOptions&) Please install TensorRT libraries as mentioned in the GPU requirements page, make sure they're in the PATH or LD_LIBRARY_PATH, and that your GPU is supported.
when using ['TensorrtExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.
****************************************
(x) TensorrtExecutionProvider: fallback occurred (used CPUExecutionProvider)
Testing CUDAExecutionProvider...
OK: CUDAExecutionProvider ran successfully
Testing CPUExecutionProvider...
OK: CPUExecutionProvider ran successfully
=== Summary ===
OK: Working providers (in priority order):
- CUDAExecutionProvider
- CPUExecutionProvider
→ Best available provider: CUDAExecutionProvider
Cached execution providers to /home/minmin/.config/siril/siril_onnx.conf
Using inference providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']
Finished deconvolution
Cosmic Clarity Suite
CosmicClaritySuite_Linux_AlternateBuildを配置する
/use/local/share/CosmicClaritySuite_Linux_AlternateBuild/
├── SetiAstroCosmicClarity
├── SetiAstroCosmicClarity_denoise
├── 📁 models/ (← ここにmodelsフォルダごと置く)
│ ├── 各種AIモデルファイル(.onnx や .pth など)
└── run_Sharpen.sh, run_Sharpen.sh, 及びその他の付属ファイル群
Cosmic Clarity Sharpening を展開
pyinstxtractor.py を使って、SetiAstroCosmicClarity を展開します。
# Siril 1.5 仮想環境で行う
source /home/$USER/.local/share/siril/venv/bin/activate
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild
python3.12 pyinstxtractor.py ./SetiAstroCosmicClarity
[+] Processing ./SetiAstroCosmicClarity
[+] Pyinstaller version: 2.1+
[+] Python version: 3.12
[+] Length of package: 57264312 bytes
[+] Found 17 files in CArchive
[+] Beginning extraction...please standby
[+] Possible entry point: pyiboot01_bootstrap.pyc
[+] Possible entry point: pyi_rth_inspect.pyc
[+] Possible entry point: pyi_rth_pkgutil.pyc
[+] Possible entry point: pyi_rth_multiprocessing.pyc
[+] Possible entry point: pyi_rth_pkgres.pyc
[+] Possible entry point: pyi_rth_setuptools.pyc
[+] Possible entry point: pyi_rth_mplconfig.pyc
[+] Possible entry point: pyi_rth_cryptography_openssl.pyc
[+] Possible entry point: pyi_rth_pyqt6.pyc
[+] Possible entry point: pyi_rth__tkinter.pyc
[+] Possible entry point: setiastrocosmicclaritylinux.pyc
[+] Found 7078 files in PYZ archive
[+] Successfully extracted pyinstaller archive: ./SetiAstroCosmicClarity
You can now use a python decompiler on the pyc files within the extracted directory
SetiAstroCosmicClarity_extracted ディレクトリにある、
setiastrocosmicclaritylinux.pyc を
CosmicClaritySuite_Linux_AlternateBuild ディレクトリに配置
# 動作確認
python3.12 ./setiastrocosmicclaritylinux.pyc
Using device: cuda (CUDA)
Identified 32bit floating point FITS iamge.
Sharpening Image: result_drizzle_19620s.fit
Total Chunks: 225
Stellar Sharpening:
Progress: 100.00% (225/225 chunks processed)
Stellar sharpening complete. Shape: (2877, 2877)
Saved 32-bit float sharpened image to: /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/./output/result_drizzle_19620s_sharpened.fit
後日に気づいたのですが、
https://github.com/setiastro/cosmicclarity
ここにある、”SetiAstroCosmicClarity.py” を使っても良いのかな?
ラッパーファイルを作成 run_Sharpen.shは以下になる?
#!/bin/bash
source “$HOME/.local/share/siril/venv/bin/activate”
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/
python3.12 ./setiastrocosmicclaritylinux.py “$@”
Cosmic Clarity Sharpening ラッパーを作成
### ラッパーファイルを作成 run_Sharpen.sh
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/
以下が、run_Sharpen.sh
#!/bin/bash
source "$HOME/.local/share/siril/venv/bin/activate"
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/
python3.12 ./setiastrocosmicclaritylinux.pyc "$@"
# 実行権
chmod +x ./run_Sharpen.sh
"$@" について
シェルスクリプトにおける “$@” は、
スクリプトに渡されたすべての引数を、元の区切り(スペースなど)を完全に保ったまま展開する特殊な変数
"$@" について参考にしたサイト
https://qiita.com/ko1nksm/items/98952723d7a71799673c
Cosmic Clarity Sharpening を設定
Cosmic Clarity Sharpening Settings
Cosmic Clarity Executable: run_Sharpen.sh (上記ラッパー)を指定する。
RTX 5060 動作確認
source /home/$USER/.local/share/siril/venv/bin/activate
pip list |grep torch
torch 2.11.0+cu128
torchaudio 2.11.0+cu128
torchvision 0.26.0+cu128
pip list |grep torch-cuda80 ###←要確認
pip list |grep torch-model-archiver
pip list |grep torchrec-cpu
# 動作確認
python3.12 -c "import torch; print(torch.__version__, torch.cuda.is_available(), torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"
2.11.0+cu128 True NVIDIA GeForce RTX 5060 Laptop GPU
# 動作確認
python3.12 -c "import torch; print('Version:', torch.__version__); print('CUDA:', torch.cuda.is_available()); print('Device Name:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"
Version: 2.11.0+cu128
CUDA: True
Device Name: NVIDIA GeForce RTX 5060 Laptop GPU
Cosmic Clarity denoise を展開
python3.12 pyinstxtractor.py /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/SetiAstroCosmicClarity_denoise
# Siril 1.5 仮想環境で行う
pwd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild
python3.12 pyinstxtractor.py ./SetiAstroCosmicClarity_denoise
# 動作確認
python3.12 ./setiastrocosmicclaritylinux.pyc
Cosmic Clarity denoise ラッパーを作成
### ラッパーファイルを作成 run_Denoise.sh
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/
以下が、run_Denoise.sh
#!/bin/bash
### RTX 5060(12.0)
### export TORCH_CUDA_ARCH_LIST="9.0"
### export TORCH_CUDA_ARCH_LIST="12.0"
source "$HOME/.local/share/siril/venv/bin/activate"
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/
python3.12 ./SetiAstroCosmicClarity_denoise.pyc "$@"
Cosmic Clarity Denoise を設定
Cosmic Clarity Executable
run_Sharpen.sh (上記ラッパー)を指定する。
ここまでが、本記事の本文になります。
参考:SetiAstroCosmicClarityが動かない時の試行錯誤
途中で作業を止めています。
./SetiAstroCosmicClarity を動作確認
./SetiAstroCosmicClarity
PyInstaller/loader/pyimod02_importers.py:450: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
/usr/lib/x86_64-linux-gnu/gvfs/libgvfscommon.so: undefined symbol: g_variant_builder_init_static
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
動かない。。。
githubにある [SetiAstroCosmicClarity.py] を使ってみる。
https://github.com/setiastro/cosmicclarity
[SetiAstroCosmicClarity.py] を /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/へ置く。
source /home/$USER/.local/share/siril/venv/bin/activate
cd /usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/
python3.12 SetiAstroCosmicClarity.py
CUDA 12.8.2(2026年4月リリース版)は、CUDA 12系のビルドであり、古いONNX RuntimeやPyTorchの安定版との親和性があるらしい。
ONNX Runtime: onnxruntime-gpu==1.26.0 を用いる
直面した問題と原因
配布されているポータブルバイナリ(AlternateBuild 版の SetiAstroCosmicClarity や setiastrobenchmark)をそのまま実行した際、問題が発生。
- GLib/GIOライブラリの衝突:
- 現象:
libgvfscommon.so: undefined symbolエラー - 原因: バイナリに内包された古い
libglibが、Ubuntu 26.04の最新デスクトップ環境(GVFS)と競合
- 現象:
- CUDAカーネルのミスマッチ(致命的):
- 現象:
RuntimeError: CUDA error: no kernel image is available for execution on the device(コアダンプ)。 - 原因: バイナリに内包されていたPyTorchが
2.4.1+cu124(CUDA 12.4用) であったため、RTX5060 GPUを駆動するための計算データ(カーネル)が不足し、処理開始と同時にクラッシュ。
- 現象:
バイナリの仕様を諦め、公式の生のソースコード(.py)を改変する。
1)本体スクリプトの取得と配置
- ディレクトリ
/usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/に移動。 - 公式GitHubより
SetiAstroCosmicClarity.pyをダウンロード。
https://github.com/setiastro/cosmicclarity - 同フォルダ内のモデルデータ(
models/内の~_AI4.onnxなど)をそのまま利用できる状態に統合。
2)本体スクリプト(SetiAstroCosmicClarity.py)の改造
Sirilからの自動連携(画面を開かないCLI処理)に対応させるため、ファイル最末尾の引数解析ブロックを以下のように書き換えました。
# --- 引数に --input を追加 ---
parser.add_argument('--input', type=str, help="Path to the input TIFF/FIT image")
args = parser.parse_args()
use_gpu = not args.disable_gpu
# --- 引数があれば入力パスを上書き ---
if args.input:
input_dir = args.input
print(f"[CLI Mode] Input file overrides to: {input_dir}")
# --- 処理を実行 ---
process_images(input_dir, output_dir, args.sharpening_mode, args.nonstellar_strength, args.stellar_amount, args.nonstellar_amount, use_gpu, args.sharpen_channels_separately, args.auto_detect_psf)
3)Siril用スクリプトの配置
ディレクトリ ~/.local/share/siril-scripts/processing/ に、新しく CosmicClarity_Sharpen_CUDA.py を作成し、以下の完全版コードを配置(他のファイルと同様、実行権限 +x は不要)。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, subprocess os
# ユーザー名($USER)を自動取得して最新のCUDA環境を直接指定
current_user = os.environ.get("USER")
PYTHON_ENV = f"/home/{current_user}/.local/share/siril/venv/bin/python3.12"
CC_SCRIPT = "/usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/SetiAstroCosmicClarity.py"
def main():
args = sys.argv[1:]
cleaned_args = []
for arg in args:
if "SetiAstroCosmicClarity" in arg or arg.endswith(".py"):
continue
cleaned_args.append(arg)
# 完璧に構築したPython仮想環境で本体スクリプトをキック
cmd = [PYTHON_ENV, CC_SCRIPT] + cleaned_args
print(f"[Siril-CUDA-CC] Redirecting execution via CUDA 12.8.2...")
try:
subprocess.run(cmd, check=True, text=True)
print("[Siril-CUDA-CC] CosmicClarity sharpening process completed successfully!")
except subprocess.CalledProcessError as e:
sys.exit(1)
if __name__ == "__main__":
main()
4)Siril上のGUI設定
- Siril 1.5の設定画面にある「Cosmic Clarity Executable」のBrowseボタンから、ダミーの実行トリガーとして
/usr/local/share/CosmicClaritySuite_Linux_AlternateBuild/SetiAstroCosmicClarity.pyを指定。 - Siril上部メニューの「スクリプト」から、追加された
CosmicClarity_Sharpen_CUDAを選択して実行。

コメント