unclecode / crawl4ai

🔥🕷️ Crawl4AI: Open-source LLM Friendly Web Crawler & Scrapper
Apache License 2.0
7.45k stars 562 forks source link

Docker Issue: ModuleNotFoundError: No module named 'numpy' #96

Open mjtechguy opened 1 week ago

mjtechguy commented 1 week ago

I am running the project as a Docker container and I get "ModuleNotFoundError: No module named 'numpy'".

I followed these instructions to bring it up:

https://crawl4ai.com/mkdocs/installation/

# For other users
docker build -t crawl4ai .

# Run the container
docker run -d -p 8000:80 crawl4ai
Full Installation (All Dependencies and Models)
Process SpawnProcess-175:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
    target(sockets=sockets)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
    return self.real_target(sockets)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 69, in serve
    await self._serve(sockets)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 76, in _serve
    config.load()
  File "/usr/local/lib/python3.10/site-packages/uvicorn/config.py", line 434, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 22, in import_from_string
    raise exc from None
  File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/src/app/main.py", line 22, in <module>
    from crawl4ai.web_crawler import WebCrawler
  File "/usr/src/app/crawl4ai/__init__.py", line 1, in <module>
    from .web_crawler import WebCrawler
  File "/usr/src/app/crawl4ai/web_crawler.py", line 9, in <module>
    from .extraction_strategy import *
  File "/usr/src/app/crawl4ai/extraction_strategy.py", line 12, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Any ideas?

sumeetghumare4 commented 1 week ago

To encounter the error run the following command in terminal: pip install numpy

mjtechguy commented 1 week ago

Thanks. This was the log from inside the container I built when downloading the project. I checked the requirements.txt and it looked like numpy should have already been included.

unclecode commented 1 week ago

@mjtechguy We've fixed this issue, and soon we'll be releasing v0.3.0, which is fully async and has less dependency on other libraries. The Docker image has also been updated.