Skip to content

Issue with width='stretch' in data preview module #11

@thompsonmj

Description

@thompsonmj

When previewing data in a Precalculated Embeddings view,

TypeError: '<=' not supported between instances of 'str' and 'int'

File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/.venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 128, in exec_func_with_error_handling
    result = func()
             ^^^^^^
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/.venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 667, in code_to_exec
    _mpa_v1(self._main_script_path)
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/.venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 165, in _mpa_v1
    page.run()
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/.venv/lib/python3.12/site-packages/streamlit/navigation/page.py", line 300, in run
    exec(code, module.__dict__)  # noqa: S102
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/pages/02_Precalculated_Embeddings.py", line 66, in <module>
    main()
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/pages/02_Precalculated_Embeddings.py", line 58, in main
    render_data_preview()
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/components/precalculated/data_preview.py", line 95, in render_data_preview
    st.image(image, caption=f"Image from: {identifier_url}", width='stretch')
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/.venv/lib/python3.12/site-packages/streamlit/runtime/metrics_util.py", line 443, in wrapped_func
    result = non_optional_func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/fs/ess/PAS2136/thompsonmj/projects/emb-explorer/.venv/lib/python3.12/site-packages/streamlit/elements/image.py", line 154, in image
    WidthBehavior.ORIGINAL if (width is None or width <= 0) else width
                                                ^^^^^^^^^^

In the environment, running uv pip install --upgrade streamlit and uv pip install "numpy<=2.2.0" to avoid ImportError: Numba needs NumPy 2.2 or less. Got NumPy 2.3. fixes the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions