Auto-GPT-Plugins icon indicating copy to clipboard operation
Auto-GPT-Plugins copied to clipboard

No module named 'newsapi'

Open Uddhav07 opened this issue 2 years ago • 5 comments

WARNING: Plugin AutoGPTEmailPlugin found. But not in the allowlist... Load? (y/n): y Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "E:\Auto-GPT\autogpt_main.py", line 5, in autogpt.cli.main() File "C:\Users\uvmit\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\uvmit\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\uvmit\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1635, in invoke rv = super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\uvmit\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\uvmit\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return _callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\uvmit\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Auto-GPT\autogpt\cli.py", line 90, in main run_auto_gpt( File "E:\Auto-GPT\autogpt\main.py", line 118, in run_auto_gpt cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Auto-GPT\autogpt\plugins.py", line 219, in scan_plugins zipped_module = zipped_package.load_module(str(module.parent)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 301, in load_module File "plugins\Auto-GPT-Plugins-master.zip\Auto-GPT-Plugins-master\src\autogpt_plugins\news_search_init.py", line 7, in File "plugins\Auto-GPT-Plugins-master.zip\Auto-GPT-Plugins-master\src\autogpt_plugins\news_search\news_search.py", line 4, in ModuleNotFoundError: No module named 'newsapi' Press any key to continue . . .

Uddhav07 avatar May 05 '23 11:05 Uddhav07

i have the same error, failure lines, but only when i run AutoGPT using Docker. when i initiate it via python locally, i am able to use news_search.

WARNING: Plugin AutoGPTBingSearch found. But not in the allowlist... Load? (y/n): n WARNING: Plugin AutoGPTEmailPlugin found. But not in the allowlist... Load? (y/n): n Traceback (most recent call last): File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/app/autogpt/main.py", line 5, in autogpt.cli.main() File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in call return self.main(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke rv = super().invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/app/autogpt/cli.py", line 90, in main run_auto_gpt( File "/app/autogpt/main.py", line 118, in run_auto_gpt cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode)) File "/app/autogpt/plugins.py", line 219, in scan_plugins zipped_module = zipped_package.load_module(str(module.parent)) File "", line 302, in load_module File "plugins/Auto-GPT-Plugins.zip/Auto-GPT-Plugins-master/src/autogpt_plugins/news_search/init.py", line 7, in File "plugins/Auto-GPT-Plugins.zip/Auto-GPT-Plugins-master/src/autogpt_plugins/news_search/news_search.py", line 4, in

duramaxlb7 avatar May 05 '23 23:05 duramaxlb7

Same issue, I tried attaching to the docker container and running a pip install newsapi but that returned another error:

Traceback (most recent call last): File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/app/autogpt/main.py", line 5, in autogpt.cli.main() File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in call return self.main(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke rv = super().invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/app/autogpt/cli.py", line 90, in main run_auto_gpt( File "/app/autogpt/main.py", line 118, in run_auto_gpt cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode)) File "/app/autogpt/plugins.py", line 219, in scan_plugins zipped_module = zipped_package.load_module(str(module.parent)) File "", line 302, in load_module File "plugins/Auto-GPT-Plugins.zip/Auto-GPT-Plugins-master/src/autogpt_plugins/news_search/init.py", line 7, in File "plugins/Auto-GPT-Plugins.zip/Auto-GPT-Plugins-master/src/autogpt_plugins/news_search/news_search.py", line 4, in ImportError: cannot import name 'NewsApiClient' from 'newsapi' (/usr/local/lib/python3.10/site-packages/newsapi/init.py)

dje3392 avatar May 06 '23 16:05 dje3392

When you sign up for an account with News API I get error 500 - https://newsapi.org/

shroomco avatar May 08 '23 09:05 shroomco

I followed these steps someone on discord posted and it solved the issue for me:

Premium Algorithm — 05/04/2023 8:07 PM best bet is to use GPT4 to walk you through it as it was a bit confusing, that being said i added:

COPY requirements.txt /workspace/Auto-GPT/ RUN pip install --no-cache-dir -r requirements.txt newsapi-python RUN pip install lorem to the end of the dockerfile also added:

#NewsAPI newsapi-python

#Lorem lorem==0.1.1

to the requirements file

then you rebuild your image using this command: docker-compose build auto-gpt docker-compose run --rm auto-gpt

Amine-GPT avatar May 08 '23 12:05 Amine-GPT

COPY requirements.txt /workspace/Auto-GPT/ RUN pip install --no-cache-dir -r requirements.txt newsapi-python RUN pip install lorem to the end of the dockerfile also added:

#NewsAPI newsapi-python

#Lorem lorem==0.1.1

to the requirements file

then you rebuild your image using this command: docker-compose build auto-gpt docker-compose run --rm auto-gpt

works for me. a bit of effort to press -n on it but got it running at least.

kevin-huff avatar May 08 '23 23:05 kevin-huff

fixed

ntindle avatar May 14 '23 22:05 ntindle