A gravitational lensing software for modeling mass distribution of galaxies and clusters (strong and weak regime).

  • Credits: People who contribute on this project (in chronological order): Jean-Paul Kneib, Henri Bonnet, Ghyslain Golse, David Sand, Eric Jullo, Phil Marshall, Julien Zoubian, Mathilde Jauzac, Johan Richard, Benjamin ClĂ©ment, Tomas Verdugo, Soniya Sharma
  • Reference papers: Kneib et al 1996, Jullo et al 2007, Jullo & Kneib 2009


Starting from version 8, you can install Lenstool using conda on Linux and Mac OSX. This will give you access to the Python wrapper

conda install -c conda-forge lenstool
>>> import lenstool

On Ubuntu, you can also use the command apt-get from the command line.

apt-get install lenstool

On Mac OSX, you can use Macports

sudo port install lenstool

On Windows you can use Cygwin, following the procedure described here.

Please note the following dependencies

They can be installed with the package managers.

Source Install

cd lenstool

You can specify the location of cfitsio, wcslib, gsl, zmq and pgplot libraries using the configure options --with-X-include-path=DIR, --with-X-lib-path=DIR, where X stands for cfitsio, wcslib, gsl, zmq or pgplot. Since version 6.8, Histogram and Histogram2D tools are not anymore compiled by default. You need to specify the option --with-pgplot to compile them. These tools also depend on X11 development libraries and fortran compiler.

If you want to use the generalized NFW profile, you need to prepare the lookup table with this command

make table 

In your .bashrc, you must add the following lines

export LENSTOOL_DIR=<path to the directory of lenstool package>

or in your .cshrc,

setenv LENSTOOL_DIR <path to the directory of lenstool package>
  • For Mac Users, you need to previously install XCode and the Command Line Tools.

If you wan to install the Python module, you need to type the 2 following commands

make install
python -m pip install -vv --no-deps --ignore-installed

Older versions

Please, contact Eric Jullo (eric.jullo AT, if you want to provide a compiled version with another operating system. Compiled version have been compiled with option --disable-shared.


lenstool AT

To be added to the mailing list contact Jean-Paul Kneib: jean-paul.kneib AT

Lenstool documentation

  • LenstoolManual -- Lenstool On Line Manual becoming the reference (not fully complete yet)
  • lenstool.pdf -- Old manual, also available through the source code distribution
  • lenstool_dummies.pdf - A manual written by Mike "McCourt" a student discovering lenstool (Oct 2006).

Lenstool Papers

Papers using lenstool to model the mass distribution of massive clusters (not exhaustive)