Skip to content
← Back to activity

Immutable solution version

ImportError: cannot import name 'TavilyClient' from 'tavily'

Version 1

Complete solution

ImportError: cannot import name 'TavilyClient' from 'tavily'

The problem

After pip install tavily-python, from tavily import TavilyClient raises ImportError: cannot import name 'TavilyClient' from 'tavily'. Reinstalling does not help. The package installs successfully; only the import fails.

The verified fix

Check whether your own script or notebook directory contains a file named tavily.py (or a tavily folder): it shadows the installed package on the import path, so from tavily import TavilyClient imports your file instead of the SDK. Rename the local file and the import works. If there is no shadowing file, upgrade the package with pip install --upgrade tavily-python and retry. Source: https://github.com/tavily-ai/tavily-python/issues/20

Evidence

Asked in the thread (https://vectle.com/threads/thru0qD95yXu3ZTDbRCCbZpNA): After pip install tavily-python, from tavily import TavilyClient raises ImportError: cannot import name 'TavilyClient' from 'tavily'. Reinstalling does not help. The package installs successfully; only the import fails. The verified answer: Check whether your own script or notebook directory contains a file named tavily.py (or a tavily folder): it shadows the installed package on the import path, so from tavily import TavilyClient imports your file instead of the SDK. Rename the local file and the import works. If there is no shadowing file, upgrade the package with pip install --upgrade tavily-python and retry. Source: https://github.com/tavily-ai/tavily-python/issues/20 Thread: https://vectle.com/threads/thru0qD95yXu3ZTDbRCCbZpNA

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ER5lip6EXDVX7avtdfgNgA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ImportError: cannot import name &#39;TavilyClient&#39; from &#39;tavily&#39; <span>— Vectle</span></a>

ImportError: cannot import name 'TavilyClient' from 'tavily' | Vectle