July 2018 Update

Most people should now use pip install setuptools (possibly with sudo).

Some may need to (re)install the python-setuptools package via their package manager (apt-get install, yum install, etc.).

This issue can be highly dependent on your OS and dev environment. See the legacy/other answers below if the above isn't working for you.

Explanation

This error message is caused by a missing/broken Python setuptools package. Per Matt M.'s comment and setuptools issue #581, the bootstrap script referred to below is no longer the recommended installation method.

The bootstrap script instructions will remain below, in case it's still helpful to anyone.

Legacy Answer

I encountered the same ImportError today while trying to use pip. Somehow the setuptools package had been deleted in my Python environment.

To fix the issue, run the setup script for setuptools:

wget https://bootstrap.pypa.io/ez_setup.py -O - | python

(or if you don't have wget installed (e.g. OS X), try

curl https://bootstrap.pypa.io/ez_setup.py | python

possibly with sudo prepended.)

If you have any version of distribute, or any setuptools below 0.6, you will have to uninstall it first.*

See Installation Instructions for further details.


* If you already have a working distribute, upgrading it to the "compatibility wrapper" that switches you over to setuptools is easier. But if things are already broken, don't try that.

Answer from cwc on Stack Overflow
Top answer
1 of 16
983

July 2018 Update

Most people should now use pip install setuptools (possibly with sudo).

Some may need to (re)install the python-setuptools package via their package manager (apt-get install, yum install, etc.).

This issue can be highly dependent on your OS and dev environment. See the legacy/other answers below if the above isn't working for you.

Explanation

This error message is caused by a missing/broken Python setuptools package. Per Matt M.'s comment and setuptools issue #581, the bootstrap script referred to below is no longer the recommended installation method.

The bootstrap script instructions will remain below, in case it's still helpful to anyone.

Legacy Answer

I encountered the same ImportError today while trying to use pip. Somehow the setuptools package had been deleted in my Python environment.

To fix the issue, run the setup script for setuptools:

wget https://bootstrap.pypa.io/ez_setup.py -O - | python

(or if you don't have wget installed (e.g. OS X), try

curl https://bootstrap.pypa.io/ez_setup.py | python

possibly with sudo prepended.)

If you have any version of distribute, or any setuptools below 0.6, you will have to uninstall it first.*

See Installation Instructions for further details.


* If you already have a working distribute, upgrading it to the "compatibility wrapper" that switches you over to setuptools is easier. But if things are already broken, don't try that.

2 of 16
153
sudo apt-get install --reinstall python-pkg-resources

fixed it for me in Debian. Seems like uninstalling some .deb packages (twisted set in my case) has broken the path python uses to find packages

🌐
GitHub
github.com › dgtlmoon › changedetection.io › issues › 2422
"No module named pkg_resources" on Python 3.12 due to missing "setuptools" · Issue #2422 · dgtlmoon/changedetection.io
June 17, 2024 - The error only happens when it actually tries to detect changes for a URL (or any URL). Every URL ends up with "No module named pkg_resources" error, and that's the only error message from the console.
Discussions

