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

Error when following contribution guide #1542

Open
PyroGenesis opened this issue Nov 25, 2024 · 9 comments
Open

Error when following contribution guide #1542

PyroGenesis opened this issue Nov 25, 2024 · 9 comments
Labels
backend Pertains to the Python backend. bug Something isn't working needs-triage

Comments

@PyroGenesis
Copy link

Describe the bug
I am trying to build chainlit on my local Windows system. However, I'm running into an error on the step Start the Chainlit server from source

Traceback (most recent call last):
  File "C:\Projects\chainlit\backend\.venv\Scripts\chainlit", line 6, in <module>
    sys.exit(cli())
  File "C:\Projects\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "C:\Projects\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "C:\Projects\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Projects\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Projects\chainlit\backend\.venv\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Projects\chainlit\backend\chainlit\cli\__init__.py", line 201, in chainlit_run
    run_chainlit(target)
  File "C:\Projects\chainlit\backend\chainlit\cli\__init__.py", line 39, in run_chainlit
    from chainlit.server import app
  File "C:\Projects\chainlit\backend\chainlit\server.py", line 184, in <module>
    build_dir = get_build_dir("frontend", "frontend")
  File "C:\Projects\chainlit\backend\chainlit\server.py", line 181, in get_build_dir
    raise FileNotFoundError(f"{local_target} built UI dir not found")
FileNotFoundError: frontend built UI dir not found

To Reproduce
Follow the steps listed in CONTRIBUTING.md

Expected behavior
Expected to successfully run the backend

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 1.3.1
@dosubot dosubot bot added backend Pertains to the Python backend. bug Something isn't working labels Nov 25, 2024
@dokterbob
Copy link
Collaborator

Thanks for reporting this! Always important to make sure dev's don't run into trouble!

I'll have to test this myself. Until then, perhaps #1500 is related?

@dosu Any idea what's going on?

Copy link

dosubot bot commented Dec 3, 2024

The error you're encountering, FileNotFoundError: frontend built UI dir not found, indicates that the frontend build directory is missing. Here are the steps to resolve this issue:

  1. Check the Build Directory: Ensure that the "dist" directory exists in the expected location. The code looks for this directory at os.path.join(PACKAGE_ROOT, "frontend", "dist") and os.path.join(BACKEND_ROOT, "frontend", "dist").

  2. Build the Frontend: If the directory does not exist, you need to build the frontend. Navigate to the frontend directory and run the following commands:

    pnpm install
    pnpm run dev --port 5174

    This will install the necessary dependencies and start the development server for the frontend. Make sure you have pnpm installed and configured correctly on your Windows system. You might need to set the script shell to bash using:

    pnpm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
  3. Verify Custom Build Path: If you have a custom build path specified in your configuration (config.ui.custom_build), ensure that the path is correct and the build output is present there.

Following these steps should help you resolve the error and successfully run the Chainlit server from source [1][2].

To continue talking to Dosu, mention @dosu.

@dokterbob
Copy link
Collaborator

The frontend should be built when you do poetry install.

Could you share the full terminal output when this error occurs?

@PyroGenesis
Copy link
Author

I upgraded my fork to v1.3.2 and tried the steps again.

Installing dependencies: poetry install --with tests --with mypy --with dev

PS C:\Projects - Misc\chainlit\backend> poetry install --with tests --with mypy --with dev
Creating virtualenv chainlit in C:\Projects - Misc\chainlit\backend\.venv
Installing dependencies from lock file

