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 › dereneaton › ipyrad › issues › 620
No module named 'pkg_resources' · Issue #620 · dereneaton/ipyrad
February 12, 2026 - Traceback (most recent call last): File "/home/jrroberts6/anaconda3/envs/ipyrad_py312/bin/ipyrad", line 6, in <module> from ipyrad.__main__ import main File "/home/jrroberts6/anaconda3/envs/ipyrad_py312/lib/python3.12/site-packages/ipyrad/__main__.py", line 8, in <module> from pkg_resources import get_distribution ModuleNotFoundError: No module named 'pkg_resources' I assumed this was a setuptools issue, but updating setuptools still returned the same error when beginning the pipeline. Any suggestions? Thanks so much for considering this! Jackson · Reactions are currently unavailable · isaacovercast · on Feb 15, 2026 · Collaborator · More actions · Hm, looks like they changed the API. The easiest thing for you to do would be downgrade setuptools to a known working version: conda install -c conda-forge setuptools==81.0.0 ·
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

ImportError: No module named pkg_resources
$ conda build ggplot Traceback ... from pkg_resources import DefaultProvider, ResourceManager, ImportError: No module named pkg_resources · $ conda info Current conda install: platform : linux-64 conda version : 3.7.2 conda-build version : 1.9.0 python version : 2.7.8.final.0 ... More on github.com
🌐 github.com
7
November 6, 2014
ModuleNotFoundError: No module named 'pkg_resources'
Describe the bug Installing celldega in a fresh conda environment results in a pkg_resources import error. I believe it's similar to this bug scverse/spatialdata#1065, which originates from an ... More on github.com
🌐 github.com
2
February 11, 2026
Fenics-ufl ModuleNotFoundError: No module named 'pkg_resources'
I am trying to install gyptis package and I am doing so through windows WSL. This is the list of commands I did: 1 curl -O https://repo.anaconda.com/archive/Anaconda3-2025.12-2-Linux-x86_64.sh 2 sha256sum ~/Anaconda3-2025.12-2-Linux-x86_64.sh 3 bash ~/Anaconda3-2025.12-2-Linux-x86_64.sh 4 source ... More on fenicsproject.discourse.group
🌐 fenicsproject.discourse.group
1
0
February 10, 2026
Pip pkg install Error - Packages & Environments - Anaconda Forum
Description pip fails with import error pertaining to file cache. Expected behavior expected pip to install required pkg. pip version 20.0.4 Python version 3.8 error: ImportError: cannot import name ‘FileCache’ from ‘pip._vendor.cachecontrol.caches’ (unknown location) More on forum.anaconda.com
🌐 forum.anaconda.com
0
March 22, 2022
🌐
Anaconda.org
anaconda.org › conda-forge › types-pkg_resources
types-pkg_resources - conda-forge | Anaconda.org
conda-forge/types-pkg_resources ... Labels 1 · Badges · Versions · 0.1.3 · To install this package, run one of the following: $conda install conda-forge::types-pkg_resources ·...
🌐
GitHub
github.com › conda › conda-build › issues › 239
ImportError: No module named pkg_resources · Issue #239 · conda/conda-build
November 6, 2014 - $ conda build ggplot Traceback ... from pkg_resources import DefaultProvider, ResourceManager, ImportError: No module named pkg_resources · $ conda info Current conda install: platform : linux-64 conda version : 3.7.2 conda-build version : 1.9.0 python version : 2.7.8.final.0 ...
Author: conda
🌐
Moon Technolabs
moontechnolabs.com › qanda › modulenotfounderror-pkg-resources
How to Fix ModuleNotFoundError: 'pkg_resources' Error?
July 22, 2026 - This error typically indicates that the pkg_resources module, which is provided by the setuptools package, is either missing, outdated, corrupted, or inaccessible in the current Python environment. Although the error message appears simple, it can stem from multiple issues, such as an incomplete Python installation, an improperly configured virtual environment, incompatible package versions, or problems with the Python interpreter being used.
🌐
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.
🌐
GitHub
github.com › broadinstitute › celldega › issues › 292
ModuleNotFoundError: No module named 'pkg_resources' · Issue #292 · broadinstitute/celldega
February 11, 2026 - Installing celldega in a fresh conda environment results in a pkg_resources import error. I believe it's similar to this bug scverse/spatialdata#1065, which originates from an error in xarray_schema because pkg_resources was deprecated and was removed in setuptools 82.
Author: broadinstitute
🌐
FEniCS Project
fenicsproject.discourse.group › general
Fenics-ufl ModuleNotFoundError: No module named 'pkg_resources' - General - FEniCS Project
February 10, 2026 - I am trying to install gyptis package and I am doing so through windows WSL. This is the list of commands I did: 1 curl -O https://repo.anaconda.com/archive/Anaconda3-2025.12-2-Linux-x86_64.sh 2 sha256sum ~/Anaconda3-2025.12-2-Linux-x86_64.sh 3 bash ~/Anaconda3-2025.12-2-Linux-x86_64.sh 4 source ~/.bashrc 5 ls 6 mkdir python_packages 7 cd python_packages 8 git clone https://gitlab.com/gyptis/gyptis.git 9 cd gyptis 10 conda config --add channels conda...
Find elsewhere
🌐
Conda
docs.conda.io › projects › conda › en › stable › user-guide › troubleshooting.html
Troubleshooting — conda 26.5.3 documentation
Occasionally, an installed package becomes corrupted. Conda works by unpacking the packages in the pkgs directory and then hard-linking them to the environment. Sometimes these get corrupted, breaking all environments that use them.
🌐
Anaconda Forum
forum.anaconda.com › product help › packages & environments
Pip pkg install Error - Packages & Environments - Anaconda Forum
March 22, 2022 - Description pip fails with import error pertaining to file cache. Expected behavior expected pip to install required pkg. pip version 20.0.4 Python version 3.8 error: ImportError: cannot import name ‘FileCache’ …
🌐
Anaconda Forum
forum.anaconda.com › product help › anaconda navigator
Getting ModuleNotFoundError: No module named 'pkg_resources._vendor.packaging._elffile' when trying to start spyder - Anaconda Navigator - Anaconda Forum
December 11, 2023 - The full error is below: Traceback (most recent call last): File “/Users/bennicholl/opt/anaconda3/bin/spyder”, line 7, in from spyder.app.start import main File “/Users/bennicholl/opt/anaconda3/lib/python3.8/site-pa…
🌐
Arch Linux
aur.archlinux.org › packages › python-conda
AUR (en) - python-conda
BTW, I personally recommend trying the micromamba-bin currently. for mamba is a more powerful python env/lib manager based on conda's resources.
🌐
Zooniverse
zooniverse.org › talk › 1322 › 3384300
Installation of panoptes-cli » Talk
The Zooniverse is the world’s largest and most popular platform for people-powered research.
🌐
Conda
docs.conda.io › projects › conda › en › stable › release-notes.html
Release notes — conda 26.5.3 documentation
Mark conda.common.pkg_formats subpackage as pending deprecation, to be removed in 26.3. Use the prefix_data_loaders plugin hook instead.
🌐
Google Groups
groups.google.com › g › pyinstaller › c › PsdNus1ujqw
ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
hidden-import='pkg_resources.py2_warn' information. The hook for pkg_resources has been updated on github but the changes haven't been released yet. You could upgrade to the developer version on Github or you could manually update that file in your own installation.
🌐
Anaconda.org
anaconda.org › conda-forge › get_version
get_version - conda-forge | Anaconda.org
$conda install conda-forge::get_version · Monthly · Downloads Updates · Version · 3.5.5 · 3.5.4 · 3.5.3 · 3.5.1 · 3.5 · 5 / 8 versions selected · Downloads (Last 6 months): 0 · A version helper in the spirit of versioneer. Minimalistic and able to run without build step using ...
🌐
Fast.ai
forums.fast.ai › intro to machine learning (2018)
Conda env update does not work - Intro to Machine Learning (2018) - fast.ai Course Forums
October 3, 2018 - Hi, I followed the installation guideline by first creating an Ubuntu 16.04 VM on Google Cloud Platform, cloned fast ai, downloaded anaconda distribution but when I do a conda env update on fast ai folder I am getting t…
🌐
Fast.ai
forums.fast.ai › part 1 (2018) › beginner (2018)
Conda env update error on Paperspace - Beginner (2018) - fast.ai Course Forums
September 29, 2018 - After a new git pull of the fast ai libraries I went on to execute conda env update from my paperspace account and I got the following error dump. This is where the problem begins: Exception: Traceback (most recent call last): File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/pip/_vendor/pkg_resources/ init .py”, line 2869, in _dep_map return self.__dep_map File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/pip/_vendor/pkg_resources/ init .py”, lin...
🌐
Google Groups
groups.google.com › g › idr-discuss › c › IB6o96xhjz8
Problems with IDR using anaconda
March 30, 2016 - line 4, in <module> __import__('pkg_resources').run_script('idr==2.0.2', 'idr') File "/usr/bin/anaconda3/lib/python3.5/site-packages/setuptools-20.3-py3.5.egg/pkg_resources/__init__.py", line 726, in run_script File "/usr/bin/anaconda3/lib/python3.5/site-packages/setuptools-20.3-py3.5.egg/pkg_resources/__init__.py", line 1484, in run_script File "/usr/bin/anaconda3/lib/python3.5/site-packages/idr-2.0.2-py3.5-linux-x86_64.egg/EGG-INFO/scripts/idr", line 10, in <module> idr.idr.main() File "/usr/bin/anaconda3/lib/python3.5/site-packages/idr-2.0.2-py3.5-linux-x86_64.egg/idr/idr.py", line 736, in