Impossible to get pkg_resources on Windows?
pkg_resources was removed from setuptools after v81. You need to install an earlier version of setuptools (I ran into this exact issue yesterday actually lol) More on reddit.com
🌐 r/learnpython
9
2
February 13, 2026
Why module pkg_resources is not found
When starting the process, an error occurs that the system cannot find the pkg_resource module, I checked the presence of setuptools and pkg_resources in the folder (IT exists, it is there), I thought that an error occurred and deleted setuptools pip uninstall setuptools and then downloaded ... More on discuss.python.org
🌐 discuss.python.org
1
0
November 22, 2024
`pkg_resources` is deprecated and removed in Python 3.12
From the pkg_resources docs: https://setuptools.pypa.io/en/latest/pkg_resources.html · Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. ... More on github.com
🌐 github.com
December 27, 2023
Django Error: ModuleNotFoundError: No module named 'pkg_resources'
I'm suspecting you're using DRF where coreapi has been replaced a while ago, https://www.django-rest-framework.org/community/3.10-announcement/ More on reddit.com
🌐 r/learnpython
3
2
May 20, 2024
People also ask

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.
🌐
itsourcecode.com
itsourcecode.com › home › [solved 2026] modulenotfounderror: no module named ‘pkg_resources’ fix
[Solved 2026] ModuleNotFoundError: No module named 'pkg_resources' Fix
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.
🌐
itsourcecode.com
itsourcecode.com › home › [solved 2026] modulenotfounderror: no module named ‘pkg_resources’ fix
[Solved 2026] ModuleNotFoundError: No module named 'pkg_resources' Fix
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.
🌐
itsourcecode.com
itsourcecode.com › home › [solved 2026] modulenotfounderror: no module named ‘pkg_resources’ fix
[Solved 2026] ModuleNotFoundError: No module named 'pkg_resources' Fix
🌐
Medium
medium.com › @sherlock297 › error-modulenotfounderror-no-module-named-pkg-resources-e64548127db3
Error — ModuleNotFoundError: No module named ‘pkg_resources’ - Ravindra Dagale - Medium
August 31, 2024 - C:\Users\User\Downloads\dnsReaper-1.10.0\dnsReaper-1.10.0>python main.py — help Traceback (most recent call last): File “C:\Users\User\Downloads\dnsReaper-1.10.0\dnsReaper-1.10.0\main.py”, line 5, in <module> import providers File “C:\Users\User\Downloads\dnsReaper-1.10.0\dnsReaper-1.10.0\providers\__init__.py”, line 9, in <module> from . import * File “C:\Users\User\Downloads\dnsReaper-1.10.0\dnsReaper-1.10.0\providers\googlecloud.py”, line 4, in <module> from google.cloud import dns File “C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\cloud\dns\__init__.py”, line 28, in <module> from pkg_resources import get_distribution ModuleNotFoundError: No module named ‘pkg_resources’
🌐
Reddit
reddit.com › r/learnpython › impossible to get pkg_resources on windows?
r/learnpython on Reddit: Impossible to get pkg_resources on Windows?
February 13, 2026 -

I am running on Windows Powershell. I know, it sucks, but it is what I am stuck with.

I have installed python 3.14 from the python.org website. When I run python and run "import setuptools", it works. When I check the version of setuptools, it is 82.0.0. No problems there.

But pkg_resources will not import. Specifically, "import pkg_resources" always fails.

I have reinstalled using --force-reinstall, I have downloaded the setuptools wheel file, none of that works. It just will not recognize pkg_resources.

Is there no pkg_resources file for Windows? Or what on earth is going on here? Every guide I read just keeps repeating that I should reinstall, but I have done that, multiple times, from multiple sources.

🌐
Liquid Instruments
knowledge.liquidinstruments.com › python-api-examples › moku-library-pkg_resource-error-fix
Fix for ''No module named pkg_resources" error - Liquid Instruments
August 29, 2024 - During installation of the Moku API on the latest versions of Python (>3.12), the installation may encounter an error No module named ‘pkg_resources' when the command moku download is run.
🌐
Python.org
discuss.python.org › python help
Why module pkg_resources is not found - Python Help - Discussions on Python.org
November 22, 2024 - When starting the process, an error ... exists, it is there), I thought that an error occurred and deleted setuptools pip uninstall setuptools and then downloaded ......
🌐
GitHub
github.com › mu-editor › mu › issues › 2485
`pkg_resources` is deprecated and removed in Python 3.12 · Issue #2485 · mu-editor/mu
December 27, 2023 - From the pkg_resources docs: https://setuptools.pypa.io/en/latest/pkg_resources.html Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). So...
Find elsewhere
🌐
Itsourcecode
itsourcecode.com › home › [solved 2026] modulenotfounderror: no module named ‘pkg_resources’ fix
[Solved 2026] ModuleNotFoundError: No module named 'pkg_resources' Fix
July 12, 2026 - Fix Python "ModuleNotFoundError: No module named 'pkg_resources'" by installing setuptools: pip install setuptools. 2026 fix.
🌐
Reddit
reddit.com › r/learnpython › django error: modulenotfounderror: no module named 'pkg_resources'
r/learnpython on Reddit: Django Error: ModuleNotFoundError: No module named 'pkg_resources'
May 20, 2024 -

Hi everyone,

I'm encountering an error while trying to run my Django project. When I execute python manage.py runserver, I get the following error message:

Watching for file changes with StatReloader

Exception in thread django-main-thread:

Traceback (most recent call last):

File "C:\Python312\Lib\threading.py", line 1052, in _bootstrap_inner

self.run()

File "C:\Python312\Lib\threading.py", line 989, in run

self._target(*self._args, **self._kwargs)

File "C:\Website\my_env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper

fn(*args, **kwargs)

File "C:\Website\my_env\Lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run

autoreload.raise_last_exception()

