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
🌐
PyPA
setuptools.pypa.io › en › latest › deprecated › pkg_resources.html
Package Discovery and Resource Access using pkg_resources - setuptools 84.0.0 documentation
Removed in version v82.0.0: pkg_resources is no longer maintained, no longer used internally by setuptools, and is no longer included in current distributions/installations as of setuptools v82.0.0.
Discussions

`pkg_resources` removal: how to go from there? - Packaging - Discussions on Python.org
As some of you have probably noticed already, setuptools 82 removed pkg_resources. While I’m not opposed to the decision per se, I’m slightly worried about the fallout from the removal. In particular, I’m looking for some coordination on how we handle it. More on discuss.python.org
🌐 discuss.python.org
5
February 9, 2026
Bench new-site throws Error: No module named ‘pkg_resources’
Hi, On a new install (Ubuntu 22.04, ... Settings, the DocType you’re trying to open might be deleted. Error: No module named ‘pkg_resources’ I’ve tried reinstalling setuptools several times but doesn’t seem to solve the issue Is this a bug ? Any ideas how to get around ... More on discuss.frappe.io
🌐 discuss.frappe.io
19
1
February 9, 2026
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
Will setuptools remove `pkg_resources` module in the future? - Packaging - Discussions on Python.org
pkg_resource module in setuptools is marked as deprecated now. Will it be removed in the future? If so, when will it be removed? It says to migrate from pkg_resource to importlib.metadata and importlib.resource. But I don’t think it is a easy work. There is no drop-in replacement for Requirement ... More on discuss.python.org
🌐 discuss.python.org
0
May 28, 2023
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

🌐
PyPI
pypi.org › project › setuptools › 8.1
setuptools · PyPI
Issue #258: Setuptools now patches distutils msvc9compiler to recognize the specially-packaged compiler package for easy extension module support on Python 2.6, 2.7, and 3.2. Issue #237: pkg_resources now uses explicit detection of Python 2 vs.
🌐
Python.org
discuss.python.org › packaging
`pkg_resources` removal: how to go from there? - Packaging - Discussions on Python.org
February 9, 2026 - As some of you have probably noticed already, setuptools 82 removed pkg_resources. While I’m not opposed to the decision per se, I’m slightly worried about the fallout from the removal. In particular, I’m looking for some coordination on how we handle it.
🌐
Cosmoscalibur
cosmoscalibur.com › home › no module named pkg_resources found in uv environment
No module named pkg_resources found in UV environment — Cosmoscalibur
February 23, 2026 - The pkg_resources module belongs to the setuptools package and allows access to resource files and discovery of extensions. However, this module is not recommended and has been marked as deprecated; instead, importlib.resources and ...
🌐
Frappe
discuss.frappe.io › t › bench-new-site-throws-error-no-module-named-pkg-resources › 160415
Bench new-site throws Error: No module named ‘pkg_resources’ - Frappe Forum
February 9, 2026 - Error: No module named ‘pkg_resources’ · Same issue in Ubuntu 24.04.2 LTS , Frappe Framework: v15.99.0 ... This is currently a blocker for all Frappe v15 instances. setuptools v82.0.0 removed pkg_resources, which is still required by the Dropbox dependency used in Frappe v15.
🌐
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.

Find elsewhere
🌐
Python.org
discuss.python.org › packaging
Will setuptools remove `pkg_resources` module in the future? - Packaging - Discussions on Python.org
May 28, 2023 - pkg_resource module in setuptools is marked as deprecated now. Will it be removed in the future? If so, when will it be removed? It says to migrate from pkg_resource to importlib.metadata and importlib.resource. But I don’t think it is a easy work. There is no drop-in replacement for Requirement ...
🌐
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 - Python 3.12 has removed pkg_resources from the standard library (moved to setuptools): https://docs.python.org/3/whatsnew/3.12.html
🌐
Arshan's blogs
blog.arshanaslam.me › fixing-no-module-named-pkgresources-after-setuptools-82-removal
Fixing “No module named 'pkg_resources'” After Setuptools 82 Removal
February 11, 2026 - When environments install the latest Setuptools, the module is no longer present, resulting in the error. If your project or dependencies still rely on pkg_resources, install a Setuptools version below 82.
🌐
GitHub
github.com › openai › CLIP › issues › 528
Build fails with setuptools 81+ due to pkg_resources removal · Issue #528 · openai/CLIP
February 9, 2026 - Description Problem CLIP fails to build with setuptools 82+ because setup.py imports pkg_resources, which was removed in setuptools 81 (08 Feb 2026). ModuleNotFoundError: No module named 'pkg_resources' The failing line in setup.py: from...
🌐
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 - Just so you know that setuptools is included in Python <3.11 but NOT included in Python 3.12. It is just a difference between 3.11 and 3.12 that users need to be aware of. Therefore, to run changedetection on 3.12 the users have to manually install setuptools.
🌐
Setuptools
setuptools.pypa.io › en › stable › history.html
History - setuptools 84.0.0 documentation
pkg_resources has been removed from Setuptools. Most common uses of pkg_resources have been superseded by the importlib.resources and importlib.metadata projects. Projects and environments relying on pkg_resources for namespace packages or other behavior should depend on older versions of ...
🌐
Python
peps.python.org › pep-0365
PEP 365 – Adding the pkg_resources module | peps.python.org
April 30, 2007 - Currently, pkg_resources is only available through installing the entire setuptools distribution, but it does not depend on any other part of setuptools; in effect, it comprises the entire runtime support library for Python Eggs, and is ...
🌐
Anvil
anvil.works › anvil q&a
FYI, setuptools v81 and later no longer has pkg_resources - Anvil Q&A - Anvil Community Forum
February 9, 2026 - I have been using docxcompose for one of my projects for ages and it just started erroring this evening. It gave me this error: ModuleNotFoundError: No module named 'pkg_resources' at /home/anvil/.env/lib/python3.10/sit…
🌐
Apache Superset
superset.apache.org › pkg_resources migration guide
pkg_resources Migration Guide | Superset
As of setuptools 81.0.0, the pkg_resources API is deprecated and will be removed.
🌐
Apache Superset
superset.apache.org › pkg-resources-migration
pkg-resources-migration - Apache Superset
November 30, 2025 - As of setuptools 81.0.0 (scheduled for removal around 2025-11-30), the pkg_resources API is deprecated and will be removed.
🌐
PyPA
setuptools.pypa.io › en › latest › setuptools.html
Building and Distributing Packages with Setuptools - setuptools 84.0.0 documentation
Setuptools automatically calls declare_namespace() for you at runtime, but future versions may not. This is because the automatic declaration feature has some negative side effects, such as needing to import all namespace packages during the initialization of the pkg_resources runtime, and also the need for pkg_resources to be explicitly imported before any namespace packages work at all.