Skyvern-AI / skyvern

Automate browser-based workflows with LLMs and Computer Vision
https://www.skyvern.com
GNU Affero General Public License v3.0
5.47k stars 395 forks source link

Create a Docker file to make it easier to run Skyvern instances #58

Closed suchintan closed 2 months ago

suchintan commented 4 months ago

Context (https://news.ycombinator.com/item?id=39698546#39700013)

tluyben commented 4 months ago

This somewhat works, however, it tanks with;

Traceback (most recent call last):
  File "/usr/src/app/skyvern/scripts/create_organization.py", line 6, in <module>
    from scripts.create_api_key import create_org_api_token
  File "/usr/src/app/skyvern/scripts/create_api_key.py", line 6, in <module>
    from skyvern.forge.app import DATABASE
  File "/usr/src/app/skyvern/skyvern/forge/app.py", line 4, in <module>
    from skyvern.forge.agent import ForgeAgent
  File "/root/.cache/pypoetry/virtualenvs/skyvern-u6uxTuyl-py3.11/lib/python3.11/site-packages/ddtrace/internal/module.py", line 208, in _exec_module
    self.loader.exec_module(module)
  File "/usr/src/app/skyvern/skyvern/forge/agent.py", line 21, in <module>
    from skyvern.forge.sdk.agent import Agent
  File "/root/.cache/pypoetry/virtualenvs/skyvern-u6uxTuyl-py3.11/lib/python3.11/site-packages/ddtrace/internal/module.py", line 208, in _exec_module
    self.loader.exec_module(module)
  File "/usr/src/app/skyvern/skyvern/forge/sdk/agent.py", line 16, in <module>
    from skyvern.scheduler import SCHEDULER
  File "/root/.cache/pypoetry/virtualenvs/skyvern-u6uxTuyl-py3.11/lib/python3.11/site-packages/ddtrace/internal/module.py", line 208, in _exec_module
    self.loader.exec_module(module)
  File "/usr/src/app/skyvern/skyvern/scheduler.py", line 1, in <module>
    from apscheduler.schedulers.asyncio import AsyncIOScheduler
ModuleNotFoundError: No module named 'apscheduler'

Under Ubuntu without Docker, I get the same error.

FROM python:3.12-bookworm

WORKDIR /usr/src/app

RUN apt -y update
RUN apt install -y lynx wget curl pipx git gnupg2 vim build-essential python3-dev net-tools telnet sudo
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
RUN apt -y update
RUN apt install -y postgresql-14
RUN /etc/init.d/postgresql start
RUN sudo -u postgres createdb skyvern
RUN sudo -u postgres psql -U postgres -c "create user skyvern password 'skyvern';"
RUN sudo -u postgres psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE skyvern TO skyvern;"
RUN pipx ensurepath
RUN pipx install poetry
ENV PATH="/root/.local/bin:${PATH}"

# specific stuff for skyvern;
RUN git clone https://github.com/Skyvern-AI/skyvern.git
WORKDIR /usr/src/app/skyvern

RUN pip3 install apscheduler
RUN cat /etc/hosts|grep -v localhost > /tmp/hosts
RUN echo "127.0.0.1 localhost" >> /tmp/hosts
RUN cp /tmp/hosts /etc/hosts
RUN echo "ENV=local" > .env
RUN echo "OPENAI_API_KEYS=[\"OPENAI_KEY\"]" >> .env
RUN echo "BROWSER_TYPE=\"chromium-headful\"" >> .env
RUN echo "MAX_SCRAPING_RETRIES=0" >> .env
RUN echo "VIDEO_PATH=./videos" >> .env
RUN echo "BROWSER_ACTION_TIMEOUT_MS=5000" >> .env
RUN echo "MAX_STEPS_PER_RUN = 50" >> .env
RUN echo "LOG_LEVEL=INFO" >> .env
RUN echo "DATABASE_STRING=\"postgresql+psycopg://skyvern:skyvern@localhost/skyvern\"" >> .env
RUN echo "PORT=8000" >> .env
RUN echo "ANALYTICS_ID=\"\"" >> .env
#RUN ./setup.sh

CMD [ "bash", "-c", "setup.sh" ]
suchintan commented 4 months ago

@tluyben I think this might be because you're using python 3.12 -- we're unfortunately only compatible with Python 3.11 right now

tluyben commented 4 months ago

Ah, I read it as 3.11 or higher. But that explains it: will try it and get back to you!

suchintan commented 4 months ago

Awesome! I also updated the readme here to emphasize that because it was NOT clear before :joy:

https://github.com/Skyvern-AI/skyvern/pull/64

ykeremy commented 4 months ago

Hey @tluyben, sorry about that! I just merged a fix for that error (https://github.com/Skyvern-AI/skyvern/pull/65), thanks for noticing it and letting us know 🎉

nodox commented 4 months ago

Currently having the python 3.12 issues and its a big hassle to reconfigure my system. We need some dockerfile or ready to go VM to make this more accessible.

tluyben commented 4 months ago

I'll do a pull request ; the above basically works with some cleaning up and 3.11 instead of 3.12.

tluyben commented 4 months ago

Currently having the python 3.12 issues and its a big hassle to reconfigure my system. We need some dockerfile or ready to go VM to make this more accessible.

However @nodox with Poetry installed, you shouldn't have that issue? You can switch to whatever without hassle;

poetry env use 3.11
suchintan commented 3 months ago

Related to https://github.com/Skyvern-AI/skyvern/issues/36

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity.