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
🌐
GitHub
github.com › pypa › pkg_resources
GitHub - pypa/pkg_resources: Extraction of pkg_resources from setuptools. · GitHub
A (still deprecated) copy of pkg_resources as found in Setuptools 80. Made available for a compatibility install in environments that previously dependended on Setuptools for this functionality.
Author: pypa
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

Discussions

ModuleNotFoundError: No module named 'pkg_resources' when installing environment
I wonder if it has something to do with my NodeJS installation, but I'm not sure and I don't know how to debug it. Let me know if I have to post more information about my system. Below is what I tried so far, to no success. I'd appreciate any lead, hint or help. ... ❯ /Users/aa/.pyenv/versions/3.10.0/bin/python3 ... More on github.com
🌐 github.com
9
November 6, 2021
`pkg_resources` is deprecated and removed in Python 3.12
Python 3.12 has removed pkg_resources from the standard library (moved to setuptools): https://docs.python.org/3/whatsnew/3.12.html · gh-95299: Do not pre-install setuptools in virtual environments created with venv. More on github.com
🌐 github.com
December 27, 2023
Pip3 not working - No module named `pkg_resources`
The installation process works fine and Python itself seems to work. But pip cannot be used as it cannot locate the module pkg_resources More on github.com
🌐 github.com
8
June 12, 2019
[BUG] Restore `pkg_resources`
setuptools version setuptools==82.0.0 Python version Python 3.10 OS n/a Additional environment information No response Description (I am reporting this a bug, though it's likely to be more of a dis... More on github.com
🌐 github.com
16
February 9, 2026
🌐
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.
🌐
GitHub
github.com › pre-commit › pre-commit › issues › 2122
ModuleNotFoundError: No module named 'pkg_resources' when installing environment · Issue #2122 · pre-commit/pre-commit
November 6, 2021 - ModuleNotFoundError: No module named 'pkg_resources' when installing environment#2122 · Copy link · Labels · javascriptupstream-bug · andreoliwa · opened · on Nov 6, 2021 · Issue body actions · Hi. I'm getting the error below both on Python 3.10.0 and 3.9.7, only on this mirrors-prettier repo.
Author: pre-commit
🌐
GitHub
gist.github.com › passy › 1292691
pkg_resources.py · GitHub
pkg_resources.py · Raw · pkg_resources.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ·
🌐
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 - 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.
🌐
GitHub
gist.github.com › ssteinbach › 42b3fbccff60ad2409c9178272406c9a
pkg_resources alternatives · GitHub
The development team has been using (and recommending) that developers use python setup.py install while iterating locally on projects. pip install . (without any options) is considerably slower and doesn't appear to re-use the build state, meaning it is a full clean and rebuild of the C++ library. pip install -e . doesn't appear to work, likely because of the interaction with the cmake system. Using pip install will generate a shim script that does not use pkg_resources.
Find elsewhere
🌐
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
🌐
GitHub
github.com › haikuports › haikuports › issues › 3923
Pip3 not working - No module named `pkg_resources` · Issue #3923 · haikuports/haikuports
June 12, 2019 - The installation process works fine and Python itself seems to work. But pip cannot be used as it cannot locate the module pkg_resources
Author: haikuports
🌐
GitHub
github.com › pypa › setuptools › issues › 5174
[BUG] Restore `pkg_resources` · Issue #5174 · pypa/setuptools
February 9, 2026 - setuptools 82.0.0 recently removed the pkg_resources library. This breaks all packages that rely on this for either build-time and runtime. While users can work around this at runtime by pre-installing an older setuptools version in the environment, doing so for build-time dependency on pkg_resources is far more difficult, given the rise of of build isolation in pip and other tools in recent years (I believe this was the key reason for closing #863).
🌐
GitHub
github.com › open-mmlab › mmcv › issues › 3325
[Bug] setup.py raises `ModuleNotFoundError: No module named 'pkg_resources'` after release of setuptools 82.0 · Issue #3325 · open-mmlab/mmcv
February 9, 2026 - Replace pkg_resources with importlib.metadata for Python 3.12 compati…... ... Adding the --no-build-isolation parameter might work. 👍React with 👍23Reacted by explore-code-world7, Great River Bear, Nguyen Binh Son, Yunhao Zeng, lizhiyuan6, LUO Chenxiang, Łukasz Popek, Jiaxuan Liu, wb0716, Messy and 13 more ... (py310) sky@night:/media/sky/萤捷/3DCV/self6dpp$ pip install ...
🌐
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 importlib.metadata should be used. Nevertheless, despite being obsolete, many packages still use it. What produces the error? Setuptools is a library designed to help generate Python library packages, with complementary routines to distutils.
🌐
PyPI
pypi.org › project › setuptools › 8.1
setuptools · PyPI
This change should address virtualenv `#359 <https://github.com/pypa/virtualenv/issues/359>`_ as long as the system encoding is UTF-8 or the IO encoding is specified in the environment, i.e.: ... Fix for encoding issue when installing from Windows executable on Python 3. Distribute #323: Allow setup_requires requirements to supercede installed requirements. Added some new keyword arguments to existing pkg_resources methods.
🌐
GitHub
github.com › pypa › pipenv › issues › 2575
Something weird with pkg-resources · Issue #2575 · pypa/pipenv
August 12, 2018 - Setting project for issue-rZoCsvrN to /tmp/issue Virtualenv location: /home/me/.local/share/virtualenvs/issue-rZoCsvrN Creating a Pipfile for this project... me@mypc:/tmp/issue$ pipenv graph pkg-resources==0.0.0 me@mypc:/tmp/issue$ cat Pipfile [[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] [dev-packages] [requires] python_version = "3.6" me@mypc:/tmp/issue$ pipenv lock Locking [dev-packages] dependencies... Locking [packages] dependencies... Updated Pipfile.lock (ca72e7)! me@mypc:/tmp/issue$ pipenv clean Uninstalling 'pkg-resources'... me@mypc:/tmp/issue$ pipenv graph ERROR: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pipdeptree.py", line 22, in <module> import pkg_resources ModuleNotFoundError: No module named 'pkg_resources' me@mypc:/tmp/issue$
Author: pypa
🌐
GitHub
github.com › sdispater › poetry › issues › 822
No module named 'pkg_resources' in json_schema - new osx install · Issue #822 · python-poetry/poetry
January 22, 2019 - Installed poetry as recommended (using /opt/local/bin/python3.6 as the interpreter) Added poetry to path · Nearly all commands crash the same way · $ poetry version -vvv $ poetry debug:info -vvv $ poetry add requests -vvv All generate the same output: ------ [ModuleNotFoundError] No module named 'pkg_resources' Exception trace: /Users/andrew/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in run() at line 94 status_code = self.do_run(input_, output_) /Users/andrew/.poetry/lib/poetry/console/application.py in do_run() at line 88 return super(Application, self).do_run(i, o) /Users/andrew/
Author: python-poetry
🌐
GitHub
github.com › pypa › pip › issues › 4022
pip freeze includes "pkg-resources==0.0.0" (Ubuntu Server 16.04 LTS) · Issue #4022 · pypa/pip
October 19, 2016 - pip freeze includes "pkg-resources==0.0.0" (Ubuntu Server 16.04 LTS)#4022 · Copy link · Labels · auto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automation · crw · opened · on Oct 19, 2016 · Issue body actions · Pip version: 8.1.2 · Python version: Python 2.7.12 · Operating System: Linux ubuntu 4.4.0-43-generic Pip installs package from cache in spite of version specified #63-Ubuntu SMP Wed Oct 12 13:48:03 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux ·
Author: pypa
🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-pkg-resources
No module named 'pkg_resources' in Python [Solved] | bobbyhadz
And the following command installs it. ... Copied!# Windows python -m pip install setuptools # macOS or Linux python3 -m pip install setuptools # Windows alias py -m pip install setuptools
🌐
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.

🌐
GitHub
github.com › spack › spack › issues › 16250
pip fails with 'No module named pkg_resources' when run from env managed view · Issue #16250 · spack/spack
April 23, 2020 - I've tried simply putting the view's bin onto PATH as well as mucking about with PYTHONPATH. $ PATH=/tmp/moose/bin:$PATH pip install --user pipenv Traceback (most recent call last): File "/tmp/moose/bin/pip", line 7, in <module> from pkg_resources import load_entry_point ImportError: No module ...
Author: spack