Standard Python agent install

If your Python application uses one of the New Relic-supported frameworks, you can use this guide to install New Relic for Python and get it reporting data.

If you cannot use the standard install, or if you want more details and context for the install procedures, see Advanced installation. You can also install the Python agent in a Google App Engine flexible environment.

For more about Python agent compatibility, see Compatibility and requirements.

Install steps

The instructions below are for applications on frameworks that New Relic automatically instruments. To monitor non-web Python scripts, custom background tasks, or an application on a non-auto-instrumented framework, see Monitor non-web scripts/functions.

If you are using Docker, install the New Relic agent within each container.

To install the New Relic Python agent for an application on an auto-instrumented framework:

  1. Make sure you have your New Relic license key. (If you don't yet have a New Relic account, sign up to get one.)

  2. Install the newrelic Python package using pip by running:

    pip install newrelic
  3. Generate the agent configuration file by running the command:

    newrelic-admin generate-config YOUR_LICENSE_KEY newrelic.ini
  4. If you control how your web application or WSGI server is started, use the following New Relic admin script command in front of your usual startup command options:

    NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program YOUR_COMMAND_OPTIONS
    

    If you cannot run the admin script in this way, please read the advanced install instructions for more context and other install options.

  5. Start or restart your Python web application or WSGI server. Wait five minutes and look for data in your New Relic account.

For install instructions with more details and helpful context, see Python agent installation.

Video of install process

The video below shows a simple install of the New Relic Python agent:


[video link] For Python agent installation tips, watch this New Relic video (approximately 1 minute). The video also includes the optional but recommended step of setting your app name in the config file.

What's next?

For suggestions on what to do after installing New Relic, see Next steps.

For more help

Recommendations for learning more: