Using NumPy

Install NumPy

Note:

Open the python_numpy.md file in the ~/projects/READMEs folder to help to copy and paste commands.

  1. Install the prerequisites needed to build the package's binary code:

    sudo apk add python3-wheel python3-dev
    pip3 install Cython --break-system-packages
  2. Build NumPy using the following command. You must build the NumPy code using the Clang toolchain:

    CC=clang CXX=clang++ pip3 install numpy --break-system-packages

    This step takes a few minutes to run. Once complete, NumPy is ready to use.

Run the sample script

The steps below check that NumPy works with code adapted from early examples in this tutorial: https://numpy.org/devdocs/user/absolute_beginners.html

  1. Open /home/qnxuser/projects/python_numpy/hello_numpy.py:



  2. Open the Build menu and select Execute. This step outputs different operations as they're performed, based on the initial sample code in the tutorial.:



Next steps

Review the tutorials in the NumPy documentation to try out more functionality: https://numpy.org/devdocs/user/absolute_beginners.html.

Note:

The matplotlib and pandas functionality doesn't work with the desktop yet, so avoid trying those parts of the tutorial.

Page updated: