ModuleNotFoundError: No module named 'duckduckgo_search'

#9
by Obiabanaki12 - opened

I got the runtime error with following details:
===== Application Startup at 2025-05-11 16:33:30 =====

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/smolagents/default_tools.py", line 111, in init
from duckduckgo_search import DDGS
ModuleNotFoundError: No module named 'duckduckgo_search'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/app/app.py", line 13, in
search_tool = DuckDuckGoSearchTool()
File "/usr/local/lib/python3.10/site-packages/smolagents/tools.py", line 66, in new_init
original_init(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/smolagents/default_tools.py", line 113, in init
raise ImportError(
ImportError: You must install package duckduckgo_search to run this tool: for instance run pip install duckduckgo-search.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/smolagents/default_tools.py", line 111, in init
from duckduckgo_search import DDGS
ModuleNotFoundError: No module named 'duckduckgo_search'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/app/app.py", line 13, in
search_tool = DuckDuckGoSearchTool()
File "/usr/local/lib/python3.10/site-packages/smolagents/tools.py", line 66, in new_init
original_init(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/smolagents/default_tools.py", line 113, in init
raise ImportError(
ImportError: You must install package duckduckgo_search to run this tool: for instance run pip install duckduckgo-search.

I am not sure where should I install this package( if at all) there is no prompt ?!

I have added "duckduckgo-search" to the lists of packages at requirements.txt
And following smolagents lectures, I have moved DuckDuckGoSearchTool import from "from tools import" to "from smolagents import"
now it works for me

Sign up or log in to comment