Install Open Source PyMOL in Windows 11 (Outdated)

Page content

The method to install PyMOL in Windows 11 is out of date. Please refer to the most recent post: Install Open Source PyMOL 3.0.x in Windows 11.


The way to install open source PyMOL in the previous post can not work in Windows 11. The PyMOLWiki described the method to install PyMOL in windows. Here we provided more details of the installation.

1. Install Miniconda

Download Miniconda installer and install.

The default installation path is:

C:\Users\username\miniconda3

2. Decide which version of PyMOL open source to be installed

Browse the available pre-compiled Open Source PyMOL packages at Christoph Gohlke of the Laboratory for Fluorescence Dynamics, University of California, Irvine. Please note the version of PyMOL, Python and Windows in the package filename. More details please see the previous post.

Usually, download the latest PyMOL packages v2.6.0a0:

  • pymol_launcher-2.5-cp311-cp311-win_amd64.whl
  • pymol-2.6.0a0-cp311-cp311-win_amd64.whl
  • numpy-1.22.4+mkl-cp311-cp311-win_amd64.whl

Or the stable PyMOL v2.5.0:

  • pymol_launcher-2.5-cp310-cp310-win_amd64.whl
  • pymol-2.5.0-cp310-cp310-win_amd64.whl
  • numpy-1.22.4+mkl-cp310-cp310-win_amd64.whl

3. (Optional) Install Microsoft Visual C++ Redistributable

Have a look in “Add/Remove Programs” of Windows before installation.

Download and install the current Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, 2019 and 2022.

4. Create Miniconda environment

Launch the conda prompt by click Anaconda Prompt (Miniconda3) in the Windows start menu. Do NOT use the PowerShell Prompt.

The command line prompt:

(base) C:\Users\username>
  • For latest PyMOL v2.6.0a0:
(base) C:\Users\username>conda create -n pymol python=3.11 pip
  • For stable PyMOL v2.5.0:
(base) C:\Users\username>conda create -n pymol python=3.10 pip

Then activate the pymol enviromnent:

(base) C:\Users\username>conda activate pymol
(pymol) C:\Users\username>

Note: The pymol conda environment locates at: C:\Users\username\miniconda3\envs\pymol

5. Install Open Source PyMOL

Navigate to the directory of installation packages downloaded:

(pymol) C:\Users\username>cd C:\Users\username\Downloads
(pymol) C:\Users\username\Downloads>

Install the pmw package at first:

(pymol) C:\Users\username\Downloads>python -m pip install pmw

Install Open Source PyMOL packages:

  • For latest PyMOL v2.6.0a0:
(pymol) C:\Users\username\Downloads>python -m pip install --no-index --find-links="%CD%" pymol_launcher-2.5-cp311-cp311-win_amd64.whl
  • For stable PyMOL v2.5.0
(pymol) C:\Users\username\Downloads>python -m pip install --no-index --find-links="%CD%" pymol_launcher-2.5-cp310-cp310-win_amd64.whl

If there were no error message, launch PyMOL by the command:

pymol

Let’s close PyMOL window right now.

6. (Optinal) Install single-window Qt interface

Install the optional PyQt5 package:

python -m pip install pyqt5

7. Update PyMOL

Lanuch the Anaconda Prompt (Miniconda3) and activate the pymol environment at first, then run:

pip install --upgrade --no-deps pymol.whl

where pymol.whl has to be replaced by the PyMOL wheel file name, e.g., pymol-2.6.0a0-cp311-cp311-win_amd64.whl (not the launcher, the launcher should not require updating).

8. (Optional) Install additional scripts and plugins

  1. Download the zip file of the collection Pymol-script-repo.

  2. Locate the PYMOL_PATH:

Start PyMOL first, then run:

import os
print(os.environ['PYMOL_PATH'])

Usually the value is:

C:\Users\username\miniconda3\envs\pymol\Lib\site-packages\pymol\pymol_path

Close PyMOL.

  1. Unpack the zip file into the PYMOL_PATH, and double check the folder name to be Pymol-script-repo.

  2. Create a text file names run_on_startup.py in the PYMOL_PATH directory, of which content is:

# Add paths to sys.path so PyMOL can find modules and scripts
import sys, os
pymol_git = os.path.abspath(os.path.join(os.environ['PYMOL_PATH'], 'Pymol-script-repo'))
os.environ['PYMOL_GIT_MOD'] = os.path.join(pymol_git,'modules')
sys.path.append(pymol_git)
sys.path.append(os.environ['PYMOL_GIT_MOD'])

# Make setting changes to Plugin Manager
import pymol.plugins
pymol.plugins.preferences = {'instantsave': False, 'verbose': False}
pymol.plugins.autoload = {'apbs_tools': False}
pymol.plugins.set_startup_path([os.path.join(pymol_git, 'plugins'), os.path.join(sys.prefix, 'Lib', 'site-packages', 'pmg_tk', 'startup')])
pymol.plugins.preferences = {'instantsave': True, 'verbose': False}
  1. Restart PyMOL, the plugins may be available from the menu Plugin -> Legacy Plygins

9. (Optional) A batch file to start PyMOL

After completed the above steps, the PyMOL could be launched by:

# Lanuch Miniconda prompt first
conda activate pymol
pymol

It’s still a bit complicated. So let’s create a Windows batch file, e.g. pymol.bat, on Desktop. The content is:

@REM Launch PyMOL in conda
@REM 2024-02-02
@ECHO OFF
CALL "%HOMEDRIVE%%HOMEPATH%\miniconda3\condabin\activate.bat" "pymol"
PyMOL.exe

Please Note: There is still a black command window while PyMOL started. If there were any way to hide this window, please tell me. Thanks.

Reference

  1. PyMOLWiki: Windows Install
  2. PyMOLWiki: Git install scripts