#author("2025-10-29T06:23:52+00:00","default:sysosa","sysosa")
#author("2025-10-29T06:35:03+00:00","default:sysosa","sysosa")
本家様 [[http://pymol.org/>+http://pymol.org/]]
シュレーディンガー社様から販売されております. 一方でそのオープンソース版が存在していてここではそのオープンソース版を作ってみました.
[[https://github.com/schrodinger/pymol-open-source>+https://github.com/schrodinger/pymol-open-source]]

&size(10){有償版PyMOLはopen source版よりも機能が強化されてます};
&size(10){windowsOS向けopen source版は試してないです..};

ver3.1.0になったので改めて作ってみた.
RHEL系はOSに直に作るのは難しいみたい. 直前の3.1.0a0ならいけたけど、今後はcondaの上で作る事にします.
ubuntu22はPyMOLのWorkflowに載っているのですんなり行ける. けどubuntu24.04はテストrunが出来なかった.

***Rockylinux10 [#y99f7069]
condaでコンパイル環境を作って実行したが「__cxa_call_terminate」のundefined symbolで起動しない.
恐らくcondaのコンパイル環境の問題っぽいのでOS上に作ってみた
#code(nonumber){{
dnf install epel-release -y
dnf config-manager --enable crb
dnf install xcb-util-wm xcb-util-image xcb-util-keysyms xcb-util-renderutil -y
dnf install https://dl.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/g/glm-devel-0.9.9.8-3.el9.noarch.rpm -y
dnf --enablerepo=devel install cmake netcdf-devel glew-devel libpng-devel   libxml2-devel freetype-devel catch2-devel msgpack-devel python3-qt5-devel python3-devel python3-numpy -y
wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2
bzip2 -cd collada2gltf-2.1.4-h6bb024c_0.tar.bz2 | tar xf - -C /usr/local
rm -rf collada2gltf-2.1.4-h6bb024c_0.tar.bz2
git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* /usr/local/include
rm -rf mmtf-cpp

cd /apps/src/
git clone https://github.com/schrodinger/pymol-open-source
cd pymol-open-source/
python3 setup.py install --prefix=/apps/pymol
}}

修正「/apps/pymol/bin/pymol」
#code(nonumber){{
exec "/usr/bin/python3" "/usr/local/lib/python3.12/site-packages/pymol/__init__.py" "$@"

exec "/usr/bin/python3" "/apps/pymol/lib64/python3.12/site-packages/pymol/__init__.py" "$@"
}}

/apps/modulefiles/pymol
#code(nonumber){{
#%Module1.0
set root /apps/pymol
prepend-path PATH        $root/bin
prepend-path PYTHONPATH  $root/lib64/python3.12/site-packages
}}

***Rockylinux9 [#h332c459]
既定のpythonは3.9 で gcc は gcc-11.5  

#code(nonumber){{
(OSパッケージの追加インストールと関連アプリのインストール)
dnf groupinstall "Development Tools" -y
dnf install epel-release -y
dnf install xcb-util-wm xcb-util-image xcb-util-keysyms xcb-util-renderutil -y
dnf --enablerepo=devel install cmake netcdf-devel glew-devel glm-devel libpng-devel libxml2-devel freetype-devel catch2-devel msgpack-devel -y

wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2
bzip2 -cd collada2gltf-2.1.4-h6bb024c_0.tar.bz2 | tar xf - -C /usr/local
rm -rf collada2gltf-2.1.4-h6bb024c_0.tar.bz2

git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* /usr/local/include
rm -rf mmtf-cpp/

(pyenv-anacondaの敷設)
git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install miniforge3-25.3.1-0
}}

#code(nonumber){{
[root@rockylinux9 ~]# source /apps/pyenv/versions/miniforge3-25.3.1-0/etc/profile.d/conda.sh
[root@rockylinux9 ~]# conda create -n pymol-open-source python=3.10 openldap pyqt qt biopython msgpack-python vtk-m=2.3=cuda* -y
[root@rockylinux9 ~]# conda activate pymol-open-source