Package operations: 186 installs, 1 update, 0 removals

  - Installing typing-extensions (4.12.2)
  - Installing certifi (2024.8.30)
  - Installing charset-normalizer (3.3.2)
  - Installing colorama (0.4.6)
  - Installing exceptiongroup (1.2.2)
  - Installing frozenlist (1.4.1)
  - Installing h11 (0.14.0)
  - Installing idna (3.10)
  - Installing multidict (6.1.0)
  - Installing mypy-extensions (1.0.0)
  - Installing packaging (23.2)
  - Installing six (1.16.0)
  - Installing sniffio (1.3.1)
  - Installing urllib3 (2.2.3)
  - Installing aiohappyeyeballs (2.4.0)
  - Installing aiosignal (1.3.1)
  - Installing anyio (4.4.0)
  - Installing async-timeout (4.0.3)
  - Installing attrs (24.2.0)
  - Installing click (8.1.7)
  - Installing greenlet (3.1.0)
  - Installing httpcore (1.0.5)
  - Installing joblib (1.4.2)
  - Installing marshmallow (3.22.0)
  - Installing numpy (1.26.4)
  - Installing pycparser (2.22)
  - Installing python-dateutil (2.9.0.post0)
  - Installing pytz (2024.2)
  - Installing regex (2024.9.11)
  - Installing requests (2.32.3)
  - Installing tqdm (4.66.5)
  - Installing typing-inspect (0.9.0)
  - Installing tzdata (2024.1)
  - Installing wrapt (1.16.0)
  - Installing yarl (1.11.1)
  - Installing zipp (3.20.2)
  - Installing aiohttp (3.10.5)
  - Installing cffi (1.17.1)
  - Installing dataclasses-json (0.6.7)
  - Installing deprecated (1.2.14)
  - Installing dirtyjson (1.0.8)
  - Installing distro (1.9.0)
  - Installing fsspec (2024.9.0)
  - Installing httpx (0.27.2)
  - Installing importlib-metadata (8.4.0)
  - Installing jiter (0.5.0)
  - Installing nest-asyncio (1.6.0)
  - Installing networkx (3.2.1)
  - Installing nltk (3.9.1)
  - Installing oauthlib (3.2.2)
  - Installing pandas (2.2.2)
  - Installing pillow (10.4.0)
  - Installing pydantic (1.10.18)
  - Installing pyyaml (6.0.2)
  - Installing tenacity (8.5.0)
  - Installing tiktoken (0.7.0)
  - Installing sqlalchemy (2.0.35)
  - Installing azure-core (1.31.0)
  - Installing cryptography (43.0.1)
  - Installing isodate (0.6.1)
  - Installing llama-index-core (0.10.68.post1)
  - Installing openai (1.46.0)
  - Installing opentelemetry-api (1.27.0)
  - Installing protobuf (4.25.4)
  - Installing requests-oauthlib (2.0.0)
  - Installing filelock (3.16.0)
  - Installing jsonpointer (3.0.0)
  - Installing llama-index-llms-openai (0.1.31)
  - Installing msrest (0.7.1)
  - Installing opentelemetry-proto (1.27.0)
  - Installing opentelemetry-semantic-conventions (0.48b0)
  - Installing orjson (3.10.7)
  - Installing pyjwt (2.9.0)
  - Installing rpds-py (0.20.0)
  - Installing botbuilder-schema (4.16.2)
  - Installing docopt (0.6.2)
  - Installing googleapis-common-protos (1.65.0)
  - Installing grpcio (1.66.1)
  - Installing huggingface-hub (0.25.0)
  - Installing jsonpatch (1.33)
  - Installing langsmith (0.1.121)
  - Installing llama-index-agent-openai (0.2.9)
  - Installing more-itertools (10.5.0)
  - Installing msal (1.31.0)
  - Installing opentelemetry-exporter-otlp-proto-common (1.27.0)
  - Installing opentelemetry-sdk (1.27.0)
  - Installing referencing (0.35.1)
  - Installing soupsieve (2.6)
  - Installing typeguard (4.3.0)
  - Installing wsproto (1.2.0)
  - Installing appdirs (1.4.4)
  - Installing backoff (2.2.1)
  - Installing beautifulsoup4 (4.12.3)
  - Installing botframework-connector (4.16.2)
  - Installing cattrs (24.1.1)
  - Installing inflect (7.4.0)
  - Installing iniconfig (2.0.0)
  - Installing jsonschema-specifications (2023.12.1)
  - Installing langchain-core (0.2.41)
  - Installing llama-cloud (0.0.17)
  - Installing llama-index-embeddings-openai (0.1.11)
  - Installing llama-index-program-openai (0.1.7)
  - Installing llama-parse (0.4.9)
  - Installing monotonic (1.6)
  - Installing num2words (0.5.13)
  - Installing opentelemetry-exporter-otlp-proto-grpc (1.27.0)
  - Installing opentelemetry-exporter-otlp-proto-http (1.27.0)
  - Installing pluggy (1.5.0)
  - Installing pypdf (4.3.1)
  - Installing safetensors (0.4.5)
  - Installing scipy (1.13.1)
  - Downgrading setuptools (75.2.0 -> 75.1.0)
  - Installing simple-websocket (1.0.0)
  - Installing striprtf (0.0.26)
  - Installing threadpoolctl (3.5.0)
  - Installing tokenizers (0.15.2)
  - Installing tomli (2.0.1)
  - Installing url-normalize (1.4.3)
  - Installing bidict (0.23.1)
  - Installing boilerpy3 (1.0.7)
  - Installing botframework-streaming (4.16.2): Installing...
  - Installing chevron (0.14.0)
  - Installing chevron (0.14.0)
  - Installing botframework-streaming (4.16.2)
  - Installing chevron (0.14.0)
  - Installing contourpy (1.3.0)
  - Installing coverage (7.6.1): Installing...
  - Installing cycler (0.12.1)
  - Installing discord-py (2.4.0): Installing...
  - Installing events (0.5)
  - Installing cycler (0.12.1)
  - Installing discord-py (2.4.0): Installing...
  - Installing events (0.5)
  - Installing coverage (7.6.1)
  - Installing cycler (0.12.1)
  - Installing discord-py (2.4.0): Installing...
  - Installing events (0.5)
  - Installing fonttools (4.53.1): Installing...
  - Installing events (0.5)
  - Installing fonttools (4.53.1): Installing...
  - Installing discord-py (2.4.0)
  - Installing events (0.5)
  - Installing fonttools (4.53.1): Installing...
  - Installing fonttools (4.53.1)
  - Installing jsonpickle (1.4.2)
  - Installing jsonschema (4.23.0)
  - Installing kiwisolver (1.4.7)
  - Installing langchain-text-splitters (0.2.4)
  - Installing lazy-imports (0.3.1)
  - Installing llama-index-cli (0.1.13)
  - Installing llama-index-indices-managed-llama-cloud (0.2.7)
  - Installing llama-index-legacy (0.9.48.post3)
  - Installing llama-index-multi-modal-llms-openai (0.1.9)
  - Installing llama-index-question-gen-openai (0.1.3)
  - Installing llama-index-readers-file (0.1.33)
  - Installing llama-index-readers-llama-parse (0.1.6)
  - Installing opentelemetry-exporter-otlp (1.27.0)
  - Installing opentelemetry-instrumentation (0.48b0)
  - Installing pathspec (0.12.1)
  - Installing platformdirs (4.3.4)
  - Installing posthog (3.6.6)
  - Installing prompthub-py (4.0.0)
  - Installing pyparsing (3.1.4)
  - Installing pytest (8.3.3)
  - Installing python-engineio (4.9.1)
  - Installing quantulum3 (0.9.2)
  - Installing rank-bm25 (0.2.2)
  - Installing requests-cache (0.9.8)
  - Installing scikit-learn (1.5.2)
  - Installing slack-sdk (3.33.0)
  - Installing sseclient-py (1.8.0)
  - Installing starlette (0.41.2)
  - Installing transformers (4.39.3)
  - Installing aiofiles (23.2.1): Installing...
  - Installing aiofiles (23.2.1)
  - Installing aiosqlite (0.20.0)
  - Installing asyncer (0.0.7)
  - Installing black (24.8.0)
  - Installing botbuilder-core (4.16.2)
  - Installing discord (2.3.2)
  - Installing farm-haystack (1.26.3)
  - Installing fastapi (0.115.4)
  - Installing filetype (1.2.0)
  - Installing isort (5.13.2)
  - Installing langchain (0.2.16)
  - Installing lazify (0.4.0)
  - Installing literalai (0.0.623)
  - Installing llama-index (0.10.68)
  - Installing matplotlib (3.9.2)
  - Installing mypy (1.11.2)
  - Installing mypy-boto3-dynamodb (1.35.15)
  - Installing plotly (5.24.1)
  - Installing pytest-asyncio (0.23.8)
  - Installing pytest-cov (5.0.0)
  - Installing python-dotenv (1.0.1)
  - Installing python-multipart (0.0.9)
  - Installing python-socketio (5.11.4)
  - Installing slack-bolt (1.20.1)
  - Installing syncer (2.0.3)
  - Installing types-aiofiles (23.2.0.20240623)
  - Installing types-requests (2.32.0.20240914)
  - Installing uptrace (1.26.0)
  - Installing uvicorn (0.25.0)
  - Installing watchfiles (0.20.0)

