tconkling / streamlit-webcam

MIT License
26 stars 9 forks source link

line 3, in <module> from webcam import webcam #1

Open youjin-c opened 3 years ago

youjin-c commented 3 years ago

Hello,

Thank you for the awesome project.

I am trying to run yours locally and want to check deployment. and find an error that says

StreamlitAPIException: No such component directory: '/Users/EUGENE/Documents/ADAS/streamlit-webcam-master/webcam/frontend/build'

Traceback:
File "/Users/EUGENE/Documents/ADAS/streamlit-webcam-master/example.py", line 3, in <module>
    from webcam import webcam
File "/Users/EUGENE/Documents/ADAS/streamlit-webcam-master/webcam/__init__.py", line 14, in <module>
    _component_func = components.declare_component("webcam", path=build_dir)

I double-checked to install the package by pip install streamlit-webcam-example but it seems not imported.

Could you help me with this issue?

tconkling commented 3 years ago

Hi @youjinChung - if you've downloaded the package locally (as opposed to pip install'ing it), you'll need to build the frontend before running. There's a tutorial here that can help walk you through that: https://docs.streamlit.io/en/stable/streamlit_components.html

If you want to simply pip install the component into your project and use it that way, you should first create a new Python virtual environment, pip install streamlit-webcam-example into that, and do not download this repo into your environment.

youjin-c commented 3 years ago

Hello @tconkling,

Thanks for the response. I installed via pip install streamlit-webcam-example on my virtualenv, but still gives the same error.

ModuleNotFoundError: No module named 'webcam'
Traceback:
File "/opt/anaconda3/lib/python3.7/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)
File "/Users/EUGENE/Documents/ADAS/webapp/webcam-example.py", line 2, in <module>
    from webcam import webcam

and I see the package is installed when I do pip freeze

streamlit-webcam-example==0.1.0
DougTrajano commented 3 years ago

I have the same issue (installed via pip install)

QinHF5 commented 3 years ago

after pip install ,delete the webcam folder,then run example.py with streamlit.

longswordinhand commented 2 years ago

This error happened because the webcam is complied if you download it from github. You can solve it as follow:

  1. pip install
  2. copy the webcam\frontend\build\ to the downloaded folder Good luck.