Modulenotfounderror: no module named ‘pandas_datareader’ [SOLVED]

In this article, we will explore how to solve Modulenotfounderror: no module named ‘pandas_datareader error. We will provide various solutions to resolve it.

What is no module named ‘pandas_datareader’?

The Modulenotfounderror: no module named ‘pandas_datareader‘ error when the pandas_datareader is not installed and it is imported in your code.

Additionally, your python version is different from the pandas package installed in your system.

How to fix Modulenotfounderror: no module named ‘pandas_datareader’

Here are the following options you can use to fix this error.

  1. Install the pandas_datareader module.

    Particularly there are various options in installing pandas_datareader, select what works best for you.

    Solution 1. Install module using pip.

    pip install pandas-datareader

    Install pandas datareader

    Solution 2. Upgrade pip
    After installation, if still not fixing the issue try to upgrade, use this command—
    pip install pip –upgrade

    upgrade pandas datareader

    Solution 3. Install using conda
    Like pip conda is also a package manager, you may use this command—
    conda install pandas-datareader

    Solution 4. Install from the source

    git clone https://github.com/pydata/pandas-datareader.git
    cd pandas-datareader
    python setup.py install

    If you are using Linux use the following command:

    sudo python3 -m pip install pandas_datareader

  2. Fix the path.

    When you follow all the options above no doubt you’d fix the error.

    However if not, this time we’ll fix it through by correcting the path.

    Here are the things you should do.

    1. If you install the module through pip, you need to uninstall it before installing it again.

    The purpose of this is to eliminate incompatible versions and fixed the path.

    Use this command to uninstall the package.
    pip uninstall pandas_datareader

    2. To fix the pandas package incompatibility, use the command below:
    pip3 install –upgrade pandas

    3. Finally, restart the python kernel and retire it to completely fix the error.

Fixing no module named ‘pandas_datareader’ in macOs

If you are encountering the same issue or error on Mac even if you had install it already.

The following steps will help you fix this error:

Step 1: Uninstall the pandas_datareader package.

  • In your terminal input pip uninstall pandas_datareader and press Enter. This will prompt asking y/n and if you type y this will uninstall the package.

Step 2: Restart the IDE you are using.

  • If you are using you need to restart it.

Step 3: Re-install pandas_datareader package

  • In your terminal, type this command pip install pandas_datareader.

Note: If your terminal shows a lot “pre-installed” pandas_datareader package with message “Requirement already satisfied…” just ignore it.

Step 4: Run the python code again

  • The error No module named ‘pandas_datareader error should be fixed.

Conclusion

In conclusion, by following the steps outlined in this article, you should be able to resolve the error and resume the normal operation of your Python scripts and applications.

We hope that this article has provided you with the information you need to fix this error and continue working with Python packages.

If you are finding solutions to some errors you’re encountering we also have Modulenotfounderror no module named tensorflow contrib.

Diagnostic checklist for “No module named ‘pandas_datareader'”

  • Verify pip install target. Run pip show pandas_datareader — if not installed, run pip install pandas_datareader.
  • Check the active Python interpreter. which python (mac/Linux) or where python (Windows). Both pip and python must point to the same environment.
  • Check virtual environment activation. If you use venv/conda, activate before installing: source .venv/bin/activate.
  • Rule out uppercase/lowercase. Python imports are case-sensitive: import PyPDF2 not import pypdf2.
  • Rule out the pip-vs-package-name mismatch. Some packages install under a different name than you import (e.g. pip install beautifulsoup4import bs4).

Installing pandas_datareader — Python data-analysis stack

# Standard pip install
pip install pandas_datareader

# For Anaconda / miniconda users
conda install -c conda-forge pandas_datareader

# For pandas + numpy stack — install both at once
pip install pandas numpy

Common causes for missing data-analysis modules

  • Anaconda vs. system Python conflict. Anaconda installs a separate Python. Verify which python before pip installing.
  • Wheel platform mismatch. Some pandas versions lack wheels for M1 Mac or ARM Linux. Try pip install --upgrade pip first.
  • Notebook vs terminal Python. Jupyter runs a kernel that may be different from your active shell Python.
  • polars vs pandas. Both exist and both must be installed separately.

Working code example

import pandas_datareader as pd  # or pl for polars
print(pd.__version__)

# Quick smoke test
df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]}) if 'pandas' in 'pandas_datareader' else None
if df is not None:
    print(df.describe())

Best practices

  • Pin versions in requirements.txt. pandas/numpy compatibility matters — mismatched versions cause runtime errors.
  • Use uv or Poetry for dependency resolution across pandas + numpy + sklearn.
  • Consider polars for large data. Modern Rust-based alternative — often 10× faster than pandas.

Frequently Asked Questions

What is Python ModuleNotFoundError and what causes it?

ModuleNotFoundError (a subclass of ImportError) is raised when Python cannot find the module you tried to import. Common causes: the package isn’t installed (pip install missing), wrong virtual environment activated, typo in module name, or Python can’t find your local module on the import path. The error message names exactly which module is missing.

How do I fix ‘ModuleNotFoundError: No module named X’?

Run pip install X first. If that succeeds but you still get the error, check which Python you’re using (which python OR python –version) vs which pip (which pip OR pip –version), they must match. Common gotcha: pip points to system Python 3.9 but you’re running python3.11 in a venv. Inside the venv, use python -m pip install X to be sure pip matches the active Python.

Why does my code work in one environment but not another?

Different Python versions or different installed packages. To diagnose: pip freeze > requirements.txt on the working environment, then pip install -r requirements.txt on the broken one. Use virtualenv (python -m venv venv) or conda for every project to avoid system-wide package collisions.

Is ModuleNotFoundError the same as ImportError?

ModuleNotFoundError is a subclass of ImportError added in Python 3.6. It specifically means ‘no such module exists.’ Plain ImportError covers a wider set: module exists but a name inside it can’t be imported (e.g. ‘cannot import name X from Y’). except ImportError catches both; except ModuleNotFoundError catches only the missing-module case.

Where can I find more ModuleNotFoundError fixes?

Browse the ModuleNotFoundError reference hub for 198+ specific module fixes (TensorFlow, Flask, Django, pandas, numpy, etc.). For related issues see ImportError. For broader Python setup see Python Tutorial hub.

Glay Eliver


Programmer & Technical Writer at PIES IT Solution

Glay Eliver is a programmer and writer at PIES IT Solution, author of over 600 tutorials at itsourcecode.com. Specializes in JavaScript tutorials, Microsoft Office how-tos (Excel, Word, PowerPoint), and Python error debugging covering ImportError, TypeError, AttributeError, ModuleNotFoundError, and JavaScript ReferenceError. Authored several of the site’s highest-traffic Excel and MS Office reference articles.

Expertise: JavaScript · MS Excel · MS Word · MS PowerPoint · Python · Python ImportError · Python TypeError · Python AttributeError · ModuleNotFoundError · JavaScript ReferenceError · Pygame
 · View all posts by Glay Eliver →

Leave a Comment