Skip to content

Install Python#

Currently, we do not recommend using these instructions to install Python. Instead, we recommend the instructions for installing Python from source. Please note, RStudio is currently working on its own compiled Python binaries that will be available at a later date.

These instructions describe how to install Python on a Linux server. RStudio's professional products require multiple versions of Python. These instructions install Python appropriately from pre-compiled binaries.

Install required dependencies#

These instructions use conda, a package management utility, to install different versions of Python. After installing Python, conda environments are NOT used by RStudio's professional products.

$ sudo mkdir /opt/python
$ sudo curl -fsSL -o /opt/python/ 
$ sudo chmod 755 /opt/python/
$ sudo /opt/python/ -b -p /opt/python/miniconda

Specify Python Version#

$ export PYTHON_VERSION="3.7.7"

Download and install Python#


When installing Python version 3.5 and older (including version 2.7), you must constrain the version of pip because pip is no longer compatible with those versions of Python. An example of this is shown in the command below as "pip<20.1".

sudo /opt/python/miniconda/bin/conda create --quiet --yes \
      --prefix /opt/python/"${PYTHON_VERSION}" \
      --channel conda-forge \
      python="${PYTHON_VERSION}"  "pip<20.1"

Verify Python installation#

Verify that Python is installed by running the following command:

$ /opt/python/"${PYTHON_VERSION}"/bin/python --version

Upgrade Required Python Tools#

RStudio Connect requires that users have updated versions of some built-in Python tools. To upgrade the required tools, run the following command:

$ /opt/python/"${PYTHON_VERSION}"/bin/pip install --upgrade \
    pip setuptools wheel

(Optional) Configure a PyPI repository#

You can specify a default PyPI mirror for all installations of Python by creating a pip configuration file. This can be useful if you are using an internal PyPI mirror such as RStudio Package Manager:

To do so, create a file located at /etc/pip.conf containing:

File: /etc/pip.conf
index-url =

Replace with the URL for your PyPI mirror, available in Package Manager on the "Setup" page of your PyPI repository.

(Optional) Add Python to the system PATH#


You can configure Python on the system PATH so that users can use pip within a terminal to install packages to their home directory, similar to how R works with install.packages().

The recommended method to add Python to the PATH is to append the version of Python that you installed to the system-wide PATH variable. For example, this can be defined in a script within the /etc/profile.d/ directory:

File: /etc/profile.d/

(Optional) Make Python available as a Jupyter Kernel#

On RStudio Workbench you can make the version of Python installed available for use in Jupyter by running these commands:

sudo /opt/python/${PYTHON_VERSION}/bin/pip install ipykernel
sudo /opt/python/${PYTHON_VERSION}/bin/python -m ipykernel install --name py${PYTHON_VERSION} --display-name "Python ${PYTHON_VERSION}"

(Optional) Install multiple versions of Python#

If you want to install multiple versions of Python on the same server, you can repeat the installation steps using a different value for PYTHON_VERSION. You do not need to reinstall the conda utility which is a pre-requisite.

For example, you can run the following commands to install Python 2.7.16:

export PYTHON_VERSION="2.7.16"
sudo /opt/python/miniconda/bin/conda create --quiet --yes \
      --prefix /opt/python/"${PYTHON_VERSION}" \
      --channel conda-forge \


The minimum Python version supported by RStudio Connect is now 3.5. Configuration files that include Python 2, or Python 3 versions prior to 3.5, will cause an error during Connect startup.