You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Different import name and package name breaks a new app #133
I'm trying to generate a new streamlit app with this template, to include my own custom components, and I've found that when the package_name is different than the import_name on the CLI, when running the app it shows the error:
streamlit.errors.StreamlitAPIException: Component 'streamlit-template.custom_components' must be declared in pyproject.toml with asset_dir to use file-backed js.
Here are the steps I've executed on the CLI:
[1/8] author_name (John Smith):
[2/8] author_email (john@example.com):
[3/8] project_name (Streamlit Component X): my streamlit app
[4/8] package_name (my-streamlit-app):
[5/8] import_name (my_streamlit_app): custom_components
[6/8] description (Streamlit component that allows you to do X):
[7/8] Select open_source_license
1 - MIT
2 - BSD-3-Clause
3 - ISC
4 - Apache-2.0
5 - GPL-3.0-or-later
6 - LicenseRef-Proprietary
Choose from [1/2/3/4/5/6] (1):
[8/8] Select framework
1 - React + Typescript
2 - Pure Typescript
Choose from [1/2] (1):
And after having the folders ready I did:
cd my-streamlit-app
uv venv
source .venv/bin/activate
cd ./custom_components/frontend/ && npm i && npm run build
cd ../..
uv pip install -e .
python3 -m streamlit run ./example.py
And faced the error.
I think this has to do with some missing configuration on the template.
Any help to fix the error will be appretiated!
Can you scaffold this again but ensure that the import name matches the package name? So in this case, it should be my-streamlit-app/my_streamlit_app, rather than my-streamlit-app/custom_components. That should work, let me know, thanks!
I did that before and it worked. I'm interested in using this with a different folder name, and I'm not a frequent python user so maybe it's something I'm not familiar with.
Is there a reason why the options in the scaffolding can't be changed? I mean I can only specify a project name and leave the rest as is.
I also experience this issue, and I agree with @vijote, the fact that we need to keep the naming consistent across project_name, package_name and import_name makes the questions useless and prone to errors.
Is this behavior intended ? If not do you have an idea of the origin of it ?
Activity
[-]Using different import name than package[/-][+]Different import name and package name breaks a new app[/+]sfc-gh-bnisco commentedon Dec 19, 2025
Thanks @vijote for the message!
Can you scaffold this again but ensure that the import name matches the package name? So in this case, it should be
my-streamlit-app/my_streamlit_app, rather thanmy-streamlit-app/custom_components. That should work, let me know, thanks!vijote commentedon Dec 19, 2025
Hi @sfc-gh-bnisco , thanks for the response.
I did that before and it worked. I'm interested in using this with a different folder name, and I'm not a frequent python user so maybe it's something I'm not familiar with.
Is there a reason why the options in the scaffolding can't be changed? I mean I can only specify a project name and leave the rest as is.
mp-mech commentedon Apr 2, 2026
I also experience this issue, and I agree with @vijote, the fact that we need to keep the naming consistent across project_name, package_name and import_name makes the questions useless and prone to errors.
Is this behavior intended ? If not do you have an idea of the origin of it ?