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

Share link issues #3677

Open
1 task done
Ju1-js opened this issue Mar 28, 2023 · 48 comments · Fixed by #5731
Open
1 task done

Share link issues #3677

Ju1-js opened this issue Mar 28, 2023 · 48 comments · Fixed by #5731
Labels
bug Something isn't working

Comments

@Ju1-js
Copy link

Ju1-js commented Mar 28, 2023

Describe the bug

There was an issue for this before, but even the test code that worked for them doesn't work for me.
The code works for me on Gradio 1.18.0, but the moment I upgrade past it ex. 1.19.x+. The share link breaks.

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

import gradio as gr

def greet(name):
    return "Hello " + name + "!"

demo = gr.Interface(fn=greet, inputs="text", outputs="text")
    
demo.launch(share=True, debug=True)

Logs

py --version
Python 3.11.1
py -m pip list
Package            Version
------------------ ---------
...
gradio             3.23.0
...

System Info

Gradio version: 3.23.0
Os: Windows 10 21H2 (OS Build 19044.2604)
Browser: Brave - Chromium

Severity

Blocking upgrade to latest gradio version

@Ju1-js Ju1-js added the bug Something isn't working label Mar 28, 2023
@Chris-pap
Copy link

Chris-pap commented Mar 29, 2023

I have the same problem with VSCode.
I tried yesterday a couple of times and the same today.

ddd

I have the latest version of vscode (1.76.2) and from Gradio (3.23.0)
Python (3.10.7)

@abidlabs abidlabs changed the title Could not create share link. Please check your internet connection or our status page: https://status.gradio.app Share link issues Mar 29, 2023
@abidlabs
Copy link
Member

Taking a look! @Chris-pap what OS are you running?

@abidlabs
Copy link
Member

I'm also going to pin this issue. If anyone else is experiencing share link issues, please chime into this issue

@abidlabs abidlabs pinned this issue Mar 29, 2023
@Chris-pap
Copy link

Chris-pap commented Mar 29, 2023

Taking a look! @Chris-pap what OS are you running?

Windows 11 Home , 22H2, 22621.1413

@abidlabs
Copy link
Member

Do you guys have an antivirus that's running? It looks like Windows Defender sometimes blocks the share link binary file from running. See #3230

@Chris-pap
Copy link

Do you guys have an antivirus that's running? It looks like Windows Defender sometimes blocks the share link binary file from running. See #3230

I have windows defender and Malwarebytes, i deactivate both of them but it didn't fix the problem.

@Ju1-js
Copy link
Author

Ju1-js commented Mar 30, 2023

image
That was the issue for me! Thanks!
@Chris-pap Check protection history, it may have already been quarantined so that when defender or Malwarebytes was deactivated, it wouldn't change anything.

@Chris-pap
Copy link

@Chris-pap Check protection history, it may have already been quarantined so that when defender or Malwarebytes was deactivated, it wouldn't change anything.

I am keep having the same problem. (blocked apps are not from gradio)
Screenshot_1

@abidlabs
Copy link
Member

Thanks @Ju1-js for letting us know. @Chris-pap, sorry this didn't solve it for you, I'll let you know if we can think of anything else that may be going on.

@erbill
Copy link

erbill commented Apr 1, 2023

Ok I've found solution for my problem on this link as Abidlabs shared
https://www.makeuseof.com/how-to-whitelist-files-windows-defender/

I've whitelisted entire Folder instead of just the app.py which worked for me

@Ju1-js
Copy link
Author

Ju1-js commented Apr 11, 2023

Most problems seem resolved.

@renatz
Copy link

renatz commented Jun 20, 2023

@Chris-pap Check protection history, it may have already been quarantined so that when defender or Malwarebytes was deactivated, it wouldn't change anything.

I am keep having the same problem. (blocked apps are not from gradio) Screenshot_1

maybe you run the code in a server with the proxy? I closed the agents and the problem is solved.

@jamiechoi1995
Copy link

I met the same problem on Ubuntu, any solution?

@Kefan-pauline
Copy link

I also encountered this issue in a remote notebook that is different from colab, kaggle, sagemaker etc.

share = True outputs only Running on local URL: http://127.0.0.1:7860/, the share link is not created, and the kernel keeps busy.

More details see: #2918 (comment)

@logiczr
Copy link

logiczr commented Aug 13, 2023

I met the same problem on Ubuntu, any solution?

I met the same problem on ubuntu2204,have you solved this problem?

@C4l1b3r
Copy link

C4l1b3r commented Sep 8, 2023

With sd I edited the bat file added --share --gradio-auth someUsername:somePassword and it works just fine

@cansik
Copy link
Contributor

cansik commented Sep 25, 2023

