'how to solve Module not found error? ( installed the module and error persists)

I have installed the module tradingeconomics on cmd and when i try to import the library it throws this error , how to solve it ?

'

ModuleNotFoundError                 Traceback (most recent call last)

<ipython-input-7-15897cf55e0a> in <module>


      1 #Importing required libraries
----> 2 import tradingeconomics as te
      3 import pandas as pd
      4 import numpy as np
      5 from datetime import datetime,date,timedelta


ModuleNotFoundError: No module named 'tradingeconomics'


Solution 1:[1]

It is possible that you installed the module in an environment and you are not working in the environment, or you are working in an environment but the module was installed outside of the environment. I use a conda environment, you can set up one by typing this in the terminal

conda create --new myenv
conda activate myenv

set up pip using the following

conda install -n myenv pip

then you can download modules

pip install tradingeconomics

use conda deactivate to exit the environment, you can learn more about conda here https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#using-pip-in-an-environment

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raymond Li