Installing the current project: chainlit (1.3.2)

Running hello.py: chainlit run .\chainlit\hello.py

(chainlit-py3.10) PS C:\Projects - Misc\chainlit\backend> chainlit run .\chainlit\hello.py
Traceback (most recent call last):
  File "C:\Projects - Misc\chainlit\backend\.venv\Scripts\chainlit", line 6, in <module>
    sys.exit(cli())
  File "C:\Projects - Misc\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "C:\Projects - Misc\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "C:\Projects - Misc\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Projects - Misc\chainlit\backend\.venv\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Projects - Misc\chainlit\backend\.venv\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Projects - Misc\chainlit\backend\chainlit\cli\__init__.py", line 201, in chainlit_run
    run_chainlit(target)
  File "C:\Projects - Misc\chainlit\backend\chainlit\cli\__init__.py", line 39, in run_chainlit
    from chainlit.server import app
  File "C:\Projects - Misc\chainlit\backend\chainlit\server.py", line 184, in <module>
    build_dir = get_build_dir("frontend", "frontend")
  File "C:\Projects - Misc\chainlit\backend\chainlit\server.py", line 181, in get_build_dir
    raise FileNotFoundError(f"{local_target} built UI dir not found")
FileNotFoundError: frontend built UI dir not found

I'm not so sure frontend is built on poetry install.

@dokterbob
Copy link
Collaborator

That's very strange. This is what it's supposed to look like, on Windows ('Install Python, poetry and Python dependencies'): https://github.com/Chainlit/chainlit/actions/runs/12168265972/job/33938703121

What version of poetry, python etc are you rocking? When you used the same versions as we do in our CI, does it resolve the problem?

@SigveSjovold
Copy link
Contributor

I have the same issue, any update on this?

@C-Chafik
Copy link

Same issue here, building the frontend project does not fix it, i have to manually recreate the frontend/dict directory.

@SigveSjovold
Copy link
Contributor

SigveSjovold commented Jan 10, 2025

Same issue here, building the frontend project does not fix it, i have to manually recreate the frontend/dict directory.

Were you able to get it to work then? If so, how did you recreate the frontend/dict dir?

@C-Chafik
Copy link

Same issue here, building the frontend project does not fix it, i have to manually recreate the frontend/dict directory.

Were you able to get it to work then? If so, how did you recreate the frontend/dict dir?

Have you tried to launch pnpm buildUi after pnpm install at the root of the project ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Pertains to the Python backend. bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

4 participants