Numpy is a very popular library for easily creating single, multidimensional array and matrices. It has a large collection of the mathematical function for performing an operation on these arrays. Most of the new Programmers are unable to install numpy properly. In this tutorial of How to, you will know how to install numpy in Pycharm. Just follow the simple steps to install it on Pycharm.
When you write import numpy as np , then you will see the text without any highlighting or you will see red undeline on the word numpy just like below. It means Pycharm has not recognized it.
Step1: Go to the File and click on Settings.
Step 2: You will see > Project: your_project_name.Click on it. You will see two option one is Project Interpreter and other Project Structure.
Step 3: Click on the Project Interpreter. You will see all the packages installed.
Step 4: You will see the + button. Click on it and search for the numpy in the search field. You will see the numpy package as the left side and its description, version on the right side.
Step 5: Selecting numpy click on the Install Package on the left bottom. It will install the packages. If you are unable to install and got an error. Then go to terminal first upgrade pip using the command
python -m pip install --upgrade pip
Then use the following command to install the numpy.
pip install numpy
Congrats you have successful install the numpy in Pycharm.
How to test if numpy is installed or not?
After the installation of the numpy on the system you can easily check whether numpy is installed or not. To do so, just use the following command to check. Inside the Pycharm write the following code and run the program for getting the output.
import numpy as np print (np.__version__)
When you will run it you see the following output that is numpy version.
How to Install Numpy on Linux Operating System?
The above steps are for installing NumPy in Pycharm and in Windows. In this section you will know how to install NumPy on Linux Operating System. Just follow the steps to install it.
Step 1: Install the Python Pip Module.
Make sure you have already installed the Python Module. Go to the terminal and type the following commands on it.
sudo apt update sudo apt install python-pip python3-pip # python-pip for 2.xx version and python3-pip for 3.xx version
Step 2: Install the NumPy
If you are able to successfully installed the pip in your system then run the following command to install the NumPy.
For Python 2.xx version
pip install numpy
For Python 3.xx version
pip3 install numpy
In this case I am installing for the python 3.xx version. Following these steps, You have successfully installed the Numpy Library on Linux.
How to Uninstall Numpy from Pycharm?
Some readers have asked us If I have installed NumPy and want to uninstall it from Pycharm in future How to do it? In this section, you will know how to uninstall Numpy from Pycharm through steps by steps.
Step 1: Go to File>>Setting and click on your Project: Your Project Name.
Step 2: Click on Project Interpreter. There you will see all the packages installed in it.
Step 3: Select the Numpy package and click on the “-“ icon. It will successfully remove the Numpy package from your Pycharm.
You will see the message in the green background color saying “Package Numpy successfully uninstalled“. Press Ok to Continue.
No Module Named Numpy Import Error
This type of error comes when you have not properly installed NumPy in your system or the previous version of the numpy is conflicting with the new version. To solve this issue you have to uninstall the previous version and install it using the pip command.
pip uninstall numpy
pip install numpy
We have created a dedicated article on this error you can find the details solution of this import error.
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.