Error deploying Streamlit app

I am attempting to deploy my Streamlit app and am receiving the following error:

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
╰─> [20 lines of output]
Traceback (most recent call last):
File “”, line 36, in
File “”, line 34, in
File “/var/tmp/pip-install-gidj3yj9/pathlib_e29c12ab423d48a59ddf40b6e74575dc/setup.py”, line 30, in
url=‘https://pathlib.readthedocs.org/’,
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/_distutils/core.py”, line 109, in setup
_setup_distribution = dist = klass(attrs)
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/dist.py”, line 456, in init
for ep in metadata.entry_points(group=‘distutils.setup_keywords’):
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py”, line 999, in entry_points
return SelectableGroups.load(eps).select(**params)
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py”, line 449, in load
ordered = sorted(eps, key=by_group)
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py”, line 997, in
dist.entry_points for dist in unique(distributions())
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py”, line 609, in entry_points
return EntryPoints._from_text_for(self.read_text(‘entry_points.txt’), self)
File “/home/appuser/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py”, line 917, in read_text
return self._path.joinpath(filename).read_text(encoding=‘utf-8’)
AttributeError: ‘PosixPath’ object has no attribute ‘read_text’
[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.

My requirements.txt is:

dlib==19.23.0
imutils==0.5.4
numpy==1.21.2
opencv_python==4.5.5.62
Pillow==9.0.1
streamlit==1.6.0
datetime
pathlib

I can’t find anyone online with the same issue. Any help would be greatly appreciated. Thank you.

Hey @Defqon7

This seems like a conflict with the Pathlib library.
It actually comes pre-installed with Python and when seperately installed, results in this error.
I would suggest you to remove it from the requirements file and try deploying again.

Read this discussion here (python - Weasyprint get undefined property at invoking write_pdf: "AttributeError: 'PosixPath' object has no attribute 'read_text'" - Stack Overflow) to know more.

Best,
Kanak

1 Like

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