Hi. Just installed Gradio, Wrote 3 or 4 test scripts and each one gives the error in the topic subject. All the apps I tested worked but don’t understand why im getting this message. I updated gradio with pip and i’ve tested both normal run and hot reload. Doesn’t matter if i start from .bat, cmd, or .py, the error still appears. Also, without creating a new topic, at times the app does not update and appears to use a cached previous version despite clearing the browser, changing the browser, rename the py, and even restarting the Win 10 PC…which I know doesn’t make any sense.
1 Like
Gradio seems to give that kind of error if the path is not passed.
opened 06:19PM - 22 Mar 24 UTC
closed 11:06PM - 22 Mar 24 UTC
bug
### Describe the bug
`import gradio` fails on Windows 10 Enterprise
### Ha… ve you searched existing issues? 🔎
- [X] I have searched and found no existing issues
### Reproduction
OS: Windows 10 Enterprise - Version 10.0.19045 Build 19045
Run Powershell [Conda] prompt:
```powershell
conda create -c conda-forge -p .conda python=3.11 gradio
conda activate .\.conda
python
```
Another irritating detail was that it was working for some time INSIDE at least (but also ONLY in) Jupyter Notebooks - I had these running inside VS Code - at least when I was testing the minimal `gradio.Interface` examples - BUT the some minimal ChatInterface tests I tried (that included `gr.Textbox` were throwing `TypeError: Expected a gr.Textbox or gr.MultimodalTextbox component, but got <class 'gradio.components.textbox.Textbox'>`.
I tried the solution mentioned in #7783 for issue #7781 ie pip installing gradio-client from github. This resulted in other errors (mainly related to `anyio`) so I cleaned it all up again.
But now nothing seems to work anymore?
I tried to reduce it to a minimum, and even the basic `import gradio` ends up "in trouble".
```python
>>> import gradio
```
Output:
```
Traceback (most recent call last):
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_urlparse.py", line 346, in normalize_port
port_as_int = int(port)
^^^^^^^^^
ValueError: invalid literal for int() with base 10: '5986.mapi.s-mxs.net'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\__init__.py", line 3, in <module>
import gradio._simple_templates
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\_simple_templates\__init__.py", line 1, in <module>
from .simpledropdown import SimpleDropdown
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\_simple_templates\simpledropdown.py", line 6, in <module>
from gradio.components.base import FormComponent
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\components\__init__.py", line 1, in <module>
from gradio.components.annotated_image import AnnotatedImage
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\components\annotated_image.py", line 14, in <module>
from gradio.components.base import Component
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\components\base.py", line 20, in <module>
from gradio.blocks import Block, BlockContext
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\blocks.py", line 29, in <module>
from gradio import (
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\networking.py", line 20, in <module>
from gradio.routes import App
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\gradio\routes.py", line 137, in <module>
client = httpx.AsyncClient()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_client.py", line 1442, in __init__
self._mounts: dict[URLPattern, AsyncBaseTransport | None] = {
^
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_client.py", line 1443, in <dictcomp>
URLPattern(key): None
^^^^^^^^^^^^^^^
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_utils.py", line 370, in __init__
url = URL(pattern)
^^^^^^^^^^^^
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_urls.py", line 115, in __init__
self._uri_reference = urlparse(url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_urlparse.py", line 248, in urlparse
parsed_port: int | None = normalize_port(port, scheme)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SomeUser\gradio-app\.conda\Lib\site-packages\httpx\_urlparse.py", line 348, in normalize_port
raise InvalidURL(f"Invalid port: {port!r}")
httpx.InvalidURL: Invalid port: '5986.mapi.some-address.net'
```
### Screenshot
_No response_
### Logs
_No response_
### System Info
```shell
running `gradio environment` gives exactly the same output as above
`conda list | grep gradio` gives
gradio 4.22.0 pyhd8ed1ab_0
gradio-client 0.13.0 pyhd8ed1ab_0
Here is the full `conda list --export > environment.yml` content:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
aiofiles=23.2.1=pyhd8ed1ab_0
altair=5.2.0=pyhd8ed1ab_1
annotated-types=0.6.0=pyhd8ed1ab_0
anyio=3.7.1=pyhd8ed1ab_0
aom=3.8.2=h63175ca_0
attrs=23.2.0=pyh71513ae_0
brotli=1.1.0=hcfcfb64_1
brotli-bin=1.1.0=hcfcfb64_1
brotli-python=1.1.0=py311h12c1d0e_1
bzip2=1.0.8=hcfcfb64_5
ca-certificates=2024.2.2=h56e8100_0
cairo=1.18.0=h1fef639_0
certifi=2024.2.2=pyhd8ed1ab_0
charset-normalizer=3.3.2=pyhd8ed1ab_0
click=8.1.7=win_pyh7428d3b_0
colorama=0.4.6=pyhd8ed1ab_0
contourpy=1.2.0=py311h005e61a_0
cycler=0.12.1=pyhd8ed1ab_0
dav1d=1.2.1=hcfcfb64_0
exceptiongroup=1.2.0=pyhd8ed1ab_2
expat=2.6.2=h63175ca_0
fastapi=0.110.0=pyhd8ed1ab_0
ffmpeg=6.1.1=gpl_hb766fab_106
ffmpy=0.3.0=pyhb6f538c_0
filelock=3.13.1=pyhd8ed1ab_0
font-ttf-dejavu-sans-mono=2.37=hab24e00_0
font-ttf-inconsolata=3.000=h77eed37_0
font-ttf-source-code-pro=2.038=h77eed37_0
font-ttf-ubuntu=0.83=h77eed37_1
fontconfig=2.14.2=hbde0cde_0
fonts-conda-ecosystem=1=0
fonts-conda-forge=1=0
fonttools=4.50.0=py311ha68e1ae_0
freetype=2.12.1=hdaf720e_2
fsspec=2024.3.1=pyhca7485f_0
gradio=4.22.0=pyhd8ed1ab_0
gradio-client=0.13.0=pyhd8ed1ab_0
graphite2=1.3.13=1000
h11=0.14.0=pyhd8ed1ab_0
h2=4.1.0=pyhd8ed1ab_0
harfbuzz=8.3.0=h7ab893a_0
hpack=4.0.0=pyh9f0ad1d_0
httpcore=1.0.4=pyhd8ed1ab_0
httpx=0.27.0=pyhd8ed1ab_0
huggingface_hub=0.21.4=pyhd8ed1ab_0
hyperframe=6.0.1=pyhd8ed1ab_0
icu=73.2=h63175ca_0
idna=3.6=pyhd8ed1ab_0
importlib-metadata=7.1.0=pyha770c72_0
importlib-resources=6.4.0=pyhd8ed1ab_0
importlib_resources=6.4.0=pyhd8ed1ab_0
intel-openmp=2024.0.0=h57928b3_49841
jinja2=3.1.3=pyhd8ed1ab_0
jsonschema=4.21.1=pyhd8ed1ab_0
jsonschema-specifications=2023.12.1=pyhd8ed1ab_0
kiwisolver=1.4.5=py311h005e61a_1
lcms2=2.16=h67d730c_0
lerc=4.0.0=h63175ca_0
libblas=3.9.0=21_win64_mkl
libbrotlicommon=1.1.0=hcfcfb64_1
libbrotlidec=1.1.0=hcfcfb64_1
libbrotlienc=1.1.0=hcfcfb64_1
libcblas=3.9.0=21_win64_mkl
libdeflate=1.19=hcfcfb64_0
libexpat=2.6.2=h63175ca_0
libffi=3.4.2=h8ffe710_5
libglib=2.80.0=h39d0aa6_1
libhwloc=2.9.3=default_haede6df_1009
libiconv=1.17=hcfcfb64_2
libjpeg-turbo=3.0.0=hcfcfb64_1
liblapack=3.9.0=21_win64_mkl
libopus=1.3.1=h8ffe710_1
libpng=1.6.43=h19919ed_0
libsqlite=3.45.2=hcfcfb64_0
libtiff=4.6.0=h6e2ebb7_2
libwebp-base=1.3.2=hcfcfb64_0
libxcb=1.15=hcd874cb_0
libxml2=2.12.6=hc3477c8_0
libzlib=1.2.13=hcfcfb64_5
m2w64-gcc-libgfortran=5.3.0=6
m2w64-gcc-libs=5.3.0=7
m2w64-gcc-libs-core=5.3.0=7
m2w64-gmp=6.1.0=2
m2w64-libwinpthread-git=5.0.0.4634.697f757=2
markdown-it-py=3.0.0=pyhd8ed1ab_0
markupsafe=2.1.5=py311ha68e1ae_0
matplotlib-base=3.8.3=py311h6e989c2_0
mdurl=0.1.2=pyhd8ed1ab_0
mkl=2024.0.0=h66d3029_49657
msys2-conda-epoch=20160418=1
munkres=1.1.4=pyh9f0ad1d_0
numpy=1.26.4=py311h0b4df5a_0
openh264=2.4.1=h63175ca_0
openjpeg=2.5.2=h3d672ee_0
openssl=3.2.1=hcfcfb64_1
orjson=3.9.15=py311h633b200_0
packaging=24.0=pyhd8ed1ab_0
pandas=2.2.1=py311hf63dbb6_0
pcre2=10.43=h17e33f8_0
pillow=10.2.0=py311h4dd8a23_0
pip=24.0=pyhd8ed1ab_0
pixman=0.43.4=h63175ca_0
pkgutil-resolve-name=1.3.10=pyhd8ed1ab_1
pthread-stubs=0.4=hcd874cb_1001
pthreads-win32=2.9.1=hfa6e2cd_3
pydantic=2.6.4=pyhd8ed1ab_0
pydantic-core=2.16.3=py311hc37eb10_0
pydub=0.25.1=pyhd8ed1ab_0
pygments=2.17.2=pyhd8ed1ab_0
pyparsing=3.1.2=pyhd8ed1ab_0
pysocks=1.7.1=pyh0701188_6
python=3.11.8=h2628c8c_0_cpython
python-dateutil=2.9.0=pyhd8ed1ab_0
python-multipart=0.0.9=pyhd8ed1ab_0
python-tzdata=2024.1=pyhd8ed1ab_0
python_abi=3.11=4_cp311
pytz=2024.1=pyhd8ed1ab_0
pyyaml=6.0.1=py311ha68e1ae_1
referencing=0.34.0=pyhd8ed1ab_0
requests=2.31.0=pyhd8ed1ab_0
rich=13.7.1=pyhd8ed1ab_0
rpds-py=0.18.0=py311hc37eb10_0
ruff=0.3.4=py311hc14472d_0
semantic_version=2.10.0=pyhd8ed1ab_0
setuptools=69.2.0=pyhd8ed1ab_0
shellingham=1.5.4=pyhd8ed1ab_0
six=1.16.0=pyh6c4a22f_0
sniffio=1.3.1=pyhd8ed1ab_0
starlette=0.36.3=pyhd8ed1ab_0
svt-av1=1.8.0=h63175ca_0
tbb=2021.11.0=h91493d7_1
tk=8.6.13=h5226925_1
tomlkit=0.12.0=pyha770c72_0
toolz=0.12.1=pyhd8ed1ab_0
tqdm=4.66.2=pyhd8ed1ab_0
typer=0.9.0=pyhd8ed1ab_0
typing-extensions=4.10.0=hd8ed1ab_0
typing_extensions=4.10.0=pyha770c72_0
tzdata=2024a=h0c530f3_0
ucrt=10.0.22621.0=h57928b3_0
urllib3=2.2.1=pyhd8ed1ab_0
uvicorn=0.29.0=py311h1ea47a8_0
vc=14.3=hcf57466_18
vc14_runtime=14.38.33130=h82b7239_18
vs2015_runtime=14.38.33130=hcb4865c_18
websockets=11.0.3=py311ha68e1ae_1
wheel=0.43.0=pyhd8ed1ab_0
win_inet_pton=1.1.0=pyhd8ed1ab_6
x264=1!164.3095=h8ffe710_2
x265=3.5=h2d74725_3
xorg-libxau=1.0.11=hcd874cb_0
xorg-libxdmcp=1.1.3=hcd874cb_0
xz=5.2.6=h8d14728_0
yaml=0.2.5=h8ffe710_2
zipp=3.17.0=pyhd8ed1ab_0
zlib=1.2.13=hcfcfb64_5
zstd=1.5.5=h12be248_0
```
```
### Severity
Blocking usage of gradio
Information on how to set the path and environment variables in Windows 2000, Windows XP, Windows Vista, and Windows 7.
Hi. And thanks for the quick reply. Which path? If my applications are functional then we have to conclude the paths are correct. I have 5 Stable Diffusion UIs, sharing the same checkpoints and Loras, and they all work perfectly from one python installation on the same drive. Am I missing something? Please note I mistakenly wrote “Error” in my OP, but it’s Info, not an error. Still I’d like to understand why given it is not a path issue, at least not one with python.
So is this it?
Because in Windows, if you call a batch file from Powershell or something like that, CMD will be launched.
Thank you for the link John. Unfortunately the “solution” doesn’t answer my question. As you know there are dozens of ways to launch a python app. You can do it from CMD in explorer, from a .bat file, from powershell, by double clicking on the .py file itself, from a VS Code terminal, and on and on. This doesn’t explain why I’m getting this info message on a fresh install.
Edit: also the link you read isn’t related to Gradio. It is a generic error, and in this case was related to web3 and/or c++ tools, rather than Gradio which has different requirements and dependencies.
Cheers
It is indeed strange that there is an error message instead of a warning or notice even though it works.
Since I am also in a Windows environment, I often encounter phenomena that are difficult to encounter in Linux or Mac.
In the case of Python, when there are multiple Pythons in the environment, and sometimes a different Python is called than expected. But even in this case, if an error occurs, we usually abort there.