Back

Local Function stops on hot reload

  • 0
  • Self Hosted
Overlight Dev
21 Sep, 2024, 14:53

After the hot reload the function stops and need to reload with this error

TL;DR
Developers face various errors while working with hot reload, including missing compiler files (cc, gcc, clang, nvc, pgcc, icc, icx) and Python module (Flask). This leads to issues with hot-swapping functions and preparing metadata. Make sure to define the Flask version correctly in requirements.txt. To resolve the hot reload stopping issue, consider adjusting dependencies and ensuring Flask is correctly included in the project structure.
ZachHandley
21 Sep, 2024, 18:14

is this python?

Overlight Dev
21 Sep, 2024, 23:12

Yes

ZachHandley
22 Sep, 2024, 00:12

I would add flask to the requirements.txt

ZachHandley
22 Sep, 2024, 00:12

usually they add flask

Overlight Dev
22 Sep, 2024, 00:46

Ok I will try it

Overlight Dev
22 Sep, 2024, 06:24

appwrite==5.0.3 pykalman=0.9.7 numpy=1.26.2 python-json-logger==2.0.4 requests=2.32.3 hmmlearn=0.3.2 Flask==1.0.2

didn't help

bluesky
22 Sep, 2024, 07:03

Can I see your folder structure?

Overlight Dev
22 Sep, 2024, 08:29
ZachHandley
22 Sep, 2024, 16:53

<@254968266462593026> and if you run main.py it works?

Overlight Dev
23 Sep, 2024, 04:20

yes

darShan
23 Sep, 2024, 04:39

possibly its not the function missing Flask, its the runtime itself missing the dependency it seems. cc <@287294735054274560> ideas?

darShan
23 Sep, 2024, 04:39

python runtime also uses Flask=2.0.1, not sure if thats relevant.

Overlight Dev
23 Sep, 2024, 05:43

current way is to stop and restart the function in local

Overlight Dev
24 Sep, 2024, 19:10

any workaround or solutions

Info: Hot-swapping function.. Files with change are src\main.py Preparing for start ... ✓ Success: Visit http://localhost:3000/ to execute your function. Starting ... Traceback (most recent call last): File "/usr/local/server/src/server.py", line 4, in <module> from flask import Flask, request, Response as FlaskResponse ModuleNotFoundError: No module named 'flask'

Meldiron
25 Sep, 2024, 10:20

When I tried to use your requirements.txt, I faced this error during build:

TypeScript

  Preparing metadata (pyproject.toml): started

  Preparing metadata (pyproject.toml): finished with status 'error'

  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      + meson setup /tmp/pip-install-_d9jrzfm/scipy_3c6ad6120afb4ad38b35924c90b89290 /tmp/pip-install-_d9jrzfm/scipy_3c6ad6120afb4ad38b35924c90b89290/.mesonpy-0a9y32uq -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-_d9jrzfm/scipy_3c6ad6120afb4ad38b35924c90b89290/.mesonpy-0a9y32uq/meson-python-native-file.ini
      The Meson build system
      Version: 1.5.2
      Source dir: /tmp/pip-install-_d9jrzfm/scipy_3c6ad6120afb4ad38b35924c90b89290
      Build dir: /tmp/pip-install-_d9jrzfm/scipy_3c6ad6120afb4ad38b35924c90b89290/.mesonpy-0a9y32uq
      Build type: native build
      Project name: scipy
      Project version: 1.13.1
      
      ../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
      The following exception(s) were encountered:
      Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
      Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
      Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
      Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
      Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
      Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
      Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"
      
      A full log can be found at /tmp/pip-install-_d9jrzfm/scipy_3c6ad6120afb4ad38b35924c90b89290/.mesonpy-0a9y32uq/meson-logs/meson-log.txt
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

What version of Python are you using?

Meldiron
25 Sep, 2024, 10:21

With that said, I am facing problem with hot-swapping too:

TypeScript
Info: Hot-swapping function.. Files with change are src/main.py
Error: ENOENT: no such file or directory, stat '/Users/matejbaco/Desktop/delme/ppp/functions/66f3e3620000e6ea13d4/.appwrite/hot-swap/runtime-env/bin/python'
    at Object.statSync (node:fs:1659:25)
    at getAllFiles (/Users/matejbaco/.nvm/versions/node/v21.7.1/lib/node_modules/appwrite-cli/lib/utils.js:12:16)
    at getAllFiles (/Users/matejbaco/.nvm/versions/node/v21.7.1/lib/node_modules/appwrite-cli/lib/utils.js:13:27)
    at getAllFiles (/Users/matejbaco/.nvm/versions/node/v21.7.1/lib/node_modules/appwrite-cli/lib/utils.js:13:27)
    at getAllFiles (/Users/matejbaco/.nvm/versions/node/v21.7.1/lib/node_modules/appwrite-cli/lib/utils.js:13:27)
    at getAllFiles (/Users/matejbaco/.nvm/versions/node/v21.7.1/lib/node_modules/appwrite-cli/lib/utils.js:13:27)
    at EventEmitter.<anonymous> (/Users/matejbaco/.nvm/versions/node/v21.7.1/lib/node_modules/appwrite-cli/lib/commands/run.js:258:37) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/Users/matejbaco/Desktop/delme/ppp/functions/66f3e3620000e6ea13d4/.appwrite/hot-swap/runtime-env/bin/python'
}
Meldiron
25 Sep, 2024, 10:22

Let's please open GitHub issue for this 🙏

Overlight Dev
25 Sep, 2024, 12:47

ok , But I am using the ML runtime

Overlight Dev
25 Sep, 2024, 12:48

this error dont not come in the ML runtime

Running cc --version gave "[Errno 2] No such file or directory: 'cc'" Running gcc --version gave "[Errno 2] No such file or directory: 'gcc'" Running clang --version gave "[Errno 2] No such file or directory: 'clang'" Running nvc --version gave "[Errno 2] No such file or directory: 'nvc'" Running pgcc --version gave "[Errno 2] No such file or directory: 'pgcc'" Running icc --version gave "[Errno 2] No such file or directory: 'icc'" Running icx --version gave "[Errno 2] No such file or directory: 'icx'"

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