Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'streamlit.components'; 'streamlit' is not a package #413

Open
GH-4684 opened this issue Jan 17, 2025 · 0 comments

Comments

@GH-4684
Copy link

GH-4684 commented Jan 17, 2025

Question

python -m pix2tex.api.run encountered an import error due to a naming conflict between pix2tex/api/streamlit.py and streamlit package.

Traceback (most recent call last):
  File "D:\Software\Miniconda3\envs\cam\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Software\Miniconda3\envs\cam\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Software\Miniconda3\envs\cam\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "D:\Software\Miniconda3_envs\cam\Lib\site-packages\pix2tex\api\streamlit.py", line 4, in <module>
    from st_img_pastebutton import paste
  File "D:\Software\Miniconda3\envs\cam\lib\site-packages\st_img_pastebutton\__init__.py", line 2, in <module>
    import streamlit.components.v1 as components
ModuleNotFoundError: No module named 'streamlit.components'; 'streamlit' is not a package

Solution

  • Rename pix2tex/api/streamlit.py to streamlit_.py
  • Modify pix2tex/api/run.py:11: subprocess.call(['streamlit', 'run', 'streamlit_.py'], cwd=path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant