Spaces:
Running
[FEEDBACK] Spaces Dev Mode
This discussion is dedicated to feedback about Spaces' Dev Mode feature.
Your feedback is really valuable so don't hesitate to share anything about it ๐ค.
a great feature โจ
I have a PRO account, and can't connect via VSCode Local or Remote for this simple gradio space.
On the web, it's stuck in endless loading.
On local, I get a timeout error. I've verified that my ssh setup is correct by following the steps here
The feature is excellent, but when I activate dev mode, it functions correctly on my end, but it consistently displays "preparing spaces" on the public page.
Thanks for reporting @KingNish - we'll work on a fix for this soon
I have a PRO account, and can't connect via VSCode Local or Remote
Thanks for reporting @arsalagrey , unfortunately I cannot reproduce this behavior. Can you try again to confirm it still does not work for you?
It would be helpful if you could share more information about this issue, for example:
- Can you SSH into the Space (using SSH, not VSCode) ?
- Is there any error when you try to SSH into the Space?
- Is there any error when you try to connect to the Space with your local VS Code?
When using VS Code local, make sure you have the Remote - SSH VS Code extension installed.
@sbrandeis Yes, it's working fine. Thank you!
Disregard.
This is a great feature, but the modal blocks the Space's UI. Can you add a feature to minimize it?
This is a great feature, but the modal blocks the Space's UI. Can you add a feature to minimize it?
You can minimize it by clicking arrow above dev mode block.
Yes it should :D
great feature
I have a PRO account, and can't connect via VSCode Local or Remote for this simple gradio space.
On the web, it's stuck in endless loading.
On local, I get a timeout error. I've verified that my ssh setup is correct by following the steps here
I'm getting related errors and cannot seem to get the local VSCode Connection to work.
Keep getting messages like:
"@ssh.hf.space: Permission denied (publickey).
local-server-1> ssh child died, shutting down
[21:57:53.411] Resolver error: Error: Permission denied (publickey)."
@NicDev make sure your ssh key is stored in your hf account
Yeah it is, i also follwed the ssh setup steps mentioned here
Edit: Maybe I should add to this, I found only some threads that were related to this issue.
https://github.com/microsoft/vscode-remote-release/issues/6521 --> Suggests to set "remote.SSH.useLocalServer": false; on my end, this makes the SSH connection request run veery long/endlessly, never finishes.
https://stackoverflow.com/questions/60675232/ssh-in-vscode-error-permission-denied-publickey-password --> is related to the config file, didn't help
Maybe also worth mentioning: It fails precisely after prompting me to insert the passphrase 3 times.
Hi,I have had a problem recently that turned out to be Dev Mode-related:Upon factory rebuild of my spaces, nothing installed from requirements.txt or packages.txt.Just turning dev mode off solved it, and everything installed as it should upon rebuild. Also worked turning on dev mode again after that.
Hopefully it gets fixed, but if you have the same problem just turn off Dev Mode if you are rebuilding pushing changes to requirements.txt/packages.txt!
Oh never mind just found this on the dev-mode-explorers page:
If you're using the Streamlit or Gradio SDK, or if your application is Pyhton-based, note that requirements are not installed automatically. You will need to manually run
pip install
from VS Code or SSH.
So I guess it's expected, but not well documented I have to say! Works great anyway so thanks!
Hi everyone,
i wanted to try the dev mode, ultimately with the intention to streamline my dev flow using pycharm.
I set up the ssh key and can connect using the console.
It seems the ssh connection is working in pycharm (didnt get it to connect using termius, despite the log showing successfull authentication)
It seems the SFTP connection is failing.
To double check: Is the intention that file down- and upload is possible via SFTP to the space?
One thing I noticed is, that the "Git status" widget is not finishing:
Appreciate any input.
Thanks
It seems the SFTP connection is failing.
Hi
@tengel
, to upload files to your space we advise using rsync
rather than SFTP. The SFTP protocol is not supported on our side.
didnt get it to connect using termius
Could you get some logs from the ssh connection from termius?
Appreciate your input @mcpotato , thanks.
@SFTP: thats a pity, pycharm would support it out of the box. I tried with the rsync option within pycharm, but it seems it still tries to use SFTP for authentication and rsync then for the data transfer. From the command line trying rsync fails as the remote side does not have to seem rsync available (logged in via ssh, tried to find it)
Any thoughts about adding SFTP support in the future?
@Termius log:
๐ค Starting a new connection to: "ssh.hf.space" port "22"
โ๏ธ Starting address resolution of "ssh.hf.space"
โ๏ธ Address resolution finished
โ๏ธ Connecting to "18.205.32.140" port "22"
๐ค Connection to "ssh.hf.space" established
โ๏ธ Starting SSH session
โ๏ธ Remote server: SSH-2.0-russh_0.43.0
โ๏ธ Agreed KEX algorithm: curve25519-sha256
โ๏ธ Agreed Host Key algorithm: ssh-ed25519
โ๏ธ Agreed server-to-client cipher: [email protected] MAC: INTEGRATED-AES-GCM
โ๏ธ Agreed client-to-server cipher: [email protected] MAC: INTEGRATED-AES-GCM
โ๏ธ Agreed client-to-server compression: none
โ๏ธ Agreed server-to-client compression: none
โ๏ธ Handshake finished
๐ค Checking host key: 9a:11:8b:d7:f7:58:56:93:a4:d1:c3:c2:b0:81:86:aa
๐ค Host "ssh.hf.space":"22" is known and matches
๐ค Authenticating to "ssh.hf.space":"22" as "tengel-devmodetest"
โ๏ธ Available client authentication methods: publickey,password,keyboard-interactive
โ๏ธ Authentication that can continue: publickey
๐ค Authenticating using publickey method
๐ค Authentication succeeded (publickey)
๐ค Authenticated to "ssh.hf.space":"22"
Surprisingly, the log does not even show the failed connection, only the GUI.
rsync fails as the remote side does not have to seem rsync available
Are you using a custom Dockerfile for your space? You must install rsync
yourself if so. Otherwise, rsync
should be installed by default in your space.
Any thoughts about adding SFTP support in the future?
It's complicated and would require some work to do so. If we have sufficient demand from the community we can think about it, otherwise no.
Hi everyone,
I've started a space using the docker template "jupyter-lab" and enabled dev mode. I'm using a local VS code.
When running my script on gpu, I can't find the PID with nvidia-smi
.
This is perhaps related to this issue: --pid=host
should be specified when running the docker container.
Any idea on how to solve this ?
I managed to get to a "Initializing VS Code Server" popup, but now it seems to hang. How long did the initialization take for others?
That is the last output I have in my terminal:
Console Output
"[13:03:36.654] > 0c04245dcbc7: running
> Found existing installation at /home/user/.vscode-server...
> Starting VS Code CLI... "/home/user/.vscode-server/code-611f9bfce64f25108829dd29
> 5f54a6894e87339d" command-shell --cli-data-dir "/home/user/.vscode-server/cli" -
> -on-port --on-host=127.0.0.1 --parent-process-id 10373 &> "/home/user/.vscode-se
> rver/.cli.611f9bfce64f25108829dd295f54a6894e87339d.log" < /dev/null
> printenv:
> NVIDIA_VISIBLE_DEVICES=all
> KUBERNETES_SERVICE_PORT_HTTPS=443
> KUBERNETES_SERVICE_PORT=443
> PERSISTANT_STORAGE_ENABLED=false
> PYTHONUNBUFFERED=1
> PYTORCH_NVML_BASED_CUDA_CHECK=1
> GRADIO_THEME=huggingface
> HOSTNAME=r-razzfazz-io-vs-code-connection-test-bafy8t0k-a9bed-8gcjd
> SPACE_HOST=razzfazz-io-vs-code-connection-test.hf.space
> TQDM_POSITION=-1
> PWD=/home/user/app
> SPACES_ZERO_GPU=1
> SPACES_ZERO_DEVICE_API_URL=http://device-api.zero
> NVIDIA_DRIVER_CAPABILITIES=compute,utility
> TZ=Europe/Paris
> HOME=/home/user
> KUBERNETES_PORT_443_TCP=tcp://172.20.0.1:443
> SPACE_SUBDOMAIN=razzfazz-io-vs-code-connection-test
> GRADIO_SERVER_NAME=0.0.0.0
> VSCODE_AGENT_FOLDER=/home/user/.vscode-server
> HF_DATASETS_TRUST_REMOTE_CODE=0
> HF_HUB_ENABLE_HF_TRANSFER=1
> GRADIO_CACHE_EXAMPLES=lazy
> PYTHONPATH=/home/user/app
> TQDM_MININTERVAL=1
> GRADIO_NUM_PORTS=1
> SPACE_ID=razzfazz-io/vs-code-connection-test
> CPU_CORES=64
> SPACE_AUTHOR_NAME=razzfazz-io
> SHLVL=1
> SYSTEM=spaces
> KUBERNETES_PORT_443_TCP_PROTO=tcp
> KUBERNETES_PORT_443_TCP_ADDR=172.20.0.1
> SPACE_TITLE=Vs Code Connection Test
> GRADIO_ALLOW_FLAGGING=never
> SPACE_REPO_NAME=vs-code-connection-test
> KUBERNETES_SERVICE_HOST=172.20.0.1
> KUBERNETES_PORT=tcp://172.20.0.1:443
> KUBERNETES_PORT_443_TCP_PORT=443
> PATH=/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
> :/sbin:/bin
> GRADIO_DEFAULT_CONCURRENCY_LIMIT=None
> MEMORY=64Gi
> DEBIAN_FRONTEND=noninteractive
> _=/usr/bin/printenv
> Removing old logfile at /home/user/.vscode-server/.cli.611f9bfce64f25108829dd295
> f54a6894e87339d.log
> Spawned remote CLI: 10397
"
Well, after trying to get a Docker Space with dev mode running, I have some additional feedback:
As it is now, you cannot edit files directly in the space when dev mode is activated.
But, the way I see it, if the build fails, e.g. because your docker file is broken, you need to disable dev mode anyway, because you can't access a space that is not running via ssh.
So in the case of a build error, would it be feasible to deactivate devmode automatically?
Also, permissions were broken for me with the default docker file as suggested in the tutorial. I was not able to create any files or directories using that.
Also, permissions were broken for me with the default docker file as suggested in the tutorial. I was not able to create any files or directories using that.
Thank you for reporting this - are you referring to the Dockerfile from the page here (in the "Example of a compatible Dockerfile" section)?
Ah, thank you for pointing that out... should have scrolled down ;)
No, in my case I created a blank docker space and followed the first steps as provided. But these might be for non dev mode spaces then?
I managed to get permissions kinda fixed, but now I am unsure if this leads to other problems down the line. I'll try complying to the config example in the readme.
Just for reference, my Dockerfile:
Dockerfile
FROM python:3.11
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
Also, permissions were broken for me with the default docker file as suggested in the tutorial. I was not able to create any files or directories using that.
Thank you for reporting this - are you referring to the Dockerfile from the page here (in the "Example of a compatible Dockerfile" section)?
There is one small error in the example:
FROM node:19-slim
RUN RUN apt-get update && \ #Error here: second RUN is wrong
apt-get install -y \
bash \
git git-lfs \
wget curl procps \
htop vim nano && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --link --chown=1000 ./ /app
RUN npm ci
CMD ["node", "index.mjs"]
There is one small error in the example
Indeed! Would you like to open a PR to fix this?
https://huggingface.co/spaces/dev-mode-explorers/README/edit/main/README.md
No, in my case I created a blank docker space and followed the first steps as provided. But these might be for non dev mode spaces then?
Got it!
We should update those instructions so they are compatible with the dev mode, thank you your pointing this out!
There is one small error in the example
Indeed! you like to open a PR to fix this?
https://huggingface.co/spaces/dev-mode-explorers/README/edit/main/README.md
Can do. But one other question beforehand.
I needed to add creating a user to the file, because I got a build error when git tried to assign my git username.
My working Dockerfile now looks like this:
FROM python:3.11
RUN apt-get update && \
apt-get install -y \
bash \
git git-lfs \
wget curl procps \
htop vim nano && \
rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user #seems only this was missing for me
WORKDIR /app
COPY --link --chown=1000 ./ /app
RUN pip install --no-cache-dir --upgrade -r requirements.txt
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
Should I add this as well in the PR?
Yes that would be awesome! Thanks
Done. :)
I have the problem that when I use VSCode Web to access my space it always tries to open ./app as a default, although that directory does not exist in my space.
At the moment I am using this dockerfile:
Dockerfile
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
ARG DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
python3.9 \
python3-pip \
git git-lfs \
ffmpeg \
libcurl4-openssl-dev \
wget curl procps \
htop vim nano \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
SYSTEM=spaces \
HF_HOME=/data/.huggingface
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
CMD ["python3", "app.py"]
Is there a way to configure the starting directory that VSCode Web uses?
@sbrandeis
I have a problem that seems to be related to the remote ssh server. I got the ssh connection using local VSCode as far as it asking me to enter the passphrase. But then it seems to be stuck after I enter it in the initializing state. Sometimes it asks again, but reentering the passphrase a second time changes nothing.
I found a topic from last year for the Remote SSH extension, that talks about exactly that behaviour, but to solve it in that particular case they had to change some config on the ssh server.
Do you know if that might be an error not on my end?
The topic I am talking about is this: https://github.com/microsoft/vscode-remote-release/issues/9079
Thank you for reporting
@razzfazz-io
- could you share an example Space where you encounter that issue?
It would be very helpful for debugging
cc @mcpotato regarding VSCode server configuration
Sure, I made one space public - but in the end, I had this problem with every space. So either it is a basic config error on my end, or it is something coming from the server:
https://huggingface.co/spaces/razzfazz-io/Chat_with_Meta_llama3_8b_to_VAGO_Sauerkraut
Also, I tried using an SSH key without a passphrase as a test because it seemed to hang after entering it. Now the SSH connection just gives a time-out error, with no obvious cause.
error
[11:00:04.621] Running script with connection command: "C:\Program Files\Git\usr\bin\ssh.exe" -T -D 61249 "razzfazz-io-chat-with-meta-llama3-8b-to-vago-sauerkraut@ssh.hf.space" bash
[11:00:04.625] Terminal shell path: C:\Windows\System32\cmd.exe
[11:00:46.629] Resolver error: Error: Connecting with SSH timed out
at g.Timeout (c:\Users\daniel.kleissl\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:500044)
at Timeout._onTimeout (c:\Users\daniel.kleissl\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:619755)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
[11:00:46.632] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"","arch":"","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"1","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"failure","reason":"Timeout","exitCodeLabel":""},"measures":{"resolveAttempts":1,"isExecServer":0,"timing.totalResolveTime":45054,"timing.preSshTime":3051,"timing.scriptTime":42003}}
[11:00:46.634] ------
The window of the dev mode enabled is always at the screen not allowing me to view my app properly. Is there any way to hide the window without having to exit the dev mode?
@sbrandeis I have a problem that seems to be related to the remote ssh server. I got the ssh connection using local VSCode as far as it asking me to enter the passphrase. But then it seems to be stuck after I enter it in the initializing state. Sometimes it asks again, but reentering the passphrase a second time changes nothing.
I found a topic from last year for the Remote SSH extension, that talks about exactly that behaviour, but to solve it in that particular case they had to change some config on the ssh server.
Do you know if that might be an error not on my end?The topic I am talking about is this: https://github.com/microsoft/vscode-remote-release/issues/9079
Has this been solved yet ? I currently facing this issue.
would be cool to be able to add hf_oauth: true without having to disable + re-enable dev mode to make it work
I managed to get to a "Initializing VS Code Server" popup, but now it seems to hang. How long did the initialization take for others?
That is the last output I have in my terminal:Console Output
"[13:03:36.654] > 0c04245dcbc7: running > Found existing installation at /home/user/.vscode-server... > Starting VS Code CLI... "/home/user/.vscode-server/code-611f9bfce64f25108829dd29 > 5f54a6894e87339d" command-shell --cli-data-dir "/home/user/.vscode-server/cli" - > -on-port --on-host=127.0.0.1 --parent-process-id 10373 &> "/home/user/.vscode-se > rver/.cli.611f9bfce64f25108829dd295f54a6894e87339d.log" < /dev/null > printenv: > NVIDIA_VISIBLE_DEVICES=all > KUBERNETES_SERVICE_PORT_HTTPS=443 > KUBERNETES_SERVICE_PORT=443 > PERSISTANT_STORAGE_ENABLED=false > PYTHONUNBUFFERED=1 > PYTORCH_NVML_BASED_CUDA_CHECK=1 > GRADIO_THEME=huggingface > HOSTNAME=r-razzfazz-io-vs-code-connection-test-bafy8t0k-a9bed-8gcjd > SPACE_HOST=razzfazz-io-vs-code-connection-test.hf.space > TQDM_POSITION=-1 > PWD=/home/user/app > SPACES_ZERO_GPU=1 > SPACES_ZERO_DEVICE_API_URL=http://device-api.zero > NVIDIA_DRIVER_CAPABILITIES=compute,utility > TZ=Europe/Paris > HOME=/home/user > KUBERNETES_PORT_443_TCP=tcp://172.20.0.1:443 > SPACE_SUBDOMAIN=razzfazz-io-vs-code-connection-test > GRADIO_SERVER_NAME=0.0.0.0 > VSCODE_AGENT_FOLDER=/home/user/.vscode-server > HF_DATASETS_TRUST_REMOTE_CODE=0 > HF_HUB_ENABLE_HF_TRANSFER=1 > GRADIO_CACHE_EXAMPLES=lazy > PYTHONPATH=/home/user/app > TQDM_MININTERVAL=1 > GRADIO_NUM_PORTS=1 > SPACE_ID=razzfazz-io/vs-code-connection-test > CPU_CORES=64 > SPACE_AUTHOR_NAME=razzfazz-io > SHLVL=1 > SYSTEM=spaces > KUBERNETES_PORT_443_TCP_PROTO=tcp > KUBERNETES_PORT_443_TCP_ADDR=172.20.0.1 > SPACE_TITLE=Vs Code Connection Test > GRADIO_ALLOW_FLAGGING=never > SPACE_REPO_NAME=vs-code-connection-test > KUBERNETES_SERVICE_HOST=172.20.0.1 > KUBERNETES_PORT=tcp://172.20.0.1:443 > KUBERNETES_PORT_443_TCP_PORT=443 > PATH=/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin > :/sbin:/bin > GRADIO_DEFAULT_CONCURRENCY_LIMIT=None > MEMORY=64Gi > DEBIAN_FRONTEND=noninteractive > _=/usr/bin/printenv > Removing old logfile at /home/user/.vscode-server/.cli.611f9bfce64f25108829dd295 > f54a6894e87339d.log > Spawned remote CLI: 10397 "
facing the same issue,
Waiting for server log...```
I have a PRO account, and can't connect via VSCode Local or Remote for this simple gradio space.
On the web, it's stuck in endless loading.
On local, I get a timeout error. I've verified that my ssh setup is correct by following the steps here
I had the same issue. I can get on remote. But vscode local always say timeout. I had only one try that was succeed when i disable the local server option in remote-ssh.
A lot of pain...
i lost all my files when stop the dev mode and re-open it, is that only happens for me?
If you didn't commit your files beforehand, that is expected. I presume you mean you deactivated and activated it? Because that leads to a rebuild of the space and all changes that aren't committed are lost
When I turn on dev mode, every time I click the button to view logs, it causes the space to restart. I need to frequently check the logs, but I don't want the space to restart each time I view them. Is there any solution to this issue?
you can just run gradio app.py in the dev space terminal and it will replace the space with the one running on your terminal
Could you please make and option to completely hide the intrusive dev mode overlay popup. trying to use any space on a mobile device with that even minimized end up with it covering the entire screen as soon as I am gonna type something in an input due to how mobile device zoom and focus on text input elements
Could you please make and option to completely hide the intrusive dev mode overlay popup. trying to use any space on a mobile device with that even minimized end up with it covering the entire screen as soon as I am gonna type something in an input due to how mobile device zoom and focus on text input elements
Hi
@silveroxides
I'm not able to reproduce, what OS are you using ? (Tested on iOS 18.1 + Safari)
If you can join a step video, that would be nice!
Thank you ๐ค
Could you please make and option to completely hide the intrusive dev mode overlay popup. trying to use any space on a mobile device with that even minimized end up with it covering the entire screen as soon as I am gonna type something in an input due to how mobile device zoom and focus on text input elements
Hi @silveroxides
I'm not able to reproduce, what OS are you using ? (Tested on iOS 18.1 + Safari)
If you can join a step video, that would be nice!
Thank you ๐ค
Android 13, MIUI 14.0.8. All mobile chromium based browsers.
I am currently very limited in regards to recording / editing video since I only have a mobile device.