@abidlabs It seems that the tunneling.py code is not written to cover any error that happens with the underlaying binary. The while loop never exits and sometimes even misses errors. For example on my system (Windows 11), the line printed by frpc reads:

2023/09/25 22:10:51 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout

And now gradio will just wait forever for a line that reads start proxy success: (.+)\n. But all the lines that are sent by frpc are just \n and not None.

while url == "":
    if self.proc.stdout is None:
        continue
    line = self.proc.stdout.readline()
    line = line.decode("utf-8")
    if "start proxy success" in line:
        result = re.search("start proxy success: (.+)\n", line)
        if result is None:
            raise ValueError("Could not create share URL")
        else:
            url = result.group(1)
return url

In my opinion this code should have a limit of messages to check before exiting gracefully and raising a proper exception with all the lines logged to the error stream.

@abidlabs
Copy link
Member

Thanks @cansik I believe you are correct. Would you like to open a PR in which any errors are outputted to the user?

@sylee96
Copy link

sylee96 commented Sep 26, 2023

@abidlabs It seems that the tunneling.py code is not written to cover any error that happens with the underlaying binary. The while loop never exits and sometimes even misses errors. For example on my system (Windows 11), the line printed by frpc reads:

2023/09/25 22:10:51 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout

And now gradio will just wait forever for a line that reads start proxy success: (.+)\n. But all the lines that are sent by frpc are just \n and not None.

while url == "":
    if self.proc.stdout is None:
        continue
    line = self.proc.stdout.readline()
    line = line.decode("utf-8")
    if "start proxy success" in line:
        result = re.search("start proxy success: (.+)\n", line)
        if result is None:
            raise ValueError("Could not create share URL")
        else:
            url = result.group(1)
return url

In my opinion this code should have a limit of messages to check before exiting gracefully and raising a proper exception with all the lines logged to the error stream.

I also found out that this was a problem while debugging. The while loop never exits.
I used to get a public ip and share the link as a temporary measure like this.


#while url == "":
        #    if self.proc.stdout is None:
        #        continue
        #    line = self.proc.stdout.readline()
        #    line = line.decode("utf-8")
        #    if "start proxy success" in line:
        #        result = re.search("start proxy success: (.+)\n", line)
        #        if result is None:
        #            raise ValueError("Could not create share URL")
        #        else:
        #            url = result.group(1)
public_ip = subprocess.run(["curl", "ifconfig.me"], stdout=subprocess.PIPE)
url = f"http://{public_ip.stdout.decode('utf-8')}:{self.local_port}/"
return url

@cansik
Copy link
Contributor

cansik commented Sep 28, 2023

@abidlabs Have a look at #5731

@xxxmuzart
Copy link

@abidlabs I changed mine NVAPI Key and nothing changed =/
What I should do than?

@samueleruffino99
Copy link

I have the same issue actually.
I am trying to generate a shareble link with gradio, but I am getting the following error message:

2024-04-10 16:46:50 | ERROR | stderr | 2024/04/10 16:46:50 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout
2024-04-10 16:46:50 | INFO | stdout | 
2024-04-10 16:46:50 | INFO | stdout | Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.

I have:

gradio                    4.16.0                   pypi_0    pypi
gradio-client             0.8.1                    pypi_0    pypi

I have seen it is possible to deal with it downgrading gradio to 3.9, but currenlty I have a strict requirement using this version.

Reproduction

import gradio as gr

def greet(name):
    return "Hello " + name + "!"

demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
    
demo.launch(share=True)  # Share your demo with just 1 extra parameter 🚀

Logs

2024-04-10 16:46:34 | INFO | httpx | HTTP Request: GET https://api.gradio.app/pkg-version "HTTP/1.1 200 OK"
2024-04-10 16:46:35 | INFO | httpx | HTTP Request: POST https://api.gradio.app/gradio-initiated-analytics/ "HTTP/1.1 200 OK"
2024-04-10 16:46:37 | INFO | stdout | Running on local URL:  http://0.0.0.0:7860
2024-04-10 16:46:37 | INFO | httpx | HTTP Request: GET http://localhost:7860/startup-events "HTTP/1.1 200 OK"
2024-04-10 16:46:37 | INFO | httpx | HTTP Request: HEAD http://localhost:7860/ "HTTP/1.1 200 OK"
2024-04-10 16:46:40 | INFO | httpx | HTTP Request: GET https://api.gradio.app/v2/tunnel-request "HTTP/1.1 200 OK"
2024-04-10 16:46:50 | ERROR | stderr | 2024/04/10 16:46:50 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout
2024-04-10 16:46:50 | INFO | stdout | 
2024-04-10 16:46:50 | INFO | stdout | Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.
2024-04-10 16:46:51 | INFO | httpx | HTTP Request: POST https://api.gradio.app/gradio-launched-telemetry/ "HTTP/1.1 200 OK"
2024-04-10 16:46:51 | INFO | httpx | HTTP Request: POST https://api.gradio.app/gradio-error-analytics/ "HTTP/1.1 200 OK"