File "C:\Website\my_env\Lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception

raise _exception[1]

File "C:\Website\my_env\Lib\site-packages\django\core\management\__init__.py", line 394, in execute

autoreload.check_errors(django.setup)()

File "C:\Website\my_env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper

fn(*args, **kwargs)

File "C:\Website\my_env\Lib\site-packages\django\__init__.py", line 24, in setup

apps.populate(settings.INSTALLED_APPS)

File "C:\Website\my_env\Lib\site-packages\django\apps\registry.py", line 91, in populate

app_config = AppConfig.create(entry)

^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Website\my_env\Lib\site-packages\django\apps\config.py", line 193, in create

import_module(entry)

File "C:\Python312\Lib\importlib\__init__.py", line 90, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "<frozen importlib._bootstrap>", line 1381, in _gcd_import

File "<frozen importlib._bootstrap>", line 1354, in _find_and_load

File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 929, in _load_unlocked

File "<frozen importlib._bootstrap_external>", line 994, in exec_module

File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed

File "C:\Website\my_env\Lib\site-packages\coreapi\__init__.py", line 2, in <module>

from coreapi import auth, codecs, exceptions, transports, utils

File "C:\Website\my_env\Lib\site-packages\coreapi\auth.py", line 1, in <module>

from coreapi.utils import domain_matches

File "C:\Website\my_env\Lib\site-packages\coreapi\utils.py", line 5, in <module>

import pkg_resources

ModuleNotFoundError: No module named 'pkg_resources'

Here's some additional information that might be helpful:

I'm using Django version 5.0.6.

I've already tried pip install pkg_resources but I get this:

ERROR: Could not find a version that satisfies the requirement pkg_resources (from versions: none)

ERROR: No matching distribution found for pkg_resources

Any insights on what might be causing this and how to fix it would be greatly appreciated!

🌐
GitHub
github.com › fralau › mkdocs-macros-plugin › issues › 169
ModuleNotFoundError: No module named 'pkg_resources' on python 3.12 · Issue #169 · fralau/mkdocs-macros-plugin
June 4, 2023 - File "/.../.venv/lib/python3.12/site-packages/mkdocs_macros/__init__.py", line 7, in <module> from .context import fix_url, is_relative as is_relative_url File "/.../.venv/lib/python3.12/site-packages/mkdocs_macros/context.py", line 19, in <module> import pkg_resources ModuleNotFoundError: No module named 'pkg_resources'
Author: fralau
🌐
Reddit
reddit.com › r/love2d › no module named 'pkg_resources' error while building love game
r/love2d on Reddit: No module named 'pkg_resources' error while building love game
June 11, 2024 -

I got this error when trying to build my love2d game with makelove: * Executing task: C:\Users\Eli\AppData\Local\Programs\Python\Python312\Scripts\makelove.exe --config make_all.toml

Traceback (most recent call last):

File "<frozen runpy>", line 198, in _run_module_as_main

File "<frozen runpy>", line 88, in _run_code

File "C:\Users\Eli\AppData\Local\Programs\Python\Python312\Scripts\makelove.exe\__main__.py", line 4, in <module>

File "C:\Users\Eli\AppData\Local\Programs\Python\Python312\Lib\site-packages\makelove\makelove.py", line 11, in <module>

import pkg_resources

ModuleNotFoundError: No module named 'pkg_resources'

* The terminal process "C:\Users\Eli\AppData\Local\Programs\Python\Python312\Scripts\makelove.exe '--config', 'make_all.toml'" terminated with exit code: 1.

* Terminal will be reused by tasks, press any key to close it.

How do i fix this?

