LoginSignup
0
0

More than 1 year has passed since last update.

Windows11にopen-source PyMOLをインストールする

Last updated at Posted at 2023-01-24

PyMOLはバイナリ版(有償ライセンス)とopen-source版(無償)があります.詳しくは@Ag_smithさんのmacOS/CentOS 7/Ubuntu 20.04へのオープンソース版PyMOL 2.5のインストール方法やWindows10へのインストールに関してはWindows10にPyQt5レンダリングのPyMOLをインストールする (2021年2月12日版)をご覧下さい.今回はopen-source PyMOLのインストール先がWindows11なので,ほとんど上記リンクを参考にしました.

基本的にMac/Ubuntuで仕事をしていますが,周囲にはWindowsユーザーも多く,PyMOLを使って欲しいと思って人柱的にインストールしようとしたら色々問題が生じたので,問題と解決方法を示します.使用するOSに限らずユーザーによって環境が異なるのがPCの特徴ですので,これを見ても必ずうまくいくというわけではないとご理解下さい.Windowsのコマンドプロンプト初心者で,別にPythonに通じてるわけでもないので見よう見まねで七転八倒しながらやりました.

WindowsへのPyMOLインストール手順

参考資料1:Windows10にPyQt5レンダリングのPyMOLをインストールする (2021年2月12日版)(著:@Ag_smith)

1.Anaconda(Python)環境の整備
2.PyMOLインストール(Pmw, Numpy, PyMOL, PyMOLランチャー)
3.PyMOL表示設定(PyQT5)
4.起動

最初は上記資料に従って行い,PyMOLを起動するところまでは行きました.
しかしその先は,File/Edit/Build/Movie等のタブをクリックしても反応せず,fetch PDBIDでも分子表示ができず手詰まりとなりました.理由は不明でしたが一からやり直すことにしました.以下に初手情報としてインストールしたFilesを記しておきます.

初手情報

  • Pmw-2.0.1-py3-none-any.whl
  • numpy-1.22.4+mkl-cp39-cp39-win_amd64.whl
  • pymol-2.5.0-cp39-cp39-win_amd64.whl
  • pymol_launcher-2.5-cp39-cp39-win_amd64.whl

Pythonがv3.9なのでcp39で揃えたつもりで,上記資料中から0a0はstableではないので2.5.0を選択しました.

pip upgrade

最初にアップグレードしたときはちゃんとできたか分からなかったので(少なくともエラーメッセージは出なかった)再度アップグレードしました.

(base) C:\Users\~\anaconda3>python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\~\anaconda3\lib\site-packages (22.2.2)
Collecting pip
  Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)
     ---------------------------------------- 2.1/2.1 MB 10.9 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.2.2
    Uninstalling pip-22.2.2:
      Successfully uninstalled pip-22.2.2
Successfully installed pip-22.3.1

前回はSuccessfully installedにはなっていなかったので,もしかしたら資料中の表記とは異なるエラーメッセージだったのかもしれません.

各種再インストール

Pmw-2.0.1-py3-none-any.whl

既にインストール済みなのですが,強制再インストールしたかったので,--force-reinstallを付けています.

(base) C:\Users\~\anaconda3>python.exe -m pip install Pmw-2.0.1-py3-none-any.whl
Processing c:\users\~\anaconda3\pmw-2.0.1-py3-none-any.whl
Pmw is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

(base) C:\Users\~\anaconda3>python.exe -m pip install --force-reinstall Pmw-2.0.1-py3-none-any.whl
Processing c:\users\~\anaconda3\pmw-2.0.1-py3-none-any.whl
Installing collected packages: Pmw
  Attempting uninstall: Pmw
    Found existing installation: Pmw 2.0.1
    Uninstalling Pmw-2.0.1:
      Successfully uninstalled Pmw-2.0.1
Successfully installed Pmw-2.0.1

numpy-1.22.4+mkl-cp39-cp39-win_amd64.whl

(base) C:\Users\~\anaconda3>python.exe -m pip install --force-reinstall numpy-1.22.4+mkl-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\numpy-1.22.4+mkl-cp39-cp39-win_amd64.whl
Installing collected packages: numpy
  Attempting uninstall: numpy
    Found existing installation: numpy 1.22.4+mkl
    Uninstalling numpy-1.22.4+mkl:
      Successfully uninstalled numpy-1.22.4+mkl
