No module named ‘distutils’: pandas_datareader

Python 3.12.0

Try using an earlier version of python. distutils was deprecated in python 3.10, and removed in python 3.12. https://docs.python.org/3.12/whatsnew/3.12.html#distutils

Fix:

Install pandas datareader as normal using: pip install pandas-datareader
Under Lib\site-packages\pandas_datareader\compat, open init.py
Remove the following import: from distutils.version import LooseVersion
Add the following import: from packaging.version import Version
Search(Ctrl+F) for LooseVersion and change to Version

Leave a Reply

The maximum upload file size: 500 MB. You can upload: image, audio, video, document, spreadsheet, interactive, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here