TypeError: Client.__init__() got an unexpected keyword argument 'follow_redirects' #74

Closed
opened 2026-02-15 16:27:52 -05:00 by yindo · 1 comment
Owner

Originally created by @chozillla on GitHub (Apr 26, 2024).

`TypeError Traceback (most recent call last)
Cell In[24], line 21
19 from tqdm.notebook import tqdm
20 import os
---> 21 import ollama

File ~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:34
2 from ollama._types import (
3 GenerateResponse,
4 ChatResponse,
(...)
9 ResponseError,
10 )
12 all = [
13 'Client',
14 'AsyncClient',
(...)
31 'show',
32 ]
---> 34 _client = Client()
36 generate = _client.generate
37 chat = _client.chat

File ~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:65, in Client.init(self, host, **kwargs)
64 def init(self, host: Optional[str] = None, **kwargs) -> None:
---> 65 super().init(httpx.Client, host, **kwargs)

File ~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:54, in BaseClient.init(self, client, host, follow_redirects, timeout, **kwargs)
51 headers['Accept'] = 'application/json'
52 headers['User-Agent'] = f'ollama-python/{version} ({platform.machine()} {platform.system().lower()}) Python/{platform.python_version()}'
---> 54 self._client = client(
55 base_url=_parse_host(host or os.getenv('OLLAMA_HOST')),
56 follow_redirects=follow_redirects,
57 timeout=timeout,
58 headers=headers,
59 **kwargs,
60 )

TypeError: Client.init() got an unexpected keyword argument 'follow_redirects'`

So I tried to import Ollama got that issue :(

Originally created by @chozillla on GitHub (Apr 26, 2024). `TypeError Traceback (most recent call last) Cell In[24], [line 21](vscode-notebook-cell:?execution_count=24&line=21) [19](vscode-notebook-cell:?execution_count=24&line=19) from tqdm.notebook import tqdm [20](vscode-notebook-cell:?execution_count=24&line=20) import os ---> [21](vscode-notebook-cell:?execution_count=24&line=21) import ollama File [~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:34](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:34) [2](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:2) from ollama._types import ( [3](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:3) GenerateResponse, [4](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:4) ChatResponse, (...) [9](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:9) ResponseError, [10](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:10) ) [12](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:12) __all__ = [ [13](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:13) 'Client', [14](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:14) 'AsyncClient', (...) [31](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:31) 'show', [32](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:32) ] ---> [34](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:34) _client = Client() [36](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:36) generate = _client.generate [37](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/__init__.py:37) chat = _client.chat File [~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:65](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:65), in Client.__init__(self, host, **kwargs) [64](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:64) def __init__(self, host: Optional[str] = None, **kwargs) -> None: ---> [65](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:65) super().__init__(httpx.Client, host, **kwargs) File [~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:54](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:54), in BaseClient.__init__(self, client, host, follow_redirects, timeout, **kwargs) [51](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:51) headers['Accept'] = 'application/json' [52](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:52) headers['User-Agent'] = f'ollama-python/{__version__} ({platform.machine()} {platform.system().lower()}) Python/{platform.python_version()}' ---> [54](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:54) self._client = client( [55](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:55) base_url=_parse_host(host or os.getenv('OLLAMA_HOST')), [56](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:56) follow_redirects=follow_redirects, [57](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:57) timeout=timeout, [58](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:58) headers=headers, [59](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:59) **kwargs, [60](https://file+.vscode-resource.vscode-cdn.net/Users/chemay/Documents/GitHub/AUPE_Verify/~/anaconda3/lib/python3.11/site-packages/ollama/_client.py:60) ) TypeError: Client.__init__() got an unexpected keyword argument 'follow_redirects'` So I tried to import Ollama got that issue :(
yindo closed this issue 2026-02-15 16:27:52 -05:00
Author
Owner

@chozillla commented on GitHub (Apr 26, 2024):

Nvm just exited vscode and restarted it.

@chozillla commented on GitHub (Apr 26, 2024): Nvm just exited vscode and restarted it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#74