(pymol-open-source) [root@rockylinux9 ~]# cd /apps/src/
(pymol-open-source) [root@rockylinux9 src]# git clone https://github.com/schrodinger/pymol-open-source
(pymol-open-source) [root@rockylinux9 src]# cd pymol-open-source/
(pymol-open-source) [root@rockylinux9 pymol-open-source]#
}}
ここで vtk-m を有効にするためにちょいとソースコードを修正します
#code(diff,nonumber){{
diff --git a/layer0/ContourSurf.cpp b/layer0/ContourSurf.cpp
index 143ce83a..380fcf04 100644
--- a/layer0/ContourSurf.cpp
+++ b/layer0/ContourSurf.cpp
@@ -82,7 +82,7 @@ using ::copysign;

 #include <vtkm/Version.h>
 #include <vtkm/cont/DataSetBuilderUniform.h>
-#include <vtkm/filter/Contour/Contour.h>
+#include <vtkm/filter/contour/Contour.h>

 #include <cassert>
 #include <set>
}}
その上で
#code(nonumber){{
(pymol-open-source) [root@rockylinux9 pymol-open-source]#
(pymol-open-source) [root@rockylinux9 pymol-open-source]# INCFLAGS="-I/apps/pyenv/versions/miniforge3-25.3.1-0/envs/pymol-open-source/include/vtkm-2.3" \
     pip install --prefix=/apps/pymol --config-settings use-vtkm=2.3 --config-settings use-openmp=true  .

(pymol-open-source) [root@rockylinux9 pymol-open-source]#
}}

EnvironmentModules は下記になる.
「/apps/modulefiles/pymol」

#code(nonumber){{
#%Module1.0
set root /apps/pymol
prepend-path PATH        $root/bin
prepend-path PYTHONPATH  $root/lib/python3.10/site-packages
}}

&ref(2025y09m16d_040350139.png,nolink);







***Rockylinux8 [#o04b017b]


condaで仮想環境を作りpymolをコンパイルします。

#code(nonumber){{
(OSパッケージの追加インストールと関連アプリのインストール)
dnf groupinstall "Development Tools" -y
dnf install epel-release -y
dnf install xcb-util-wm xcb-util-image xcb-util-keysyms xcb-util-renderutil gcc-toolset-11 -y
dnf install --enablerepo=epel,devel cmake netcdf-devel glew-devel libpng-devel libxml2-devel  freetype-devel catch-devel mmtf-cpp-devel -y
dnf remove glm-devel -y
dnf install https://dl.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/g/glm-devel-0.9.9.8-3.el9.noarch.rpm -y

wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2
bzip2 -cd collada2gltf-2.1.4-h6bb024c_0.tar.bz2 | tar xf - -C /usr/local
rm -rf collada2gltf-2.1.4-h6bb024c_0.tar.bz2

git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* /usr/local/include
rm -rf mmtf-cpp/

(pyenv-anacondaの敷設)
git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install miniforge3-25.3.1-0
}}

#code(nonumber){{
[root@rockylinux8 ~]# source /apps/pyenv/versions/miniforge3-25.3.1-0/etc/profile.d/conda.sh
[root@rockylinux9 ~]# conda create -n pymol-open-source python=3.10 openldap pyqt qt biopython msgpack-python vtk-m=2.3=cuda* -y
[root@rockylinux8 ~]# conda activate pymol-open-source
(pymol-open-source) [root@rockylinux8 ~]# cd /apps/src/
(pymol-open-source) [root@rockylinux8 src]# git clone https://github.com/schrodinger/pymol-open-source
(pymol-open-source) [root@rockylinux8 src]# cd pymol-open-source/
(pymol-open-source) [root@rockylinux8 pymol-open-source]# 
}}

vtk-m を有効にしたいのですが、ソースコード側でタイポがあるのでちょいと修正
#code(nonumber){{
(pymol-open-source) [root@rockylinux8 pymol-open-source]# vi layer0/ContourSurf.cpp
#include <vtkm/filter/Contour/Contour.h>
 ↓
#include <vtkm/filter/contour/Contour.h>
}}
その上で
#code(nonumber){{
(pymol-open-source) [root@rockylinux8 pymol-open-source]# source scl_source enable gcc-toolset-11

(pymol-open-source) [root@rockylinux8 pymol-open-source]# INCFLAGS="-I/apps/pyenv/versions/miniforge3-25.3.1-0/envs/pymol-open-source/include/vtkm-2.3" \
     pip install --prefix=/apps/pymol --config-settings use-vtkm=2.3 --config-settings use-openmp=true  .

(pymol-open-source) [root@rockylinux8 pymol-open-source]# conda deactivate
[root@rockylinux8 pymol-open-source]#
}}

