Scrapegraphai won't install?

ImportError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:

File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling
    result = func()
             ^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec
    exec(code, module.__dict__)
File "/mount/src/scrapegraphai-scrape-portfolio/scrapePortfolio.py", line 3, in <module>
    from scrapegraphai.graphs import SmartScraperGraph
File "/home/adminuser/venv/lib/python3.12/site-packages/scrapegraphai/graphs/__init__.py", line 6, in <module>
    from .base_graph import BaseGraph
File "/home/adminuser/venv/lib/python3.12/site-packages/scrapegraphai/graphs/base_graph.py", line 8, in <module>
    from ..integrations import BurrBridge
File "/home/adminuser/venv/lib/python3.12/site-packages/scrapegraphai/integrations/__init__.py", line 5, in <module>
    from .burr_bridge import BurrBridge
File "/home/adminuser/venv/lib/python3.12/site-packages/scrapegraphai/integrations/burr_bridge.py", line 15, in <module>
    raise ImportError("burr package is not installed. Please install it with 'pip install scrapegraphai[burr]'")

There is no [burr] as can be seen on scrapegraphai documentation.
My requiremnents.txt for my app is

scrapegraphai
playwright

and my app

import streamlit as st
from langchain_openai import AzureChatOpenAI, AzureOpenAIEmbeddings
from scrapegraphai.graphs import SmartScraperGraph

# Function to load environment variables and initialize the model instances
def initialize_models():
    llm_model_instance = AzureChatOpenAI(
        openai_api_version=st.secrets["AZURE_OPENAI_API_VERSION"],
        azure_deployment=st.secrets["AZURE_OPENAI_CHAT_DEPLOYMENT_NAME"],
    )

    embedder_model_instance = AzureOpenAIEmbeddings(
        azure_deployment=st.secrets["AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME"],
        openai_api_version=st.secrets["AZURE_OPENAI_API_VERSION"],
    )

    graph_config = {
        "llm": {"model_instance": llm_model_instance},
        "embeddings": {"model_instance": embedder_model_instance}
    }
    
    return graph_config

# Function to create and run the SmartScraperGraph
def run_smart_scraper(prompt, source_url, config):
    smart_scraper_graph = SmartScraperGraph(
        prompt=prompt,
        source=source_url,
        config=config
    )
    
    result = smart_scraper_graph.run()
    return result

# Streamlit app
def main():
    st.title("Smart Scraper with Azure OpenAI")

    # Labeled Text Box for User Input
    st.subheader("Enter the details below:")
    
    # User input for the prompt
    prompt = st.text_input(
        label="Enter your query or prompt:",
        value="",  # Default value is empty, allowing user to type their query
        placeholder="Type your question here..."  # Placeholder text for guidance
    )
    
    # User input for the source URL
    source_url = st.text_input(
        label="Enter the source URL:",
        value="https://nyck33.github.io/2021_portfolio/"
    )
    
    # Button to run the Smart Scraper
    if st.button("Run Smart Scraper"):
        if prompt.strip() == "":  # Check if prompt is empty or only whitespace
            st.error("You forgot to write a question!")  # Display error message in red
        elif source_url.strip() == "":  # Check if source URL is empty or only whitespace
            st.error("You forgot to enter the source URL!")  # Display error message in red
        else:
            # Initialize models
            config = initialize_models()

            # Run the SmartScraperGraph
            result = run_smart_scraper(prompt, source_url, config)

            # Display the result as a formatted JSON dictionary
            st.subheader("Scraped Data:")
            st.json(result)

if __name__ == "__main__":
    main()

Indeed there is.
https://scrapegraph-ai.readthedocs.io/en/latest/scrapers/graph_config.html#burr-integration

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.