Importing numpy from Thonny: ModuleNotFoundError

16,780

Thonny uses its own virtual environment by default. Open "Tools => Manage packages" or "Tools => Open system shell" in order to install into this environment.

Share:
16,780

Related videos on Youtube

John Smith
Author by

John Smith

Updated on June 04, 2022

Comments

  • John Smith
    John Smith about 2 years

    I typed into the command prompt: C:\Users\JoshPC>pip install numpy

    and it said:

    Requirement already satisfied: numpy in c:\users\joshpc\appdata\local\programs\python\python36\lib\site-packages

    Then in Thonny I wrote:

    import numpy as np
    

    and I get the error:

    Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy'

    So it's some kind of path error, but I am not sure how to solve this.

  • John Smith
    John Smith over 6 years
    Thanks for responding ... but unfortunately I get the same error as before. ModuleNotFound
  • specialk1st
    specialk1st over 3 years
    For completeness I will add that once you are in the Thonny System Shell you can run either "pip" or "pip3" to install the module you need. For example: "pip3 install requests" OR "pip install requests" to install the HTTP requests module.