ImportError: cannot import name ‘Feature’ from ‘setuptools’
Hi @tony_kungu, welcome to the Streamlit community!!
When I forked and deployed your repo, these are the errors I saw in the console:
Collecting Jinja2==2.6
Downloading Jinja2-2.6.tar.gz (389 kB)
e[35mERRORe[0m: Command errored out with exit status 1:
command: /home/appuser/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s02vpoiv/jinja2_63292e5b7b0547fc92d84ed1276fbbb5/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s02vpoiv/jinja2_63292e5b7b0547fc92d84ed1276fbbb5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hjms9vcc
cwd: /tmp/pip-install-s02vpoiv/jinja2_63292e5b7b0547fc92d84ed1276fbbb5/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-s02vpoiv/jinja2_63292e5b7b0547fc92d84ed1276fbbb5/setup.py", line 40, in <module>
from setuptools import setup, Extension, Feature
ImportError: cannot import name 'Feature' from 'setuptools' (/home/appuser/venv/lib/python3.7/site-packages/setuptools/__init__.py)
----------------------------------------
e[35mWARNINGe[0m: Discarding https://files.pythonhosted.org/packages/25/c8/212b1c2fd6df9eaf536384b6c6619c4e70a3afd2dffdd00e5296ffbae940/Jinja2-2.6.tar.gz#sha256=a85e185375db75c109f99ecde3d55415f035e7068a82252cf4f16c667ac38f49 (from https://pypi.org/simple/jinja2/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
e[36mINFOe[0m: pip is looking at multiple versions of camelot-py to determine which version is compatible with other requirements. This could take a while.
e[35mERRORe[0m: Could not find a version that satisfies the requirement Jinja2==2.6 (from camelot) (from versions: 2.0rc1, 2.0, 2.1, 2.1.1, 2.2, 2.2.1, 2.3, 2.3.1, 2.4, 2.4.1, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.8, 2.8.1, 2.9, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 2.9.5, 2.9.6, 2.10, 2.10.1, 2.10.2, 2.10.3, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 3.0.0a1, 3.0.0rc1, 3.0.0rc2, 3.0.0, 3.0.1)
e[35mERRORe[0m: No matching distribution found for Jinja2==2.6
e[35mWARNINGe[0m: You are using pip version 21.1.1; however, version 21.2.4 is available.
You should consider upgrading via the '/home/appuser/venv/bin/python -m pip install --upgrade pip' command.
e[32m[manager] e[0minstaller returned a non-zero exit code
e[32m[manager] e[0mError during processing dependencies! Please fix the error and push an update, or try restarting the app.
e[32m[manager] e[0minstaller returned a non-zero exit code
It looks like your requirements.txt
file contains few incorrect/misspelled Python dependencies and omits opencv-python-headless
, a required dependency.
If you read the installation instructions for camelot-py, you’ll see that what you need to include in your requirements file in-place of lines 7, 8, 11 is camelot-py[base]
. Replace the contents of your requirements.txt
file with the following to fix your dependency errors:
seaborn==0.11.1
matplotlib==3.3.4
tabula_py==2.3.0
pandas==1.2.3
numpy==1.19.5
streamlit==0.86.0
camelot-py[base]
Pillow==8.3.2
tabula-py
opencv-python-headless
Once you do that, you will likely run into the following error:
2021-09-08 11:27:01.573 Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 350, in _run_script
exec(code, module.__dict__)
File "/app/analytical-tool/main.py", line 9, in <module>
page_1()
File "/app/analytical-tool/page1.py", line 9, in page_1
img=Image.open('/home/kosh/Desktop/g.png')
File "/home/appuser/venv/lib/python3.7/site-packages/PIL/Image.py", line 2968, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/kosh/Desktop/g.png'
To fix this, I would recommend uploading the image files to your repo and replacing the image filepaths in your scripts.
Happy Streamlit’ing!
Snehan
Thanks, it worked perfectly.