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 › 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...
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
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
"No module named pkg_resources" on Python 3.12 due to missing "setuptools"
Describe the bug Running 0.45.24 on Python 3.12. It will not be able to work because "setuptools" is missing Version ChangeDetection 0.45.24. Python 3.12.4 To Reproduce Steps to reproduce the behav... More on github.com
🌐 github.com
June 17, 2024
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
🌐
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 som…
🌐
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.

🌐
PyPI
pypi.org › project › types-pkg-resources
types-pkg-resources
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
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 ...
Find elsewhere
🌐
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 - Python 3.12.4 ... Solution pip install setuptools and it will work. ... I installed by pip install changedetection.io. I want to clarify that the installation is totally fine - Nothing wrong happens during installation. 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.
🌐
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 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 ...
🌐
PyPA
setuptools.pypa.io › en › latest › deprecated › pkg_resources.html
Package Discovery and Resource Access using pkg_resources - setuptools 84.0.0 documentation
It also provides runtime support ... “working set” of active packages. The pkg_resources module provides runtime facilities for finding, introspecting, activating and using installed Python distributions....
🌐
Readthedocs
jmchilton-galaxy.readthedocs.io › en › latest › lib › pkg_resources.html
pkg_resources Module — Galaxy Code documentation
The package resource API is designed to work with normal filesystem packages, .egg files, and unpacked .egg files. It can also work in a limited way with .zip files and with custom PEP 302 loaders that support the get_data() method. ... This returns the PYTHON_EGG_CACHE environment variable, if set.
🌐
GitHub
github.com › pypa › setuptools › issues › 4374
[BUG] No module named 'pkg_resources.extern' · Issue #4374 · pypa/setuptools
May 21, 2024 - python -m pip install -U setuptools pip install -U pyarmor==7.* pyinstaller[encryption]==4.* pyarmor pack main.py · Traceback (most recent call last): File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py", line 158, in <module> File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py", line 36, in _pyi_rthook File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "pkg_resources\__init__.py", line 77, in <module> ModuleNotFoundError: No module named 'pkg_resources.extern'
Author: pypa
🌐
Snapcraft
forum.snapcraft.io › t › python-pkg-resources-only-works-in-certain-paths › 978
Python pkg_resources only works in certain paths - snap - snapcraft.io
June 12, 2017 - I’ve built a snap with a number of parts, including a python and a catkin part, and I’m getting some weird behavior. I’m running it on Ubuntu 16.04.2 with snap 2.25. My test app simply calls python, and when I run my-snap.python -c "import pkg_resources" I get the following Exception: Traceback (most recent call last): File " ", line 1, in File "/snap/my-snap/x9/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2927, in @_call_aside File "/snap/...
🌐
NixOS Discourse
discourse.nixos.org › help
Platformio python issue: No module named 'pkg_resources' - Help - NixOS Discourse
August 24, 2023 - Hi! I’m trying to use the espidf framework for a platformio project. When trying to build / run using pio run, the dependencies start getting installed but it fails with this error: ModuleNotFoundError: No module named 'pkg_resources': File "/nix/store/s3adyk2jm5rfhffsa3m9wfcgzaq0asci-platformio-6.1.6/lib/python3.10/site-packages/platformio/builder/main.py", line 187: env.SConscript("$BUILD_SCRIPT") File "/home/xxx/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscr...
🌐
GitHub
github.com › scientific-python › pytest-doctestplus › issues › 93
No module named 'pkg_resources' on our CI · Issue #93 · scientific-python/pytest-doctestplus
February 11, 2020 - File "/home/vsts/work/1/s/.tox/py38-online/lib/python3.8/site-packages/pytest_doctestplus/utils.py", line 20, in init import pkg_resources ModuleNotFoundError: No module named 'pkg_resources'
Author: scientific-python
🌐
GitHub
github.com › pypa › setuptools › issues › 5174
[BUG] Restore `pkg_resources` · Issue #5174 · pypa/setuptools
February 9, 2026 - While workaround do exist for pip (which has the --no-build-isolation hammer), I don't believe other tools like tox have equivalent options. The removal of pkg_resources thus effectively breaks installation of older packages, which is very unfortunate given these are still quite common in the wild.
🌐
GitHub
github.com › pyinstaller › pyinstaller › issues › 8554
with setuptools v70.0.0: `ModuleNotFoundError: No module named 'pkg_resources.extern'` · Issue #8554 · pyinstaller/pyinstaller
May 21, 2024 - We'll fix this for next PyInstaller release, but since I see PyInstaller 4.x mentioned up there, you'll have to work around this by adding --hiddenimport pkg_resources.extern or the equivalent .spec directive.
🌐
Gentoo
packages.gentoo.org › packages › dev-python › pkg-resources
dev-python/pkg-resources – Gentoo Packages
March 25, 2026 - Backwards compatibility package for pkg_resources that have been removed from >=dev-python/setuptools-82.
🌐
Python
bugs.python.org › issue42744
Issue 42744: pkg_resources seems to treat python 3.10 as python 3.1 - Python tracker
December 25, 2020 - This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide · This issue has been migrated to GitHub: https://github.com/python/cpython/issues/86910
🌐
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’