Get Started With Intel® Distribution for Python*

Published: 06/21/2022

Intel® Distribution for Python* is a cluster of packages includes Numba, NumPy and more. All these packages are optimized via oneMKL and oneDAL to make Python* application more efficient.

Supported Installation Options

Install via Intel® AI Analytics Toolkit

Intel® AI Analytics Toolkit includes Intel® Distribution for Python. So the Intel® Distribution for Python* is ready for use once the Intel® AI Analytics Toolkit installation is finished and the environment activation is run.

Environment Setup

  1. Install Intel® AI Analytics Toolkit. To download Intel® Distribution for Python* from the Intel® AI Analytics Toolkit, visit here and choose the installation method of your choice. Find detailed information about the toolkit here.
  2. Set up Intel® AI Analytics Toolkit environment.
    Source the setvars script located in the root of your oneAPI installation.
    • Linux*:
      • Sudo: 
        . /opt/intel/oneapi/setvars.sh
      • User: 
        . ~/intel/oneapi/setvars.sh
    • Windows: 
      C:\Program Files(x86)\Intel\oneAPI\setvars.bat

      For more information on environment variables, view Use the setvars Script for Linux or macOS, or Windows.
  3. Activate the conda environment.
    • Linux*:
      • If you have root access to your oneAPI installation path or if you use the Intel® DevCloud:
        Intel Python environment will be activated by default. However, if you have activated another environment, you can return with the following command:
        source activate base
      • If you do not have root access to your oneAPI installation path:
      • By default, the Intel® AI Analytics Toolkit is installed in the /opt/intel/oneapi folder, which requires root privileges to manage it. If you would like to bypass using root access to manage your conda environment, then you can clone your desired conda environment using the following command:
        conda create --name usr_intelpython --clone base
        Then activate your conda environment with the following command:
        source activate usr_intelpython
    • Windows :
      C:\ProgramFiles(x86)\Intel\oneAPI\intelpython\python3.x\Scripts\activate

Install via Anaconda:

  1. Follow Conda Installation Guide to install Conda in your environment. If you already have conda installed in your system, please update your conda: 
    conda update conda
  2. Add Intel® channel
    Tell conda to choose Intel® packages over default packages, when available.
    conda config --add channels intel
  3. Install Intel® Distribution for Python* via conda. We recommend that you create a new environment while installing. To install the core python3 environment, do: 
    conda create -n idp intelpython3_core python=3.x
    Please note that “x” in “python=3.x” should signify which version of Python* you would like to install. For example, for Python* version 3.9: conda create -n idp intelpython3_core python=3.9
  4. Acitvate conda environment, then follow the usual steps for activating the environment: 
    conda activate idp

Sanity Check

After the activation of the environment, type python in the command line to find the Python* distribution info.

  • Linux* & Windows*: python
    The distribution info should include Intel® Corporation:
  • Linux: 
    Python 3.7.10 (default, Jun 4 2021, 06:52:02)
    [GCC 9.3.0] :: Intel Corporation on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Intel(R) Distribution for Python is brought to you by Intel® Corporation.
    Please check out: https://software.intel.com/en-us/python-distribution 
  • Windows:
    Python 3.7.10 (default, Jun 4 2021, 06:52:02)
    [GCC 9.3.0] :: Intel Corporation on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Intel(R) Distribution for Python is brought to you by Intel® Corporation.
    Please check out: https://software.intel.com/en-us/python-distribution

These methods can be used as a sanity check that Intel® Distribution for Python* is properly installed.

Sample Code

Run this numpy sample code in a stock Python* environment comparing to a IntelPython environment. You will see benefits from IntelPython.

import numpy as np
import time

start = time.time()

rd = np.random.RandomState(88)
a = rd.randint(1,1000,(1000,1000))
y = rd.randint(1,1000,(1000))
res = np.linalg.solve(a,y)

end = time.time()

print(res)
print('Time Consuming:',end-start)

Build Your Own Project

No special modifications to your existing Python* projects are required to start using them with this toolkit. You can refer to samples on github, reach it in Reference Section.

Reference

Support

If you have further questions or need support on your workload optimization, please submit your queries to the Intel® AI Analytics Toolkit Forum or IntelPython GitHub, on the Issues or Discussions pages depending on the type of support required.

Notices and Disclaimers

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available updates. See backup for configuration details. No product or component can be absolutely secure.

Your costs and results may vary.

Intel technologies may require enabled hardware, software or service activation.

© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.