Installing DoubleML#

How to install the R package DoubleML is described below, the installation of the Python package DoubleML is described in the following.

Python: Installing DoubleML#

There are three different ways to install the python package DoubleML:

  • Install the latest official release via pip or conda. This is the recommended approach for most users.

  • Install a released version of DoubleML from a .whl file.

  • Building the package from source. This is recommended if you want to work with the latest development version of the package. This also the best way if you wish to contribute to DoubleML.

Python: Installing the latest release from pip or conda#

pip with virtual environment

Install python3 and python3 via the package manager of your distribution, e.g., with

$ sudo apt-get install python3 python3-pip

For Python releases see also https://www.python.org/downloads/source/.

To avoid potential conflicts with other packages it is recommended to use a virtual environment. The package virtualenv can be installed with python3 -m pip install virtualenv. We setup a virtualenv named dml-venv and activate it

$ virtualenv -p python3 dml-venv
$ source dml-venv/bin/activate

To install DoubleML run

$ pip install -U DoubleML

To check your installation of DoubleML use

$ python -m pip show DoubleML # to see which version and where DoubleML is installed
$ python -m pip freeze # to see all packages installed in the active virtualenv
$ python -c "import doubleml as dml; print(dml.__version__)"
pip without virtual environment

Install python3 and python3 via the package manager of your distribution, e.g., with

$ sudo apt-get install python3 python3-pip

For Python releases see also https://www.python.org/downloads/source/.

To install DoubleML run

$ pip3 install -U DoubleML

To check your installation of DoubleML use

$ python3 -m pip show DoubleML # to see which version and where DoubleML is installed
$ python3 -m pip freeze # to see all installed packages
$ python3 -c "import doubleml as dml; print(dml.__version__)"
conda with environment

Install conda as described here.

To avoid potential conflicts with other packages it is recommended to use a conda environment.

We setup a conda environment named dml-venv and activate it

$ conda create -n dml-venv
$ conda activate dml-venv

To install DoubleML run

$ conda install -c conda-forge doubleml

To check your installation of DoubleML use

$ conda list DoubleML # to see which version and where DoubleML is installed
$ conda list # to see all packages installed in the active conda environment
$ python -c "import doubleml as dml; print(dml.__version__)"
conda without environment

Install conda as described here.

To install DoubleML run

$ conda install -c conda-forge doubleml

To check your installation of DoubleML use

$ conda list DoubleML # to see which version and where DoubleML is installed
$ conda list # to see all installed packages
$ python -c "import doubleml as dml; print(dml.__version__)"
pip with virtual environment

Install Python 3 using brew install python or from https://www.python.org/downloads/macos/.

To avoid potential conflicts with other packages it is recommended to use a virtual environment. We setup a virtual environment named dml-venv and activate it

$ python -m venv dml-venv
$ source dml-venv/bin/activate

To install DoubleML run

$ pip install -U DoubleML

To check your installation of DoubleML use

$ python -m pip show DoubleML # to see which version and where DoubleML is installed
$ python -m pip freeze # to see all packages installed in the active virtualenv
$ python -c "import doubleml as dml; print(dml.__version__)"
pip without virtual environment

Install Python 3 using brew install python or from https://www.python.org/downloads/mac-osx/.

To install DoubleML run

$ pip install -U DoubleML

To check your installation of DoubleML use

$ python -m pip show DoubleML # to see which version and where DoubleML is installed
$ python -m pip freeze # to see all packages installed in the active virtualenv
$ python -c "import doubleml as dml; print(dml.__version__)"
conda with environment

Install conda as described here.

To avoid potential conflicts with other packages it is recommended to use a conda environment.

We setup a conda environment named dml-venv and activate it

$ conda create -n dml-venv
$ conda activate dml-env

To install DoubleML run

$ conda install -c conda-forge doubleml

To check your installation of DoubleML use

$ conda list DoubleML # to see which version and where DoubleML is installed
$ conda list # to see all packages installed in the active conda environment
$ python -c "import doubleml as dml; print(dml.__version__)"
conda without environment

Install conda as described here.

To install DoubleML run

$ conda install -c conda-forge doubleml

To check your installation of DoubleML use

$ conda list DoubleML # to see which version and where DoubleML is installed
$ conda list # to see all installed packages
$ python -c "import doubleml as dml; print(dml.__version__)"
pip with virtualenv

Install Python 3. Releases are available here https://www.python.org/downloads/windows/.

To avoid potential conflicts with other packages it is recommended to use a virtual environment. We setup a virtual environment named dml-venv and activate it

$ python -m venv dml-venv
$ dml-venv\Scripts\activate

To install DoubleML run

$ pip install -U DoubleML

To check your installation of DoubleML use

$ python -m pip show DoubleML # to see which version and where DoubleML is installed
$ python -m pip freeze # to see all packages installed in the active virtualenv
$ python -c "import doubleml as dml; print(dml.__version__)"
pip without virtual environment

Install Python 3. Releases are available here https://www.python.org/downloads/windows/.

To install DoubleML run

$ pip install -U DoubleML

To check your installation of DoubleML use

$ python -m pip show DoubleML # to see which version and where DoubleML is installed
$ python -m pip freeze # to see all packages installed in the active virtualenv
$ python -c "import doubleml as dml; print(dml.__version__)"
conda with environment

Install conda as described here.

To avoid potential conflicts with other packages it is recommended to use a conda environment.

We setup a conda environment named dml-venv and activate it

$ conda create -n dml-venv
$ conda activate dml-env

To install DoubleML run

$ conda install -c conda-forge doubleml

To check your installation of DoubleML use

$ conda list DoubleML # to see which version and where DoubleML is installed
$ conda list # to see all packages installed in the active conda environment
$ python -c "import doubleml as dml; print(dml.__version__)"
conda without environment

Install conda as described here.

To install DoubleML run

$ conda install -c conda-forge doubleml

To check your installation of DoubleML use

$ conda list DoubleML # to see which version and where DoubleML is installed
$ conda list # to see all installed packages
$ python -c "import doubleml as dml; print(dml.__version__)"

Python: Installing a released version from a .whl file#

Released versions of the DoubleML package in form of .whl files can be obtained from GitHub Releases. After setting up python and pip as described above use

$ pip install -U DoubleML-0.5.1-py3-none-any.whl

Python: Building the package from source#

This is recommended if you want to work with the latest development version of the package or wish to contribute to DoubleML.

First download the latest source code from GitHub via

$ git clone git@github.com:DoubleML/doubleml-for-py.git
$ cd doubleml-for-py

Then build the package from source using pip in the editable mode. The advantage of building the package with the flag --editable is that changes of the source code will immediately be re-interpreted when the python interpreter restarts without having to re-build the package DoubleML.

$ pip install --editable .

An alternative to pip with the --editable flag is the develope mode of setuptools. To use it call

$ python setup.py develop

R: Installing DoubleML#

R: Installing the latest release from CRAN#

Install the last release from CRAN

install.packages("DoubleML")

The package can be loaded after completed installation

library(DoubleML)

R: Installing the development version from GitHub#

The DoubleML package for R can be downloaded using the command (previous installation of the remotes package is required).

remotes::install_github("DoubleML/doubleml-for-r")

Load the package after completed installation.

library(DoubleML)