crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

Installation issue

Open zukangy opened this issue 2 years ago • 3 comments

Hi, I am using a silicon Mac and used the pip install approach to install the package into a local virtual environment.

The issue is that after

pip install "crawl4ai[all] @ git+https://github.com/unclecode/crawl4ai.git",

this command crawl4ai-download-models threw an error:

FileNotFoundError: [Errno 2] No such file or directory: '.../.env/lib/python3.10/site-packages/crawl4ai/models/onnx/model.onnx'.

I checked the package inside the virtual environment as shown in the screenshot, and it is missing the ./models/ folder. Screenshot 2024-05-30 at 4 25 03 PM

I fixed it by manually copying and pasting that folder from github repo to the local package, but is there a way to fix this issue without the extra work?

To give extra information, the virtual environment is created using pyenv at python 3.10.13.

Thanks!

zukangy avatar May 30 '24 23:05 zukangy

@zukangy Thanks for flagging this! Issue is fixed & code is now updated in the repo 🎉 It was a rookie mistake - forgot to remove the model from my local machine while testing, so the download feature never got tested 🤦‍♂️ Glad it's sorted now!

unclecode avatar May 31 '24 10:05 unclecode

@unclecode Thank you for the instant fix!

Quick question, I tried the example of using the javascript code to click the load more button. But in the case where I want to click the button multiple times, should I just use a for loop? or what would be the best practice with your package?

zukangy avatar May 31 '24 17:05 zukangy

@zukangy Good question! Right now, I only run the script once before crawling starts. I'd recommend iterating carefully: first, click the button programmatically, then wait for the page to load before clicking again. You can also put a sleep between each click. This works better than a simple for loop. This week, I added the option to pass a list of JS scripts, running one after the other. When one finishes, the next can be passed.

unclecode avatar Jun 01 '24 09:06 unclecode