Difference between revisions of "CCTBX"

From PyMOLWiki
Jump to navigation Jump to search
(Windows)
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Note=
+
This page describes how to use the [https://github.com/cctbx/cctbx_project Computational Crystallography Toolbox (cctbx)] with PyMOL.
We need someone to make some edits to this page. I don't know anything about CCTBX except what's shown here.
 
  
=Computational Crystallography Toolbox=
+
cctbx and PyMOL need to be compiled with the same Python distribution, otherwise they won't be compatible.
[http://cctbx.sourceforge.net CCTBX]
 
  
==Using With PyMol==
+
=== Incentive PyMOL ===
  
===Roger Dodd's Solution===
+
Using cctbx with Incentive PyMOL 2.x should become easier once the cctbx project provides conda packages.
Some folks were having issues getting CCTBX to work.  Here's one solution.
+
See https://github.com/cctbx/cctbx_project/issues/9
  
I hesitated to post this because I thought someone would have a more elegant solution, but I have got the draw_cell/symmops scripts working
+
==== Linux ====
on windows with cctbx. I have had it working with all versions of PyMOL including the latest betas. I install PyMOL as usual in '''C:\Program
 
Files\Delano Scientific\PyMOL'''. I also got hold of python 2.4.1 [http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi Python 2.4.1] and cctbx
 
[http://cci.lbl.gov/cctbx_build/results/2005_08_18_0201/cctbx_win_xp_py24_pre.exe CCTBX For Windows With Python 2.4] and installed them to '''C:\python24''' and ''''C:\cctbx_build''' & '''C:\cctbx_sources''', respectively.
 
  
In order to get things working together, I launch PyMOL with the following batch file:
+
Confirmed procedure to get this working on Linux with CCTBX build '''dev-1723''', which is based on conda:
  
<pre>
+
# Download cctbx from http://cci.lbl.gov/cctbx_build/
@ECHO off
+
# Install cctbx: <code>./install --prefix=$HOME/local</code>
set LIBTBX_DIST_ROOT=C:\cctbx_sources
+
# Install [https://repo.continuum.io/miniconda/ Miniconda]
if not defined PYTHONPATH set PYTHONPATH=
+
# Install '''pymol''' with '''conda''' into the '''cctbx environment''':<syntaxhighlight lang="bash">$HOME/miniconda3/bin/conda install -p $HOME/local/cctbx-dev-1723/conda_base -c schrodinger -c conda-forge pymol</syntaxhighlight>
set
+
# Activate cctbx: <code>source $HOME/local/cctbx-dev-1723/cctbx_env.sh</code>
PYTHONPATH=C:\cctbx_sources\boost_adaptbx;C:\cctbx_sources\scitbx;C:\cctbx_sources\cctbx;C:\cctbx_sources\iotbx;C:\cctbx_build\libtbx;C:\cctbx_sources\libtbx;%PYTHONPATH%
+
# Run PyMOL with: <code>cctbx.python -m pymol</code>
set LIBTBX_BUILD=C:\cctbx_build
 
set LIBTBX_PYTHON_EXE=C:\Python24\python.exe
 
if not defined PATH set PATH=
 
set PATH=C:\cctbx_build\libtbx\bin;C:\cctbx_build\libtbx;%PATH%
 
set SCITBX_DIST=C:\cctbx_sources\scitbx
 
set IOTBX_DIST=C:\cctbx_sources\iotbx
 
set CCTBX_DIST=C:\cctbx_sources\cctbx
 
set BOOST_ADAPTBX_DIST=C:\cctbx_sources\boost_adaptbx
 
set LIBTBX_DIST=C:\cctbx_sources\libtbx
 
if not defined PATHEXT set PATHEXT=
 
set PATHEXT=.PX;.PY;%PATHEXT%
 
call "%LIBTBX_PYTHON_EXE%" "%LIBTBX_DIST%\libtbx\assoc_ftype.py"
 
"C:\Program Files\DeLano Scientific\PyMOL\PyMOLWin.exe"  +2
 
</pre>
 
  
Just save as '''PyMOL.bat''' and run it (this is basically the cctbx '''setpaths.bat''' with a pymol command tagged on the end). I hope this helps.
+
==== Windows ====
  
 +
Confirmed procedure to get this working on Windows with CCTBX build '''dev-1725''', which is based on conda:
  
 +
# Download cctbx from http://cci.lbl.gov/cctbx_build/
 +
# Extract ZIP file (e.g. to <code>F:\cctbx-installer-dev-1725-intel-windows-x86_64</code>)
 +
# Install [https://repo.continuum.io/miniconda/ Miniconda]
 +
# Install '''pymol''' with '''conda''' into the '''cctbx environment''': <code>conda install -p F:\cctbx-installer-dev-1725-intel-windows-x86_64\conda_base -c schrodinger -c conda-forge pymol</code>
 +
# Activate cctbx: <code>call F:\cctbx-installer-dev-1725-intel-windows-x86_64\cctbx_env.bat</code>
 +
# Run PyMOL with: <code>cctbx.python -m pymol</code>
  
=== Robert Campbell's Solution ===
+
=== Open-Source PyMOL ===
 +
 
 +
Confirmed procedure to get this working on Linux: Compile PyMOL with <code>cctbx.python</code>
 +
 
 +
Current cctbx builds neither include PyQt, nor a working Tkinter module. These need to be compiled from source if needed.
 +
 
 +
# Download cctbx from http://cci.lbl.gov/cctbx_build/
 +
# Install cctbx: <code>./install --prefix=$HOME/local</code>
 +
# Activate cctbx: <code>source $HOME/local/cctbx-dev-1658/cctbx_env.sh</code>
 +
# Compile PyMOL with: <code>cctbx.python setup.py --glut install</code> (see [[Linux Install]] for details)
 +
# Install Pmw from https://github.com/schrodinger/pmw-patched with: <code>cctbx.python setup.py install</code>
 +
# Install <code>_tkinter.so</code>:
 +
## Download Python-2.7 source from https://www.python.org/downloads/release/python-2715/
 +
## <code>cd Python-2.7.15/Modules</code>
 +
## Download https://pymol.org/tmp/setup_tkinter_cctbx.py
 +
## <code>cctbx.python setup_tkinter_cctbx.py install</code>
 +
# Run PyMOL with: <code>cctbx.python -m pymol</code>
 +
 
 +
<div style="padding: 20px; margin-top:40px; background-color: #f90;">
 +
The following instructions are outdated and might not work anymore
 +
</div>
 +
 
 +
===Windows XP (Roger Dodd)===
 +
1. Download and install python (to the default location - C:\Python24)
 +
 
 +
[http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi Python-2.4.1]
 +
 
 +
1a. If you want to use the draw_symops.py or draw_symops_cctbx.py
 +
scripts you also need to install numarray after installing python
 +
 
 +
[http://prdownloads.sourceforge.net/numpy/numarray-1.3.3.win32-py2.4.exe?download Numarray-1.3.3]
 +
 
 +
2. Download cctbx *without* python included and unpack into
 +
C:\cctbx_build and C:\cctbx_sources (i.e. execute the file in C:\)
 +
 
 +
[http://cci.lbl.gov/cctbx_build/ cctbx]
 +
 
 +
3. Download pymol built against python 2.4 (but not including its own
 +
python) and install in the default location
 +
 
 +
[http://delsci.com/rel/098/pymol-0_98rc5-bin-win32-py24.zip pymol-0_98rc5]
 +
 
 +
(Newer versions of PyMOL linked against an external python are available from Delano Scientific on request for holders of a valid subscription.)
 +
 
 +
4. Create 2 files (use notepad or wordpad or any other text editor) and
 +
save in the C:\Program Files\Delano Scientific\PyMOL directory:
 +
 
 +
    a) pymol.cmd
 +
 
 +
      @cctbx.python -x "%~f0" %* & exit /b
 +
        import cctbx
 +
        import pymol
 +
 
 +
    b) run.cmd
 +
 
 +
        CALL C:\cctbx_build\setpaths_all.bat
 +
        CALL "C:\Program Files\Delano Scientific\PyMOL\pymol.cmd"
 +
 
 +
5. It's important to have python in your path variable (which you can access by going to control panel|system|advanced|environment variables), just add C:\python24 to the end of the path variable, separated by a semi-colon.
 +
 
 +
===Linux (Robert Campbell)===
 
When you run the setpaths.sh script, it adds the cctbx_build/bin directory to the *front* of your $PATH. In that directory is a shell script called "python" that sets the environment necessary to import cctbx. So, to get cctbx to work, you have to call python without prefixing a directory path.  If you were like me and had:
 
When you run the setpaths.sh script, it adds the cctbx_build/bin directory to the *front* of your $PATH. In that directory is a shell script called "python" that sets the environment necessary to import cctbx. So, to get cctbx to work, you have to call python without prefixing a directory path.  If you were like me and had:
 
  /usr/bin/python  $PYMOL_PATH/modules/launch_pymol.py $*
 
  /usr/bin/python  $PYMOL_PATH/modules/launch_pymol.py $*
Line 53: Line 101:
 
and you should now see the cctbx directories show up.
 
and you should now see the cctbx directories show up.
  
 
+
[[Category:PyMol_Integration|cctbx]]
I hope this is clear enough!
 
 
 
 
 
 
 
[[Category:PyMol_Integration|CCTBX]]
 

Revision as of 05:20, 2 April 2019

This page describes how to use the Computational Crystallography Toolbox (cctbx) with PyMOL.

cctbx and PyMOL need to be compiled with the same Python distribution, otherwise they won't be compatible.

Incentive PyMOL

Using cctbx with Incentive PyMOL 2.x should become easier once the cctbx project provides conda packages. See https://github.com/cctbx/cctbx_project/issues/9

Linux

Confirmed procedure to get this working on Linux with CCTBX build dev-1723, which is based on conda:

  1. Download cctbx from http://cci.lbl.gov/cctbx_build/
  2. Install cctbx: ./install --prefix=$HOME/local
  3. Install Miniconda
  4. Install pymol with conda into the cctbx environment:
    $HOME/miniconda3/bin/conda install -p $HOME/local/cctbx-dev-1723/conda_base -c schrodinger -c conda-forge pymol
    
  5. Activate cctbx: source $HOME/local/cctbx-dev-1723/cctbx_env.sh
  6. Run PyMOL with: cctbx.python -m pymol

Windows

Confirmed procedure to get this working on Windows with CCTBX build dev-1725, which is based on conda:

  1. Download cctbx from http://cci.lbl.gov/cctbx_build/
  2. Extract ZIP file (e.g. to F:\cctbx-installer-dev-1725-intel-windows-x86_64)
  3. Install Miniconda
  4. Install pymol with conda into the cctbx environment: conda install -p F:\cctbx-installer-dev-1725-intel-windows-x86_64\conda_base -c schrodinger -c conda-forge pymol
  5. Activate cctbx: call F:\cctbx-installer-dev-1725-intel-windows-x86_64\cctbx_env.bat
  6. Run PyMOL with: cctbx.python -m pymol

Open-Source PyMOL

Confirmed procedure to get this working on Linux: Compile PyMOL with cctbx.python

Current cctbx builds neither include PyQt, nor a working Tkinter module. These need to be compiled from source if needed.

  1. Download cctbx from http://cci.lbl.gov/cctbx_build/
  2. Install cctbx: ./install --prefix=$HOME/local
  3. Activate cctbx: source $HOME/local/cctbx-dev-1658/cctbx_env.sh
  4. Compile PyMOL with: cctbx.python setup.py --glut install (see Linux Install for details)
  5. Install Pmw from https://github.com/schrodinger/pmw-patched with: cctbx.python setup.py install
  6. Install _tkinter.so:
    1. Download Python-2.7 source from https://www.python.org/downloads/release/python-2715/
    2. cd Python-2.7.15/Modules
    3. Download https://pymol.org/tmp/setup_tkinter_cctbx.py
    4. cctbx.python setup_tkinter_cctbx.py install
  7. Run PyMOL with: cctbx.python -m pymol

The following instructions are outdated and might not work anymore

Windows XP (Roger Dodd)

1. Download and install python (to the default location - C:\Python24)

Python-2.4.1

1a. If you want to use the draw_symops.py or draw_symops_cctbx.py scripts you also need to install numarray after installing python

Numarray-1.3.3

2. Download cctbx *without* python included and unpack into C:\cctbx_build and C:\cctbx_sources (i.e. execute the file in C:\)

cctbx

3. Download pymol built against python 2.4 (but not including its own python) and install in the default location

pymol-0_98rc5

(Newer versions of PyMOL linked against an external python are available from Delano Scientific on request for holders of a valid subscription.)

4. Create 2 files (use notepad or wordpad or any other text editor) and save in the C:\Program Files\Delano Scientific\PyMOL directory:

   a) pymol.cmd
      @cctbx.python -x "%~f0" %* & exit /b
       import cctbx
       import pymol
   b) run.cmd
       CALL C:\cctbx_build\setpaths_all.bat
       CALL "C:\Program Files\Delano Scientific\PyMOL\pymol.cmd"

5. It's important to have python in your path variable (which you can access by going to control panel|system|advanced|environment variables), just add C:\python24 to the end of the path variable, separated by a semi-colon.

Linux (Robert Campbell)

When you run the setpaths.sh script, it adds the cctbx_build/bin directory to the *front* of your $PATH. In that directory is a shell script called "python" that sets the environment necessary to import cctbx. So, to get cctbx to work, you have to call python without prefixing a directory path. If you were like me and had:

/usr/bin/python  $PYMOL_PATH/modules/launch_pymol.py $*

in your pymol.com file, then it would not run that cctbx_build/bin/python script. So you need to either change the above line to:

python  $PYMOL_PATH/modules/launch_pymol.py $*

(assuming you've already run the setpaths.sh script) or you need to copy the cctbx_build/bin/python contents (without the actual "python" command) into your pymol.com file or some other file that you source before pymol.com.

Within pymol, type the command:

print sys.path

and you should now see the cctbx directories show up.