ERROR: Could not install packages due to an OSError: [WinError 5] アクセスが拒否されました。: 'C:\\Users\\~\\anaconda3\\Lib\\site-packages\\~umpy\\core\\_multiarray_tests.cp39-win_amd64.pyd'
Consider using the `--user` option or check the permissions.


(base) C:\Users\~\anaconda3>python.exe -m pip install numpy-1.22.4+mkl-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\numpy-1.22.4+mkl-cp39-cp39-win_amd64.whl
numpy is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

途中エラーメッセージが出たのですがインストールは出来ているようです(reinstall前のものかもしれない)

pymol-2.6.0a0-cp39-cp39-win_amd64.whl

初手ではpymol-2.5.0-cp39-cp39-win_amd64.whlをインストールしましたが,PyMOL操作ができなかったので最新版をインストールしてみました.

(base) C:\Users\~\anaconda3>python.exe -m pip install pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Requirement already satisfied: numpy in c:\users\~\anaconda3\lib\site-packages (from pymol==2.6.0a0) (1.22.4+mkl)
Requirement already satisfied: Pmw in c:\users\~\anaconda3\lib\site-packages (from pymol==2.6.0a0) (2.0.1)
Installing collected packages: pymol
  Attempting uninstall: pymol
    Found existing installation: pymol 2.5.0
    Uninstalling pymol-2.5.0:
      Successfully uninstalled pymol-2.5.0
ERROR: Could not install packages due to an OSError: [WinError 5] アクセスが拒否されました。: 'C:\\Users\\~\\anaconda3\\Lib\\site-packages\\~ymol\\_cmd.cp39-win_amd64.pyd'
Consider using the `--user` option or check the permissions.


(base) C:\Users\~\anaconda3>python.exe -m pip install pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Requirement already satisfied: numpy in c:\users\~\anaconda3\lib\site-packages (from pymol==2.6.0a0) (1.22.4+mkl)
Requirement already satisfied: Pmw in c:\users\~\anaconda3\lib\site-packages (from pymol==2.6.0a0) (2.0.1)
pymol is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

Successfully uninstalled pymol-2.5.0のあとに同様のエラーメッセージが出ましたが,再度インストールを試みると既に2.6.0a0が入っていると出るのでインストールは完了したはずです.
しかし,本当にそうか分からなかったので,--force-reinstallで強制再インストールをしました.

(base) C:\Users\~\anaconda3>python.exe -m pip install --force-reinstall pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Collecting Pmw
  Downloading Pmw-2.1.1.tar.gz (1.1 MB)
     ---------------------------------------- 1.1/1.1 MB 6.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting numpy
  Downloading numpy-1.24.1-cp39-cp39-win_amd64.whl (14.9 MB)
     ---------------------------------------- 14.9/14.9 MB 10.7 MB/s eta 0:00:00
Building wheels for collected packages: Pmw
  Building wheel for Pmw (setup.py) ... done
  Created wheel for Pmw: filename=Pmw-2.1.1-py3-none-any.whl size=547471 sha256=5e16f82269a4ac5dd53dadd09e9205bcdc82e2cae90b81b047a3d68ba64ffb13
  Stored in directory: c:\users\~\appdata\local\pip\cache\wheels\6d\3e\71\c291cb13329664bcd4fe20917efa4d0db43914d4c533fa2946
Successfully built Pmw
Installing collected packages: Pmw, numpy, pymol
  Attempting uninstall: Pmw
    Found existing installation: Pmw 2.0.1
    Uninstalling Pmw-2.0.1:
      Successfully uninstalled Pmw-2.0.1
  Attempting uninstall: numpy
    Found existing installation: numpy 1.22.4+mkl
    Uninstalling numpy-1.22.4+mkl:
      Successfully uninstalled numpy-1.22.4+mkl
  Attempting uninstall: pymol
    Found existing installation: pymol 2.6.0a0
    Uninstalling pymol-2.6.0a0:
      Successfully uninstalled pymol-2.6.0a0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
daal4py 2021.6.0 requires daal==2021.4.0, which is not installed.
numba 0.55.1 requires numpy<1.22,>=1.18, but you have numpy 1.24.1 which is incompatible.
Successfully installed Pmw-2.1.1 numpy-1.24.1 pymol-2.6.0a0

毎度のことながらエラーメッセージは出ますが,今回はSuccessfully installed Pmw-2.1.1 numpy-1.24.1 pymol-2.6.0a0と出ているので,インストールはうまくいきました.

