How to Solve the problem "setuptools is not available"

In locale I’m using windows 11, vscode with python 3.10.9. This is the error:

Collecting importlib==1.0.4

  Downloading importlib-1.0.4.zip (7.1 kB)

  Preparing metadata (setup.py): started

  Preparing metadata (setup.py): finished with status 'error'

  error: subprocess-exited-with-error

  

  × python setup.py egg_info did not run successfully.

  │ exit code: 1

  ╰─> [1 lines of output]

      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.

      [end of output]

  

  note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

× Encountered error while generating package metadata.

╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

hint: See above for details.

WARNING: You are using pip version 22.0.3; however, version 23.2.1 is available.

You should consider upgrading via the '/home/adminuser/venv/bin/python -m pip install --upgrade pip' command.

Checking if Streamlit is installed

────────────────────────────────────────────────────────────────────────────────────────

[12:52:00] ❗️ installer returned a non-zero exit code

[12:52:00] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.

This is the

requirements.txt

pip==23.2.1
setuptools
aiohttp==3.8.5
aiosignal==1.3.1
altair==5.0.1
async-timeout==4.0.3
attrs==23.1.0
beautifulsoup4==4.12.2
blinker==1.6.2
cachetools==5.3.1
certifi==2023.7.22
charset-normalizer==3.2.0
click==8.1.6
colorama==0.4.6
frozenlist==1.4.0
gitdb==4.0.10
GitPython==3.1.32
idna==3.4
importlib==1.0.4
importlib-metadata==6.8.0
Jinja2==3.1.2
joblib==1.3.2
jsonschema==4.19.0
jsonschema-specifications==2023.7.1
markdown-it-py==3.0.0
MarkupSafe==2.1.3
mdurl==0.1.2
multidict==6.0.4
numpy==1.25.2
packaging==23.1
pandas==2.0.3
Pillow==9.5.0
protobuf==4.24.0
psutil==5.9.5
pyarrow==12.0.1
pyasn1==0.5.0
pydeck==0.8.0
Pygments==2.16.1
Pympler==1.0.1
python-dateutil==2.8.2
pytz==2023.3
pytz-deprecation-shim==0.1.0.post0
referencing==0.30.2
requests==2.31.0
rich==13.5.2
rpds-py==0.9.2
rsa==4.9
scikit-learn==1.3.0
scipy==1.11.2
six==1.16.0
smmap==5.0.0
soupsieve==2.4.1
stlib==2.0.1
streamlit==1.25.0
tenacity==8.2.3
threadpoolctl==3.2.0
toml==0.10.2
toolz==0.12.0
tornado==6.3.3
typing_extensions==4.7.1
tzdata==2023.3
tzlocal==4.3.1
urllib3==2.0.4
validators==0.21.2
vegafusion==1.3.0
vegafusion-python-embed==1.3.0
vl-convert-python==0.12.0
watchdog==3.0.0
xgboost==1.7.6
yarl==1.9.2
zipp==3.16.2

i tried without the setuptools entry in requirements.txt, and with the entry, and updating pip. but always the same error.

Hey @DioBrando,

Can you share a link to your GitHub repo so we can fork it and try to reproduce the error?

Ty. This is the link .

I was able to get it working by changing your requirements file to the following:

streamlit
stlib
Pillow
pandas
numpy
altair
xgboost
vegafusion
scikit-learn

It looks like that setuptools error is related to importlib:

In Python 3 importlib became a package from the standard library: importlib — The implementation of import — Python 3.12.0 documentation . You don’t need to install it separately; once you’ve installed Python3 and the standard library the package is available for import.

1 Like

Ty for Senza_titolo-removebg-preview answer.

the file requirements.txt also requires scikit-learn as a package.

Whoops, missed that one. I’ll add it above

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.