Conflict between Cloudflare Workers checks & Cloudflare docs

I'm using Python for my Worker, and This Cloudflare page described that I can use aiohttp package, but when i include that package along with fastapi in requirements.txt, I have the error: " found in requirements.txt. Note that requirements.txt should contain package names only, not version specifiers. I tried many ways to remove the error: - Remove the requirements.txt, after that my Worker return ModuleNotFoundError error - Add packages back requirements.txt (or even empty the file), after that Wrangler still said " found in requirements.txt. Note that requirements.txt should contain package names only, not version specifiers. - Try to ignore the above error, now Cloudflare Workers return error You cannot yet deploy Python Workers that depend on packages defined in requirements.txt. But that Cloudflare page link above has intruction for the use of requirements.txt. So how can I use packages that supported by that page (fastapi and aiohttp)?
No description
9 Replies
Dullaz
Dullazā€¢6mo ago
Python Workers are in open beta.
You can currently only use built-in packages in local development. Support for deploying packages with a requirements.txt file is coming soon.
Python Workers are in open beta.
You can currently only use built-in packages in local development. Support for deploying packages with a requirements.txt file is coming soon.
What do your imports look like? You shouldn't need a requirements.txt file to import the built-in packages
Ankita Tudubucket
Ankita Tudubucketā€¢6mo ago
Thanks for your very fast help! And this is how I import modules in my code:
No description
Dullaz
Dullazā€¢6mo ago
can you try
from fastapi import FastAPI, Request
from fastapi import FastAPI, Request
instead?
Ankita Tudubucket
Ankita Tudubucketā€¢6mo ago
I tried it
No description
Dullaz
Dullazā€¢6mo ago
Interessant - I'm giving it a spin locally now yup, I'm running into the same issue when deploying the CloudFlare examples from https://developers.cloudflare.com/workers/languages/python/packages/fastapi#get-started
Ankita Tudubucket
Ankita Tudubucketā€¢6mo ago
lol I have no idea why šŸ˜¢
Dullaz
Dullazā€¢6mo ago
I think they just aren't ready yet - it does seem to imply that fastapi is a built-in package but maybe it isnt yet for now i guess developing it locally is the only option
Ankita Tudubucket
Ankita Tudubucketā€¢6mo ago
Okay ty
Dullaz
Dullazā€¢6mo ago
GitHub
šŸ› BUG: Python workers cannot deploy correctly when using FastAPI Ā· ...
Which Cloudflare product(s) does this pertain to? Workers for Platforms What version(s) of the tool(s) are you using? wrangler 3.50.0 What version of Node are you using? 21.7.2 What operating syste...
Want results from more Discord servers?
Add your server