pymol_launcher-2.5-cp39-cp39-win_amd64.whl

PyMOLとPyMOL Launcherは同じバージョンの必要があるはずですがとりあえず再インストールしてみます.

(base) C:\Users\~\anaconda3>python.exe -m pip install --force-reinstall pymol_launcher-2.5-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pymol_launcher-2.5-cp39-cp39-win_amd64.whl
ERROR: Could not find a version that satisfies the requirement pymol (from pymol-launcher) (from versions: none)
ERROR: No matching distribution found for pymol

当然のようにPyMOLとPyMOL-Launcherのバージョンが合わないのでインストールできません.ここで再度手詰まりになりました.再度PyMOL-2.5.0をインストールすればうまくいくのかもしれないと思いながら,色々検索していたら,本家PyMOLWiki–Windows installにバージョンの食い違いの状況下での2.6.0a0のインストール方法が記載されていたので参考にしました.

(base) C:\Users\~\anaconda3>python.exe -m pip install --force-reinstall --no-index --find-links="%CD%" pymol_launcher-2.5-cp39-cp39-win_amd64.whl
Looking in links: c:\Users\~\anaconda3
Processing c:\users\~\anaconda3\pymol_launcher-2.5-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pymol-2.5.0-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pmw-2.0.1-py3-none-any.whl
Processing c:\users\~\anaconda3\numpy-1.22.4+vanilla-cp39-cp39-win_amd64.whl
Installing collected packages: Pmw, numpy, pymol, pymol-launcher
  Attempting uninstall: Pmw
    Found existing installation: Pmw 2.0.1
    Uninstalling Pmw-2.0.1:
      Successfully uninstalled Pmw-2.0.1
  Attempting uninstall: numpy
    Found existing installation: numpy 1.22.4+vanilla
    Uninstalling numpy-1.22.4+vanilla:
      Successfully uninstalled numpy-1.22.4+vanilla
  Attempting uninstall: pymol
    Found existing installation: pymol 2.5.0
    Uninstalling pymol-2.5.0:
      Successfully uninstalled pymol-2.5.0
  Attempting uninstall: pymol-launcher
    Found existing installation: pymol-launcher 2.5
    Uninstalling pymol-launcher-2.5:
      Successfully uninstalled pymol-launcher-2.5
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
daal4py 2021.6.0 requires daal==2021.4.0, which is not installed.
numba 0.55.1 requires numpy<1.22,>=1.18, but you have numpy 1.22.4+vanilla which is incompatible.
Successfully installed Pmw-2.0.1 numpy-1.22.4+vanilla pymol-2.5.0 pymol-launcher-2.5

再インストールを繰り返すこと3回目にしてようやくダウングレードされたpymol-2.5.0がインストールされた状態でpymol-launcher-2.5のインストールに成功しました.

PyMOLWikiに従って,

(base) C:\Users\~\anaconda3>where.exe pymol
C:\Users\~\anaconda3\PyMOL.exe
C:\Users\~\anaconda3\Scripts\pymol.exe
(base) C:\Users\~\anaconda3>pymol

PyMOLが無事に起動することを確認して,2.6.0a0にアップグレードしました.

(base) C:\Users\~\anaconda3>pip install --upgrade --no-deps pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Processing c:\users\~\anaconda3\pymol-2.6.0a0-cp39-cp39-win_amd64.whl
Installing collected packages: pymol
  Attempting uninstall: pymol
    Found existing installation: pymol 2.5.0
    Uninstalling pymol-2.5.0:
      Successfully uninstalled pymol-2.5.0
Successfully installed pymol-2.6.0a0

PyMOL GUIをひとまとめにするPyQt5も初手でインストールしていましたが,そちらも再インストール(略)して起動したところ,fetch PDBIDもFile/Edit等のタブのクリックも出来るようになっており,無事Windows11にもopen-source PyMOLをインストールできました.

まとめ

結果的に振り返ってみれば,ただインストールするだけなら特に問題は無さそうなのですが,結論としては初手で行ったはずのpip upgradeがうまく走らず,再インストールの際のpip upgradeで初めてPyMOLインストールの前提ができあがっただけなのかもしれません.
もう一つはAnacondaでPython環境を整備しようとすると現在はv3.9のため,PyMOL-Launcherのバージョンが限定されてしまうということかもしれません.

これでPyMOL scriptが走ってくれれば万事解決です.

0
0
4

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