Python module for quantum chemistry

Python-based Simulations of Chemistry Framework

Build Status



  • Prerequisites

    • Cmake 2.8 or higher
    • Python 2.6, 2.7, 3.4 or higher
    • Numpy 1.8.0 or higher
    • Scipy 0.10 or higher (0.12.0 or higher for python 3.4 - 3.6)
    • h5py 2.3.0 or higher (requires HDF5 1.8.4 or higher)
  • Compile core module

      cd pyscf/lib
      mkdir build; cd build
      cmake ..

    Note during the compilation, external libraries (libcint, libxc, xcfun) will be downloaded and installed. If you want to disable the automatic downloading, this document shows how to manually build these packages and PySCF C libraries.

  • To export PySCF to Python, you need to set environment variable PYTHONPATH. E.g. if PySCF is installed in /opt, your PYTHONPATH should be

      export PYTHONPATH=/opt/pyscf:$PYTHONPATH
  • Using Intel MKL as BLAS library. Enabling the cmake options -DBLA_VENDOR=Intel10_64lp_seq when executing cmake

      cmake -DBLA_VENDOR=Intel10_64lp_seq ..

    If cmake does not find MKL, you can define BLAS_LIBRARIES in CMakeLists.txt

      set(BLAS_LIBRARIES "${BLAS_LIBRARIES};/path/to/mkl/lib/intel64/")
      set(BLAS_LIBRARIES "${BLAS_LIBRARIES};/path/to/mkl/lib/intel64/")
      set(BLAS_LIBRARIES "${BLAS_LIBRARIES};/path/to/mkl/lib/intel64/")
      set(BLAS_LIBRARIES "${BLAS_LIBRARIES};/path/to/mkl/lib/intel64/")
  • Using DMRG as the FCI solver for CASSCF. There are two DMRG solver interfaces avaialbe in pyscf. Block ( CheMPS2 ( After installing the DMRG solver, create a file future/dmrgscf/ to store the path where the DMRG solver was installed.

  • Using FCIQMC as the FCI solver for CASSCF. NECI ( After installing the NECI, create a file future/fciqmc/ to store the path where the NECI was installed.

  • Using optimized integral library on X86 platform. Qcint ( is a branch of libcint library. It is heavily optimized against X86_64 platforms. To replace the default libcint library with qcint library, edit the URL of the integral library in lib/CMakeLists.txt file

  • Using pyberny ( as geometry optimizer. After downloading pyberny

    git clone /path/to/pyberny

    edit the environment variable to make pyberny a python module

    export PYTHONPATH=/path/to/pyberny:$PYTHONPATH


Known problems

  • Error message "Library not loaded: libcint.3.0.dylib" On OS X.

    libcint.dylib is installed in pyscf/lib/deps/lib by default. Add "/path/to/pyscf/lib/deps/lib" to DYLD_LIBRARY_PATH

  • runtime error message

  OSError: ... mkl/lib/intel64/ undefined symbol: ownLastTriangle_64fc


  MKL FATAL ERROR: Cannot load or

This is a MKL 11.* bug when MKL is used with "dlopen" function. Preloading MKL libraries can solve this problem on most systems:

  export LD_PRELOAD=$MKLROOT/lib/intel64/$MKLROOT/lib/intel64/$MKLROOT/lib/intel64/


  export LD_PRELOAD=$MKLROOT/lib/intel64/$MKLROOT/lib/intel64/
[ 95%] Building C object CMakeFiles/cint.dir/src/stg_roots.c.o

This code is used by F12 integrals only. If you do not need F12 methods, the relevant compilation can be disabled, by searching DWITH_F12 in file lib/CMakeLists.txt and setting it to -DWITH_F12=0.

Citing PySCF

The following paper should be cited in publications utilizing the PySCF program package:

PySCF: the Python-based Simulations of Chemistry Framework, Q. Sun, T. C. Berkelbach, N. S. Blunt, G. H. Booth, S. Guo, Z. Li, J. Liu, J. McClain, E. R. Sayfutyarova, S. Sharma, S. Wouters, G. K.-L. Chan (2018), PySCF: the Python‐based simulations of chemistry framework. WIREs Comput. Mol. Sci., 8: e1340. doi:10.1002/wcms.1340

Bug report

Qiming Sun