Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demos broken? #5

Open
irvinebroque opened this issue Mar 12, 2024 · 1 comment
Open

Demos broken? #5

irvinebroque opened this issue Mar 12, 2024 · 1 comment

Comments

@irvinebroque
Copy link
Contributor

npx wrangler@latest dev in each of the demo repos:

FastAPI demo

✘ [ERROR] PythonError: Traceback (most recent call last):

    File "/lib/python312.zip/_pyodide/_base.py", line 629, in pyimport_impl
      res = __import__(stem, fromlist=fromlist)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/session/metadata/worker.py", line 13, in <module>
      from fastapi import FastAPI, Request
    File "/lib/python3.12/site-packages/fastapi/__init__.py", line 7, in <module>
      from .applications import FastAPI as FastAPI
    File "/lib/python3.12/site-packages/fastapi/applications.py", line 16, in <module>
      from fastapi import routing
    File "/lib/python3.12/site-packages/fastapi/routing.py", line 22, in <module>
      from fastapi import params
    File "/lib/python3.12/site-packages/fastapi/params.py", line 5, in <module>
      from fastapi.openapi.models import Example
    File "/lib/python3.12/site-packages/fastapi/openapi/models.py", line 4, in <module>
      from fastapi._compat import (
    File "/lib/python3.12/site-packages/fastapi/_compat.py", line 24, in <module>
      from starlette.datastructures import UploadFile
    File "/lib/python3.12/site-packages/starlette/datastructures.py", line 7, in <module>
      from starlette.concurrency import run_in_threadpool
    File "/lib/python3.12/site-packages/starlette/concurrency.py", line 8, in <module>
      import anyio.to_thread
  ModuleNotFoundError: No module named 'anyio'
  
      at new_error (pyodide-internal:generated/pyodide.asm:18:9998)
      at [object Object]x16c818
      at [object Object]x16c972
      at Module._pythonexc2js (pyodide-internal:generated/pyodide.asm:18:607968)
      at Module.callPyObjectKwargs (pyodide-internal:generated/pyodide.asm:18:64098)
      at Module.callPyObject (pyodide-internal:generated/pyodide.asm:18:65055)
      at Function.apply (pyodide-internal:generated/pyodide.asm:18:79132)
      at Object.apply (pyodide-internal:generated/pyodide.asm:18:77371)
      at Object.pyimport (pyodide-internal:generated/pyodide.asm:18:102887)
      at pyimportMainModule (pyodide:python-entrypoint-helper:104:18)
      at null.<anonymous> (pyodide:python-entrypoint-helper:117:24)
      at async Object.fetch (pyodide:python-entrypoint-helper:126:30)

Langchain

[wrangler:inf] GET / 500 Internal Server Error (4180ms)
✘ [ERROR] PythonError: Traceback (most recent call last):

    File "/lib/python312.zip/_pyodide/_base.py", line 629, in pyimport_impl
      res = __import__(stem, fromlist=fromlist)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/session/metadata/worker.py", line 2, in <module>
      from langchain.chat_models import ChatOpenAI
    File "/lib/python3.12/site-packages/langchain/chat_models/__init__.py", line 23, in <module>
      from langchain.utils.interactive_env import is_interactive_env
    File "/lib/python3.12/site-packages/langchain/utils/__init__.py", line 25, in <module>
      from langchain.utils.math import cosine_similarity, cosine_similarity_top_k
    File "/lib/python3.12/site-packages/langchain/utils/math.py", line 1, in <module>
      from langchain_community.utils.math import (
  ModuleNotFoundError: No module named 'langchain_community'

hello world

[wrangler:inf] GET / 500 Internal Server Error (1932ms)
✘ [ERROR] TypeError: Cannot read properties of undefined (reading 'callRelaxed')

      at Object.fetch (pyodide:python-entrypoint-helper:127:37)
@garrettgu10
Copy link
Owner

Fixed by bumping workerd version in Wrangler & updating the langchain demo to not use the langchain package that imports the world.

Verify with npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8253708866/npm-package-wrangler-5230 dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants