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

09 Model development: TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options' #873

Open
AI-Gio opened this issue Mar 25, 2024 · 0 comments

Comments

@AI-Gio
Copy link

AI-Gio commented Mar 25, 2024

I'm trying to import gradio, but I keep getting this error:

I am working in VScode in a .ipynb and using an Anaconda environment.

There's possibly something wrong with the httpx or httpcore dependencies:
AUTOMATIC1111

Error

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
Cell In[5], [line 6](vscode-notebook-cell:?execution_count=5&line=6)
      [4](vscode-notebook-cell:?execution_count=5&line=4) except: 
      [5](vscode-notebook-cell:?execution_count=5&line=5)     get_ipython().system('pip -q install gradio==3.45.0')
----> [6](vscode-notebook-cell:?execution_count=5&line=6)     import gradio as gr
      [8](vscode-notebook-cell:?execution_count=5&line=8) print(f"Gradio version: {gr.__version__}")

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\__init__.py:3](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/__init__.py:3)
      [1](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/__init__.py:1) import json
----> [3](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/__init__.py:3) import gradio.components as components
      [4](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/__init__.py:4) import gradio.inputs as inputs
      [5](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/__init__.py:5) import gradio.outputs as outputs

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\components\__init__.py:1](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/__init__.py:1)
----> [1](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/__init__.py:1) from gradio.components.annotated_image import AnnotatedImage
      [2](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/__init__.py:2) from gradio.components.audio import Audio
      [3](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/__init__.py:3) from gradio.components.bar_plot import BarPlot

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\components\annotated_image.py:14](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:14)
     [11](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:11) from PIL import Image as _Image  # using _ to minimize namespace pollution
     [13](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:13) from gradio import utils
---> [14](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:14) from gradio.components.base import IOComponent, _Keywords
     [15](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:15) from gradio.deprecation import warn_style_method_deprecation
     [16](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:16) from gradio.events import (
     [17](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:17)     EventListenerMethod,
     [18](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:18)     Selectable,
     [19](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/annotated_image.py:19) )

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\components\base.py:29](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:29)
     [26](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:26) from PIL import Image as _Image  # using _ to minimize namespace pollution
     [28](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:28) from gradio import processing_utils, utils
---> [29](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:29) from gradio.blocks import Block, BlockContext, Updateable
     [30](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:30) from gradio.deprecation import warn_deprecation, warn_style_method_deprecation
     [31](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:31) from gradio.events import (
     [32](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:32)     EventListener,
     [33](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/components/base.py:33) )

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\blocks.py:29](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:29)
     [26](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:26) from gradio_client.documentation import document, set_documentation_group
     [27](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:27) from packaging import version
---> [29](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:29) from gradio import (
     [30](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:30)     analytics,
     [31](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:31)     components,
     [32](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:32)     external,
     [33](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:33)     networking,
     [34](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:34)     queueing,
     [35](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:35)     routes,
     [36](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:36)     strings,
     [37](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:37)     themes,
     [38](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:38)     utils,
     [39](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:39)     wasm_utils,
     [40](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:40) )
     [41](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:41) from gradio.context import Context
     [42](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/blocks.py:42) from gradio.deprecation import check_deprecated_parameters, warn_deprecation

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\networking.py:20](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/networking.py:20)
     [17](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/networking.py:17) from uvicorn.config import Config
     [19](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/networking.py:19) from gradio.exceptions import ServerFailedToStartError
---> [20](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/networking.py:20) from gradio.routes import App
     [21](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/networking.py:21) from gradio.tunneling import Tunnel
     [22](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/networking.py:22) from gradio.utils import SourceFileReloader, watchfn

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\gradio\routes.py:105](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:105)
    [102](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:102) templates = Jinja2Templates(directory=STATIC_TEMPLATE_LIB)
    [103](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:103) templates.env.filters["toorjson"] = toorjson
--> [105](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:105) client = httpx.AsyncClient()
    [108](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:108) class App(FastAPI):
    [109](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:109)     """
    [110](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:110)     FastAPI App Wrapper
    [111](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/gradio/routes.py:111)     """

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\httpx\_client.py:1397](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1397), in AsyncClient.__init__(self, auth, params, headers, cookies, verify, cert, http1, http2, proxies, mounts, timeout, follow_redirects, limits, max_redirects, event_hooks, base_url, transport, app, trust_env, default_encoding)
   [1394](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1394) allow_env_proxies = trust_env and app is None and transport is None
   [1395](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1395) proxy_map = self._get_proxy_map(proxies, allow_env_proxies)
-> [1397](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1397) self._transport = self._init_transport(
   [1398](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1398)     verify=verify,
   [1399](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1399)     cert=cert,
   [1400](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1400)     http1=http1,
   [1401](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1401)     http2=http2,
   [1402](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1402)     limits=limits,
   [1403](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1403)     transport=transport,
   [1404](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1404)     app=app,
   [1405](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1405)     trust_env=trust_env,
   [1406](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1406) )
   [1408](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1408) self._mounts: typing.Dict[URLPattern, typing.Optional[AsyncBaseTransport]] = {
   [1409](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1409)     URLPattern(key): None
   [1410](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1410)     if proxy is None
   (...)
   [1420](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1420)     for key, proxy in proxy_map.items()
   [1421](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1421) }
   [1422](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1422) if mounts is not None:

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\httpx\_client.py:1445](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1445), in AsyncClient._init_transport(self, verify, cert, http1, http2, limits, transport, app, trust_env)
   [1442](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1442) if app is not None:
   [1443](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1443)     return ASGITransport(app=app)