EnvironmentModules は下記のようにします
/apps/modulefiles/pymol
#code(nonumber){{
#%Module1.0
prepend-path PATH        /apps/pymol/bin
prepend-path PYTHONPATH  /apps/pymol/lib/python3.10/site-packages
}}
これで「module use /apps/modulefiles」「module load pymol」として「pymol」で起動します


&ref(2025y10m29d_152254985.png,nolink);


***ubuntu24.04 [#z3365d01]
Python 3.12.3
gcc 13.3.0

#code(nonumber){{
(準備)
apt-get update
apt-get install catch2 cmake libfreetype6-dev libglew-dev libglm-dev libmsgpack-dev libnetcdf-dev libpng-dev libxml2-dev  python-is-python3  \
python3-biopython python3-dev python3-setuptools  python3-numpy python3-pip git build-essential python3-qtpy -y

wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2
bzip2 -cd collada2gltf-2.1.4-h6bb024c_0.tar.bz2 | tar xf - -C /usr/local

git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* /usr/local/include
}}
っで構築
#code(nonumber){{
root@ubuntu22:~# mkdir -p /apps/src ; cd /apps/src
root@ubuntu22:/apps/src# git clone https://github.com/schrodinger/pymol-open-source
root@ubuntu22:/apps/src# cd pymol-open-source/
root@ubuntu22:/apps/src/pymol-open-source# pip install -v --prefix=/apps/PyMOL .
}}

テスト確認を行ってみたが、「catch2/catch.hpp」が存在しないと言われてエラーになる. testing=Trueで求められる項目がコンパイルできないみたい.
#code(nonumber){{
rm -rf build/
pip install -v --config-settings testing=True --prefix=/apps/PyMOL '.[dev]'
(途中でコンパイルエラー)
export PATH=/apps/PyMOL/local/bin:$PATH
export PYTHONPATH=/apps/PyMOL/local/lib/python3.12/dist-packages
pymol -ckqy testing/testing.py --run all
}}

environment-modules
「/apps/modulefiles/PyMOL」
#code(nonumber){{
#%Module1.0
prepend-path PATH        /apps/PyMOL/local/bin
prepend-path PYTHONPATH  /apps/PyMOL/local/lib/python3.12/dist-packages
}}

&ref(2025y02m01d_195740885.png,nolink);

もし「&color(red){ERROR: Cannot uninstall numpy 1.26.4, RECORD file not found. Hint: The package was installed by debian};」と表示されたら、OS提供の python3-numpy が原因でこれを除くといいみたい
&size(10){ただ、OS提供のパッケージなので影響があるかもしれない.. pyenv/anaconda で conda で用意した方がいいのかも};

***ubuntu22.04 [#ae15f725]
Python 3.10.12
gcc 11.4.0

#code(nonumber){{
apt-get update

apt-get --no-install-recommends install catch2 cmake libfreetype6-dev libglew-dev libglm-dev libmsgpack-dev libnetcdf-dev libpng-dev libxml2-dev  python-is-python3  \
python3-biopython python3-dev python3-setuptools  python3-numpy python3-pip git build-essential python3-qtpy -y

wget -nv https://anaconda.org/schrodinger/collada2gltf/2.1.4/download/linux-64/collada2gltf-2.1.4-h6bb024c_0.tar.bz2
bzip2 -cd collada2gltf-2.1.4-h6bb024c_0.tar.bz2 | tar xf - -C /usr/local

git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* /usr/local/include

pip install --upgrade pip

root@ubuntu22:~# mkdir -p /apps/src ; cd /apps/src
root@ubuntu22:/apps/src# git clone https://github.com/schrodinger/pymol-open-source
root@ubuntu22:/apps/src# cd pymol-open-source/
root@ubuntu22:/apps/src/pymol-open-source# pip install -v --prefix=/apps/PyMOL .


(テスト確認)
rm -rf build/
pip install -v --config-settings testing=True --prefix=/apps/PyMOL '.[dev]'
export PATH=/apps/PyMOL/local/bin:$PATH
export PYTHONPATH=/apps/PyMOL/local/lib/python3.10/dist-packages
pymol -ckqy testing/testing.py --run all
}}


environment-modules
「/apps/modulefiles/PyMOL」
#code(nonumber){{
#%Module1.0
prepend-path PATH        /apps/PyMOL/local/bin
prepend-path PYTHONPATH  /apps/PyMOL/local/lib/python3.10/dist-packages
}}

&ref(2025y02m01d_053045320.png,nolink);
1

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS