ModuleNotFoundError: No module named 'setuptools'

Have an error like that and i can’t fix it. Can anybody help me? I can pip install but some of them(pyautogui,ta-lib for now) i can’t manually install or pip install

Collecting pyautogui
  Using cached PyAutoGUI-0.9.53.tar.gz (59 kB)
  Preparing metadata (setup.py) ... done
Collecting pymsgbox
  Using cached PyMsgBox-1.0.9.tar.gz (18 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\commands\install.py", line 400, in run
    requirement_set = resolver.resolve(
                      ^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
                            ^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 373, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 213, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 204, in _get_updated_criteria
    self._add_to_criteria(criteria, requirement, parent=candidate)
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
    if not criterion.candidates:
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
    return bool(self._sequence)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
    return any(self)
           ^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
    candidate = func()
                ^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 206, in _make_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
                                       ^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 297, in __init__
    super().__init__(
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 162, in __init__
    self.dist = self._prepare()
                ^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 231, in _prepare
    dist = self._prepare_distribution()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 308, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 491, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 577, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 69, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\distributions\sdist.py", line 48, in prepare_distribution_metadata
    self._install_build_reqs(finder)
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\distributions\sdist.py", line 118, in _install_build_reqs
    build_reqs = self._get_build_requires_wheel()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\distributions\sdist.py", line 95, in _get_build_requires_wheel
    return backend.get_requires_for_build_wheel()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_internal\utils\misc.py", line 685, in get_requires_for_build_wheel
    return super().get_requires_for_build_wheel(config_settings=cs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\pep517\wrappers.py", line 173, in get_requires_for_build_wheel
    return self._call_hook('get_requires_for_build_wheel', {
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\pep517\wrappers.py", line 319, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "C:\Users\utku-\PycharmProjects\pythonProject5\venv\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 77, in _build_backend
    obj = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\utku-\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'setuptools'

You need to install the setuptools module.

setuptools module installed but still same error. setuptools version 65.5.0

But setuptools is installed in the PyCharm venv?

Yes. I installed with pip. I tried to reinstall but did’nt solve.

Have you tried

pip install -U pip setuptools wheel

?

(wheel optional)

Still same error.

Can you post the result of

pip list

?

PS:

In my case, two different versions of setuptools were installed for some reason. Discovered it when I tried pip uninstall setuptools
Python 3: ImportError "No Module named Setuptools" - Stack Overflow

(venv) PS C:\Users\utku-\PycharmProjects\pythonProject5> pip list
Package                   Version
------------------------- -----------
aiohttp                   3.8.3
aiosignal                 1.3.1
altgraph                  0.17.3
anyio                     3.6.2
argon2-cffi               21.3.0
argon2-cffi-bindings      21.2.0
arrow                     1.2.3
asttokens                 2.2.1
async-generator           1.10
async-timeout             4.0.2
attrs                     22.2.0
autogui                   0.1.8
Babel                     2.11.0
backcall                  0.2.0
bandit                    1.7.4
beautifulsoup4            4.11.1
black                     22.12.0
bleach                    5.0.1
bs4                       0.0.1
captcha-solver            0.1.5
certifi                   2022.12.7
cffi                      1.15.1
charset-normalizer        2.1.1
click                     8.1.3
clr-loader                0.2.5
codespell                 2.2.2
colorama                  0.4.6
comm                      0.1.2
commonmark                0.9.1
cssselect                 1.2.0
dacite                    1.8.0
debugpy                   1.6.5
decorator                 5.1.1
defusedxml                0.7.1
entrypoints               0.4
et-xmlfile                1.1.0
executing                 1.2.0
fake-headers              1.0.2
fake-useragent            1.1.1
fastjsonschema            2.16.2
flake8                    6.0.0
flake8-bugbear            23.1.20
flake8-plugin-utils       1.3.2
flake8-return             1.2.0
fqdn                      1.5.1
frozenlist                1.3.3
future                    0.18.3
gitdb                     4.0.10
GitPython                 3.1.30
h11                       0.14.0
html5lib                  1.1
httpcore                  0.16.3
httpx                     0.23.3
idna                      3.4
indian-names              0.3
ipykernel                 6.20.1
ipython                   8.8.0
ipython-genutils          0.2.0
ipywidgets                8.0.4
isoduration               20.11.0
jedi                      0.18.2
Jinja2                    3.1.2
joblib                    1.2.0
json5                     0.9.11
jsonpointer               2.3
jsonschema                4.17.3
jupyter                   1.0.0
jupyter_client            7.4.9
jupyter-console           6.4.4
jupyter_core              5.1.3
jupyter-events            0.6.3
jupyter_server            2.1.0
jupyter_server_terminals  0.4.4
jupyterlab                3.5.2
jupyterlab-pygments       0.2.2
jupyterlab_server         2.19.0
jupyterlab-widgets        3.0.5
Kekik                     1.1.2
loguru                    0.5.3
lxml                      4.9.2
MarkupSafe                2.1.1
matplotlib-inline         0.1.6
mccabe                    0.7.0
mechanize                 0.4.8
mistune                   2.0.4
multidict                 6.0.4
mypy-extensions           0.4.3
nbclassic                 0.4.8
nbclient                  0.7.2
nbconvert                 7.2.7
nbformat                  5.7.3
nest-asyncio              1.5.6
notebook                  6.5.2
notebook_shim             0.2.2
notify-py                 0.3.39
numpy                     1.24.1
onlinesimru               1.0.19
openpyxl                  3.0.10
outcome                   1.2.0
packaging                 23.0
pandas                    1.5.2
pandocfilters             1.5.0
parsel                    1.7.0
parso                     0.8.3
pathspec                  0.11.0
pbr                       5.11.1
pefile                    2022.5.30
pickleshare               0.7.5
Pillow                    9.4.0
pip                       22.3.1
platformdirs              2.6.2
prometheus-client         0.15.0
prompt-toolkit            3.0.36
psutil                    5.9.4
pure-eval                 0.2.2
pycodestyle               2.10.0
pycparser                 2.21
pyfiglet                  0.8.post1
pyflakes                  3.0.1
Pygments                  2.14.0
pyinstaller               5.7.0
pyinstaller-hooks-contrib 2022.15
pyperclip                 1.8.2
PyQt5                     5.15.7
PyQt5-Qt5                 5.15.2
PyQt5-sip                 12.11.0
PyQt6                     6.4.0
PyQt6-Qt6                 6.4.2
PyQt6-sip                 13.4.0
pyrsistent                0.19.3
PySocks                   1.7.1
python-dateutil           2.8.2
python-docx               0.8.11
python-dotenv             0.21.1
python-json-logger        2.0.4
pythonnet                 3.0.1
pyTrendyol                0.0.3
pytz                      2022.7
pywin32                   305
pywin32-ctypes            0.2.0
pywinpty                  2.0.10
PyYAML                    6.0
pyzmq                     25.0.0
qrcode                    7.3.1
qtconsole                 5.4.0
QtPy                      2.3.0
random-password-generator 2.2.0
requests                  2.28.2
rfc3339-validator         0.1.4
rfc3986                   1.5.0
rfc3986-validator         0.1.1
rich                      13.1.0
scikit-learn              1.2.0
scipy                     1.10.0
selenium                  4.7.2
Send2Trash                1.8.0
setuptools                67.1.0
simplejson                3.18.1
six                       1.16.0
sklearn                   0.0.post1
smmap                     5.0.0
sniffio                   1.3.0
sortedcontainers          2.4.0
soupsieve                 2.3.2.post1
stack-data                0.6.2
stevedore                 4.1.1
tabulate                  0.9.0
terminado                 0.17.1
threadpoolctl             3.1.0
tinycss2                  1.2.1
tomli                     2.0.1
tornado                   6.2
tqdm                      4.64.1
traitlets                 5.8.1
trio                      0.22.0
trio-websocket            0.9.2
undetected-chromedriver   3.2.1
uri-template              1.2.0
urllib3                   1.26.14
w3lib                     2.1.1
wcwidth                   0.2.5
webcolors                 1.12
webdriver-manager         3.8.5
webencodings              0.5.1
websocket-client          1.4.2
websockets                10.4
wheel                     0.38.4
widgetsnbextension        4.0.5
win32-setctime            1.1.0
wsproto                   1.2.0
xlrd                      2.0.1
XlsxWriter                3.0.7
yarl                      1.8.2

When i do pip install setuptools this is the result:

(venv) PS C:\Users\utku-\PycharmProjects\pythonProject5> pip install setuptools
Requirement already satisfied: setuptools in c:\users\utku-\pycharmprojects\pythonproject5\venv\lib\site-packages (67.1.0)

I tried to run on Jupyter. Before i used Pycharm. So still i get error. I think error is different in shape but content is same.
Here the new one:

 error: subprocess-exited-with-error
  
  Building wheel for ta-lib (pyproject.toml) did not run successfully.
  exit code: 1
  
  [20 lines of output]
  <string>:77: UserWarning: Cannot find ta-lib library, installation may fail.
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-311
  creating build\lib.win-amd64-cpython-311\talib
  copying talib\abstract.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\deprecated.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\stream.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\test_abstract.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\test_data.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\test_func.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\test_pandas.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\test_polars.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\test_stream.py -> build\lib.win-amd64-cpython-311\talib
  copying talib\__init__.py -> build\lib.win-amd64-cpython-311\talib
  running build_ext
  building 'talib._ta_lib' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ta-lib
ERROR: Could not build wheels for ta-lib, which is required to install pyproject.toml-based projects

I downloaded visiual c++ +14 by the way but still same.

having same issue here, setuptools is installed but throwing ModuleNotFoundError

also had this issue with python 3.11.2

seems to be fixed in pip 23.0.1