-> [1445](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1445) return AsyncHTTPTransport(
   [1446](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1446)     verify=verify,
   [1447](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1447)     cert=cert,
   [1448](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1448)     http1=http1,
   [1449](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1449)     http2=http2,
   [1450](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1450)     limits=limits,
   [1451](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1451)     trust_env=trust_env,
   [1452](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_client.py:1452) )

File [c:\Users\gsvpk\anaconda3\envs\dlv2\lib\site-packages\httpx\_transports\default.py:275](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:275), in AsyncHTTPTransport.__init__(self, verify, cert, http1, http2, limits, trust_env, proxy, uds, local_address, retries, socket_options)
    [272](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:272) ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
    [274](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:274) if proxy is None:
--> [275](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:275)     self._pool = httpcore.AsyncConnectionPool(
    [276](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:276)         ssl_context=ssl_context,
    [277](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:277)         max_connections=limits.max_connections,
    [278](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:278)         max_keepalive_connections=limits.max_keepalive_connections,
    [279](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:279)         keepalive_expiry=limits.keepalive_expiry,
    [280](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:280)         http1=http1,
    [281](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:281)         http2=http2,
    [282](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:282)         uds=uds,
    [283](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:283)         local_address=local_address,
    [284](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:284)         retries=retries,
    [285](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:285)         socket_options=socket_options,
    [286](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:286)     )
    [287](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:287) elif proxy.url.scheme in ("http", "https"):
    [288](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:288)     self._pool = httpcore.AsyncHTTPProxy(
    [289](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:289)         proxy_url=httpcore.URL(
    [290](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:290)             scheme=proxy.url.raw_scheme,
   (...)
    [303](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:303)         socket_options=socket_options,
    [304](file:///C:/Users/gsvpk/anaconda3/envs/dlv2/lib/site-packages/httpx/_transports/default.py:304)     )

TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'

Dependencies

Python 3.10.14
Package                   Version
------------------------- ---------
aiofiles                  23.2.1
aiohttp                   3.9.3
aiosignal                 1.3.1
altair                    5.2.0
analytics-python          1.4.post1
annotated-types           0.6.0
anyio                     3.7.1
asttokens                 2.4.1
async-timeout             4.0.3
attrs                     23.2.0
backoff                   1.10.0
bcrypt                    4.1.2
Brotli                    1.0.9
certifi                   2024.2.2
cffi                      1.16.0
chardet                   5.2.0
charset-normalizer        3.3.2
click                     8.1.7
colorama                  0.4.6
comm                      0.2.2
contourpy                 1.2.0
cryptography              42.0.5
cycler                    0.12.1
debugpy                   1.6.7
decorator                 5.1.1
exceptiongroup            1.2.0
executing                 2.0.1
fastapi                   0.110.0
ffmpy                     0.3.2
filelock                  3.13.1
fonttools                 4.50.0
frozenlist                1.4.1
fsspec                    2024.3.1
gmpy2                     2.1.2
gradio                    3.45.0
gradio_client             0.5.2
h11                       0.14.0
httpcore                  1.0.4
httpx                     0.27.0
huggingface-hub           0.21.4
idna                      3.4
importlib_metadata        7.1.0
importlib_resources       6.4.0
ipykernel                 6.29.3
ipython                   8.22.2
jedi                      0.19.1
Jinja2                    3.1.3
jsonschema                4.21.1
jsonschema-specifications 2023.12.1
jupyter_client            8.6.1
jupyter_core              5.7.2
kiwisolver                1.4.5
linkify-it-py             2.0.3
markdown-it-py            3.0.0
MarkupSafe                2.1.3
matplotlib                3.8.3
matplotlib-inline         0.1.6
mdit-py-plugins           0.4.0
mdurl                     0.1.2
mkl-fft                   1.3.8
mkl-random                1.2.4
mkl-service               2.4.0
monotonic                 1.6
mpmath                    1.3.0
multidict                 6.0.5
nest_asyncio              1.6.0
networkx                  3.1
numpy                     1.26.4
orjson                    3.9.15
packaging                 24.0
pandas                    2.2.1
paramiko                  3.4.0
parso                     0.8.3
pickleshare               0.7.5
pillow                    10.2.0
pip                       23.3.1
platformdirs              4.2.0
prompt-toolkit            3.0.42
psutil                    5.9.0
pure-eval                 0.2.2
pycparser                 2.21
pycryptodome              3.20.0
pydantic                  2.6.4
pydantic_core             2.16.3
pydub                     0.25.1
Pygments                  2.17.2
PyNaCl                    1.5.0
pyparsing                 3.1.2
PySocks                   1.7.1
python-dateutil           2.9.0
python-multipart          0.0.9
pytz                      2024.1
pywin32                   305.1
PyYAML                    6.0.1
pyzmq                     25.1.2
referencing               0.34.0
requests                  2.31.0
rich                      13.7.1
rpds-py                   0.18.0
ruff                      0.3.4
semantic-version          2.10.0
setuptools                68.2.2
shellingham               1.5.4
six                       1.16.0
sniffio                   1.3.1
stack-data                0.6.2
starlette                 0.36.3
sympy                     1.12
tomlkit                   0.12.0
toolz                     0.12.1
torch                     2.2.1
torchaudio                2.2.1
torchinfo                 1.8.0
torchvision               0.17.1
tornado                   6.2
tqdm                      4.66.2
traitlets                 5.14.2
typer                     0.10.0
typing_extensions         4.10.0
tzdata                    2024.1
uc-micro-py               1.0.3
urllib3                   2.1.0
uvicorn                   0.29.0
wcwidth                   0.2.13
websockets                11.0.3
wheel                     0.41.2
win-inet-pton             1.1.0
yarl                      1.9.4
zipp                      3.17.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant