Back

Using Appwrite SDK for deploying function not installing requirements.txt

  • 0
  • Functions
  • Cloud
my_variable
6 Nov, 2023, 04:56

Traceback (most recent call last): File "/usr/local/server/src/server.py", line 165, in handler output = await asyncio.wait_for(execute(context), timeout=safeTimeout) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for return fut.result() File "/usr/local/server/src/server.py", line 150, in execute userModule = importlib.import_module("function." + userPath) File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/usr/local/server/src/function/src/index.py", line 1, in <module> from appwrite.client import Client ModuleNotFoundError: No module named 'appwrite'

TL;DR
The user is having trouble using the Appwrite SDK to deploy a function. They are receiving a 'No module named' error. They have checked the project structure, build settings, and build logs but have not found any errors. The solution to this issue is to make sure that the 'appwrite' module is added to the 'requirements.txt' file.
ideclon
6 Nov, 2023, 10:21

Check Deployments > Build logs. Are there any errors there? If not, check Settings > Build Settings. Is there anything there?

my_variable
6 Nov, 2023, 11:57

no error in build

my_variable
6 Nov, 2023, 11:58

build settings

ideclon
6 Nov, 2023, 12:24

Can we see your build logs, please?

my_variable
8 Nov, 2023, 07:28
ideclon
8 Nov, 2023, 12:55

Well, I don’t see Appwrite there. Did you definitely at it to your requirements.txt?

my_variable
8 Nov, 2023, 13:28

sorry bro now I am using github and giving it build commands now its showing this Error

Traceback (most recent call last): File "/usr/local/server/src/server.py", line 165, in handler output = await asyncio.wait_for(execute(context), timeout=safeTimeout) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for return fut.result() File "/usr/local/server/src/server.py", line 150, in execute userModule = importlib.import_module("function." + userPath) File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'function.index'

ideclon
8 Nov, 2023, 13:30

Well, what’s on server.py:165?

my_variable
8 Nov, 2023, 13:31

what that means

ideclon
8 Nov, 2023, 13:34

What is in the file server.py on line 165

my_variable
8 Nov, 2023, 13:35

i dont have any server.py file but it can be from module

ideclon
8 Nov, 2023, 13:38

Could I please see your project structure. I don’t really know Python structures off the top of my head

my_variable
8 Nov, 2023, 13:41

yes why not Its here

ideclon
8 Nov, 2023, 14:02

Oh, I think I see. In your index.py, you declare def main(…):, right? Try change that to def index

my_variable
8 Nov, 2023, 14:04

let me try

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more