Custom component dev server broke on windows
FlyingCarlos opened this issue Β· comments
Describe the bug
I try to build a custom Chatbot and so I follow the instruction on tutorial. After I run gradio cc dev
, some errors occur on terminal, and the frontend server cannot fetch index.js and style.css. I run gradio commands within a conda env on windows.
Have you searched existing issues? π
- I have searched and found no existing issues
Reproduction
(AIenv)PS D:\project> gradio cc create EditableChatbot --template Chatbot
(AIenv)PS D:\project> cd .\editablechatbot\
(AIenv)PS D:\project\editablechatbot> $env:NO_PROXY = '127.0.0.1'
>> $env:GRADIO_ANALYTICS_ENABLED = 'False'
>>
(AIenv)PS D:\project\editablechatbot> gradio cc dev
Screenshot
Logs
(AIenv)PS D:\project\editablechatbot> gradio cc dev
β» Launching demo\app.py in reload mode
Watching: 'D:\project\editablechatbot\demo' 'D:\project\editablechatbot'
'D:\project\editablechatbot\frontend',
No custom components were found in D:\project\editablechatbot. It is likely that dev mode does not work properly. Please pass the --gradio-path
and --python-path CLI arguments so that gradio uses the right executables.
Backend Server: http://127.0.0.1:7861
Failed to resolve dependency: [36msvelte/animate[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte/easing[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte/internal[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte/internal/disclose-version[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte/motion[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte/store[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte/transition[39m, present in 'optimizeDeps.include'
Failed to resolve dependency: [36msvelte[39m, present in 'optimizeDeps.include'
Frontend Server (Go here): http://localhost:7862/
System Info
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.38.1
gradio_client version: 1.1.0
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
altair: 5.2.0
fastapi: 0.108.0
ffmpy: 0.3.1
gradio-client==1.1.0 is not installed.
httpx: 0.27.0
huggingface-hub: 0.23.1
importlib-resources: 6.1.1
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.8.4
numpy: 1.26.4
orjson: 3.9.15
packaging: 23.2
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.4
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.5.2
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.8.0
urllib3: 2.0.7
uvicorn: 0.25.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2023.10.0
httpx: 0.27.0
huggingface-hub: 0.23.1
packaging: 23.2
typing-extensions: 4.8.0
websockets: 11.0.3
Severity
Blocking usage of gradio
Hi @FlyingCarlos ! It's likely that the gradio cc dev command can't find the AiEnv
environment.
No custom components were found in D:\project\editablechatbot. It is likely that dev mode does not work properly. Please pass the --gradio-path
and --python-path CLI arguments so that gradio uses the right executables.
Can you please set the --gradio-path
and --python-path
arguments to the correct location (and verify that your custom component has been installed there beforehand please)
Thanks @freddyaboulton. I tried, and it seems to solve one problem, but then another one arises. The front server still failed to GET something.
the server log:
(AIenv)PS D:\project\editablechatbot> gradio cc dev --gradio-path D:\ProgramData\anaconda3\envs\AIenv\Scripts\gradio.exe --python-path D:\ProgramData\anaconda3\envs\AIenv\python.exe
β» Launching demo\app.py in reload mode
Watching: 'D:\project\editablechatbot\demo' 'D:\project\editablechatbot'
'D:\project\editablechatbot\frontend',
Backend Server: http://127.0.0.1:7861
Frontend Server (Go here): http://localhost:7862/
X [ERROR] Could not resolve "virtual:component-loader"
frontend/node_modules/@gradio/utils/src/utils.ts:237:10:
237 β import("virtual:component-loader").then((module) => {
β΅ ~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "virtual:component-loader" as external to exclude it from the bundle, which will remove this error and leave the
unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.
[2m20:05:26[22m [31m[1m[22m[39m [31merror while updating dependencies:
Error: Build failed with 1 error:
frontend/node_modules/@gradio/utils/src/utils.ts:237:10: ERROR: Could not resolve "virtual:component-loader"
at failureErrorWithLog (D:\project\editablechatbot\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15)
at D:\project\editablechatbot\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:945:25
at D:\project\editablechatbot\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:1353:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
Hmm that should have been fixed. Can you please check what version of @gradio/preview
got installed? (in frontend/package.json
) It should be 0.10.1
Yes, it is "@gradio/preview": "0.10.1",
{
"name": "gradio_editablechatbot",
"version": "0.12.1",
"description": "Gradio UI packages",
"type": "module",
"author": "",
"license": "ISC",
"private": false,
"dependencies": {
"@gradio/atoms": "0.7.6",
"@gradio/client": "1.3.0",
"@gradio/gallery": "0.11.2",
"@gradio/icons": "0.6.0",
"@gradio/markdown": "0.8.1",
"@gradio/plot": "0.6.0",
"@gradio/statustracker": "0.7.1",
"@gradio/theme": "0.2.3",
"@gradio/upload": "0.11.5",
"@gradio/utils": "0.5.1",
"@gradio/wasm": "0.11.0",
"@types/dompurify": "^3.0.2",
"@types/katex": "^0.16.0",
"@types/prismjs": "1.26.4",
"dequal": "^2.0.2"
},
"devDependencies": {
"@gradio/audio": "0.12.2",
"@gradio/image": "0.12.2",
"@gradio/preview": "0.10.1",
"@gradio/video": "0.9.2"
},
"main_changeset": true,
"main": "./Index.svelte",
"exports": {
".": "./Index.svelte",
"./package.json": "./package.json"
}
}
Ok thanks @FlyingCarlos - cc @pngwn in case you have ideas
@FlyingCarlos - can you use WSL in the meantime? It should work there
@freddyaboulton I appreciate your assistance. I attempted to develop on an Ubuntu 22 virtual machine, but the issue persists.
(AIenv) carlosz@carlosz-VirtualBox:~/project/editablechatbot$ gradio cc dev --python-path /home/carlosz/miniconda3/envs/AIenv/bin/python --gradio-path /home/carlosz/miniconda3/envs/AIenv/bin/gradio
β» Launching demo/app.py in reload mode
Watching: '/home/carlosz/project/editablechatbot/demo'
'/home/carlosz/project/editablechatbot/frontend',
'/home/carlosz/project/editablechatbot'
Backend Server: http://127.0.0.1:7860
Frontend Server (Go here): http://localhost:7861/
β [ERROR] Could not resolve "virtual:component-loader"
frontend/node_modules/@gradio/utils/src/utils.ts:237:10:
237 β import("virtual:component-loader").then((module) => {
β΅ ~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "virtual:component-loader" as external to exclude it from the bundle,
which will remove this error and leave the unresolved path in the bundle. You can also add
".catch()" here to handle this failure at run-time instead of bundle-time.
2:37:34 PM error while updating dependencies:
Error: Build failed with 1 error:
frontend/node_modules/@gradio/utils/src/utils.ts:237:10: ERROR: Could not resolve
"virtual:component-loader"
at failureErrorWithLog
(/home/carlosz/project/editablechatbot/frontend/node_modules/vite/node_modules/esbuild/lib/main
.js:1472:15)
at
/home/carlosz/project/editablechatbot/frontend/node_modules/vite/node_modules/esbuild/lib/main.
js:945:25
at
/home/carlosz/project/editablechatbot/frontend/node_modules/vite/node_modules/esbuild/lib/main.
js:1353:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Yeah. This isn't a windows issue, I think I missed something when fixed a recent bug. Will look soon.