System Info

gradio                    4.16.0                   pypi_0    pypi
gradio-client             0.8.1                    pypi_0    pypi

@MichaelJWelsh
Copy link

+1 Same issue as above

@VelikayaScarlet
Copy link

still not works, no public link appears

@ybch14
Copy link

ybch14 commented May 24, 2024

I encounter this issue today. I'm using gradio v3.41.2 and gradio-client v0.5.0. After starting a demo.launch(share=True), the console output only gives local url, but no share links. When I hit ctrl-c, the trackback shows:

File "${HOME_PATH}/min_test.py", line 8, in <module>
    demo.launch(share=True)
  File "${CONDA_PATH}/lib/python3.9/site-packages/gradio/blocks.py", line 1995, in launch
    self.share_url = networking.setup_tunnel(
  File "${CONDA_PATH}/lib/python3.9/site-packages/gradio/networking.py", line 190, in setup_tunnel
    address = tunnel.start_tunnel()
  File "${CONDA_PATH}/lib/python3.9/site-packages/gradio/tunneling.py", line 60, in start_tunnel
    self.url = self._start_tunnel(BINARY_PATH)
  File "${CONDA_PATH}/lib/python3.9/site-packages/gradio/tunneling.py", line 97, in _start_tunnel
    line = self.proc.stdout.readline()

After some digging, I find that the problem comes from frpc. In tunneling.py's _start_tunnel function, gradio starts a subprocess to run this command and wait for response:

${CONDA_PATH}/lib/python3.9/site-packages/gradio/frpc_linux_amd64_v0.2 http -n ${SHARE_TOKEN} -l 7860 -i 127.0.0.1 --uc --sd random --ue --server_addr 44.237.78.176:7000 --disable_log_color

However, when I try to execute the command directly in the shell, I get login to server failed: dial tcp 44.237.78.176:7000: i/o timeout. Moreover, the ip 44.237.78.176 cannot be reached through ping.
Also, I tried to find out where does this IP address come from, and I found it in networking.py's setup_tunnel function, which request https://api.gradio.app/v2/tunnel-request and gets a dict.
I also tried to directly access the https://api.gradio.app/v2/tunnel-request through browser, and I got a JSON [{"host": "44.237.78.176", "port": 7000}].
I think this is the reason of this weird problem. Maybe the share link server's IP address has been updated, but the tunnel-request API is still returning old IP address? I wonder the reason.

@abidlabs
Copy link
Member

Will look into this but just fyi 44.237.78.176 is the correct IP address for the FRP server

@ybch14
Copy link

ybch14 commented May 26, 2024

Will look into this but just fyi 44.237.78.176 is the correct IP address for the FRP server

Thank you ! I'm also wondering, are there any other ways to share my gradio app than requesting a shared link with frpc? For example, using IP and port? As far as I know, the local url is not available for remote access now.

@abidlabs
Copy link
Member

Thank you ! I'm also wondering, are there any other ways to share my gradio app than requesting a shared link with frpc? For example, using IP and port? As far as I know, the local url is not available for remote access now.

SSH port forwarding is always an option: https://www.ssh.com/academy/ssh/tunneling-example

@ybch14
Copy link

ybch14 commented May 27, 2024

Thank you ! I'm also wondering, are there any other ways to share my gradio app than requesting a shared link with frpc? For example, using IP and port? As far as I know, the local url is not available for remote access now.

SSH port forwarding is always an option: https://www.ssh.com/academy/ssh/tunneling-example

OK, thanks! Forgot this😂

@yiwanghehe
Copy link

So has this problem been solved? I am also facing the same problem now

@abidlabs
Copy link
Member

abidlabs commented Jun 1, 2024

So has this problem been solved? I am also facing the same problem now

Which problem exactly?

@lwdnxu
Copy link

lwdnxu commented Jun 6, 2024

In practice, the following method can be used to solve this problem:
chmod +x /path/frpc_linux_amd64_v0.2

@abidlabs
Copy link
Member

Hi folks, just a heads up that we have discovered a security vulnerability with how share links were created in gradio<=3.13, and will be disabling share links for this version starting next Wednesday. Please upgrade to a more recent version of gradio, and if you are having issues creating share links in more recent versions, please respond in this issue so that we can help fix it.

@Helw150
Copy link

Helw150 commented Oct 11, 2024

Sharing links works on my machines with pre-5.0.1 builds - but sadly broke after moving to 5! Unfortunately, the logs don't have much information to share as the more information is followed by an empty log.

Could not create share URL. Please check the appended log from frpc for more information:                                                                                                                                                    
                   

It seems like the new binary is getting killed on my machine? Looks like the binary got re-vamped and pushed to a new version, but not sure what the cause could be. Confirmed that sharing works as expected if I revert to a 4.x version.

OS Info

LSB Version:    core-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

@Joe-Hall-Lee
Copy link

I still cannot use gradio to create a shared link on Win 11 23H2. The gradio version is 5.1.0. The error is as follows.

Could not create share link. Please check your internet connection or our status page: https://status.gradio.app/.
2024/10/19 14:05:29 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout

@March-H
Copy link

March-H commented Nov 4, 2024

Has the problem been sovled? I encounter it in my docker container with VS Code
Could not create share link. Please check your internet connection or our status page: https://status.gradio.app/. 2024/11/04 05:49:29 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout

@prgrmcode
Copy link

+1 Same issue as mentioned
image
OS: Win 10
env: conda environment
Gradio version:
gradio 5.5.0 pypi_0 pypi

@kairin
Copy link

kairin commented Dec 22, 2024

sorry, i did not see that this link is the more recent one... i am encountering the same problem and described here when trying to launch and updated file in google colab:

cocktailpeanut/fluxgym#277 (comment)

and when running locally i get the following as well:

Running on local URL:  http://127.0.0.1:7860
2024-12-22 11:11:02 INFO     HTTP Request: GET http://127.0.0.1:7860/startup-events "HTTP/1.1 200 OK"                                  _client.py:1025
                    INFO     HTTP Request: HEAD http://127.0.0.1:7860/ "HTTP/1.1 200 OK"                                               _client.py:1025

Could not create share link. Missing file: /home/k/.pyenv/versions/ven2/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.2. 

Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps: 

1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64
2. Rename the downloaded file to: frpc_linux_amd64_v0.2
3. Move the file to this location: /home/k/.pyenv/versions/ven2/lib/python3.10/site-packages/gradio

@kairin
Copy link

kairin commented Dec 22, 2024

sorry, i did not see that this link is the more recent one... i am encountering the same problem and described here when trying to launch and updated file in google colab:

cocktailpeanut/fluxgym#277 (comment)

and when running locally i get the following as well:

Running on local URL:  http://127.0.0.1:7860
2024-12-22 11:11:02 INFO     HTTP Request: GET http://127.0.0.1:7860/startup-events "HTTP/1.1 200 OK"                                  _client.py:1025
                    INFO     HTTP Request: HEAD http://127.0.0.1:7860/ "HTTP/1.1 200 OK"                                               _client.py:1025

Could not create share link. Missing file: /home/k/.pyenv/versions/ven2/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.2. 

Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps: 

1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64
2. Rename the downloaded file to: frpc_linux_amd64_v0.2
3. Move the file to this location: /home/k/.pyenv/versions/ven2/lib/python3.10/site-packages/gradio

image

i just tried a testapp to see if just the plain code is working... and apparently... no issue...

@kairin
Copy link

kairin commented Dec 22, 2024

image

does anyone know what is this gradio block? as in... is it blocking something from executing?

/content/fluxgym
Running on local URL:  http://127.0.0.1:7860/
Running on public URL: https://1b03d54b8b8e056bb5.gradio.live/

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)
Keyboard interruption in main thread... closing server.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 2709, in block_thread
    time.sleep(0.1)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/content/fluxgym/testapp.py", line 8, in <module>
    demo.launch(share=True)  # Share your demo with just 1 extra parameter 🚀
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 2614, in launch
    self.block_thread()
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 2713, in block_thread
    self.server.close()
  File "/usr/local/lib/python3.10/dist-packages/gradio/http_server.py", line 63, in close
    def close(self):
KeyboardInterrupt
Killing tunnel 127.0.0.1:7860 <> https://1b03d54b8b8e056bb5.gradio.live/
^C

@kairin
Copy link

kairin commented Dec 22, 2024

https://www.gradio.app/docs/gradio/blocks

okay sorry no... not related.

so in summary:

running my own testapp gradio will output share link. https://github.com/kairin/fluxgym/blob/41992c8a62587652d97d3b4ee6a6ec0d0ebd7620/FluxGym.ipynb

Screenshot_2024-12-22_12-42-54

but when running the original app.py file, gradio will only output the local URL and not the Gradio share link.

Screenshot_2024-12-22_12-44-57

@kairin
Copy link

kairin commented Dec 22, 2024

cocktailpeanut/fluxgym#277 (comment)

why does the sharelink appear when i save my colab into github?

but the sharelink does not appear while it is still running in the colab?

i am currently using this method as a workaround when the sharelink does not appear in google's colab.

image

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

Successfully merging a pull request may close this issue.