🌐
Moon Technolabs
moontechnolabs.com › qanda › modulenotfounderror-pkg-resources
How to Fix ModuleNotFoundError: 'pkg_resources' Error?
July 22, 2026 - ... The ModuleNotFoundError: No module named ‘pkg_resources’ error is usually caused by a missing or corrupted setuptools installation, an incorrect Python interpreter, or a broken virtual environment.
🌐
sebhastian
sebhastian.com › python-no-module-named-pkg-resources
Fix Python ModuleNotFoundError: No module named 'pkg_resources' | sebhastian
January 27, 2023 - The ModuleNotFoundError: No module named 'pkg_resources' occurs in Python when the setuptools module can’t be found.
🌐
GitHub
github.com › AnswerDotAI › nbdev › issues › 1423
Python 3.12 No module named 'pkg_resources' · Issue #1423 · AnswerDotAI/nbdev
July 12, 2024 - ➜ pip install nbdev ➜ nbdev_new Traceback (most recent call last): File "/Users/user/Documents/Code/Shell/NBDev_Tutorial/venv/bin/nbdev_new", line 5, in <module> from nbdev.cli import nbdev_new File "/Users/user/Documents/Code/Shell/NBDev_Tutorial/venv/lib/python3.12/site-packages/nbdev/__init__.py", line 3, in <module> from .doclinks import nbdev_export File "/Users/user/Documents/Code/Shell/NBDev_Tutorial/venv/lib/python3.12/site-packages/nbdev/doclinks.py", line 17, in <module> import pkg_resources,importlib ModuleNotFoundError: No module named 'pkg_resources'
Author: AnswerDotAI
🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-pkg-resources
No module named 'pkg_resources' in Python [Solved] | bobbyhadz
The error "No module named 'pkg_resources'" occurs when you don't have the setuptools package installed.
🌐
GitHub
github.com › FunctionLab › selene › issues › 201
ModuleNotFoundError: No module named 'pkg_resources' with Python 3.12+ · Issue #201 · FunctionLab/selene
March 11, 2026 - Starting with Python 3.12, setuptools (which provides pkg_resources) is no longer pre-installed by default in virtual environments (per PEP 632 and Python 3.12 release notes).
Author: FunctionLab
Top answer
1 of 3
1

The error indicates that the pkg_resources module, part of the setuptools library, is not available in your Python environment. This module is used by pandas_ta for some of its operations.

Fixing the Issue

To resolve this, ensure that setuptools is installed in your Python environment. You can do this as follows:

  1. Install setuptools: Run the following command in your terminal:

    pip install setuptools
    
  2. Verify Installation: After installation, confirm that pkg_resources is available:

    python -c "import pkg_resources; print('pkg_resources is available')"
    

If the Issue Persists

If the error still occurs:

  • Upgrade pip and setuptools:
    pip install --upgrade pip setuptools
    
2 of 3
1

Ive been having a similar problem. This might help, though its not definitive. Sadly I havent found a permanent solution as the problem seems to be with the packages/compatibilities.

So, I have program I wrote in pycharm that uses pandas-ta and has worked perfectly for the past year or so... until I tried to improve the code, using a new project with a new interpreter.

I downloaded all the same librares, and used the same (working) code at first, but keep getting an error similar to yours:

UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import get_distribution, DistributionNotFound

I cant find a solution, BUT, when checking google/chatgpt, I kept getting suggestions to downgrade libraries.

On checking, I noticed that although the interpreters use the same packages, and python 3.12, the versions of the packages were different.

In the code that works with pandas_ta, numpy is 1.26.4 and pandas is 2.2.3.

In the new code, thats giving me the error, numpy is 2.3.1 and pandas is 2.3.0.

Its not ideal (and from the date of the post a bit late), but maybe if you downgrade the pandas and/or numpy to these versions, then install pandas_ta, it might work?

🌐
JetBrains
youtrack.jetbrains.com › issue › PY-63732 › ModuleNotFoundError-No-module-named-pkgresources-rendering-Google-styled-docstring
No module named 'pkg_resources'" rendering Google- ...
{{ (>_<) }} This version of your browser is not supported. Try upgrading to the latest stable version. Something went seriously wrong
🌐
GitHub
github.com › jjjake › internetarchive › issues › 613
[Bug] No module named 'pkg_resources' · Issue #613 · jjjake/internetarchive
October 21, 2023 - Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Python\Python312\Scripts\ia.exe\__main__.py", line 4, in <module> File "C:\Python\Python312\Lib\site-packages\internetarchive\cli\__init__.py", line 26, in <module> from internetarchive.cli import ( File "C:\Python\Python312\Lib\site-packages\internetarchive\cli\ia.py", line 67, in <module> from pkg_resources import DistributionNotFound, iter_entry_points ModuleNotFoundError: No module named 'pkg_resources' I downloaded the repo, and opened it in vscode. After I installed the pex-requirements.txt, vscode said that pkg_resources was found. I think this might be a problem with python 3.12, because I was able to get it installed and working just fine with python 3.11.
Author: jjjake
🌐
Google Groups
groups.google.com › g › jenkins-job-builder › c › -cMS_jomIHA
python3.12 issue with setuptools
This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment. ... ❯ cat if_publisher.yml - job-template: name: 'test-job-{variant}' triggers: !j2-yaml: | {% if ...