I have been trying to upload a function that allows me to turn a CSV into a JSON file. The code works but when I try to deploy it to my instance of Appwrite, the build fails.
Here is my function:
from appwrite.client import Clientfrom appwrite.services.storage import Storageimport pandas as pddef main(req, res): file_id = res.payload["fileId"] bucket_id = res.variables.BUCKET_ID api_key = res.variables.API_KEY client = Client().set_endpoint(res.variables.ENDPOINT).set_project(res.variables.PROJECT_ID).set_key(api_key) storage = Storage(client) binary_csv = storage.get_file_view(bucket_id, file_id) data = BytesIO(binary_csv) # type: ignore df = pd.read_csv(data) value = df.to_json(orient="records") return res.json({"message": "Success <200>","payload": value})My requirements.txt:
appwritenumpy>=1.23.0pandas>=1.5.0On the build failure log, this is where it fails
Docker Error: error: subprocess-exited-with-error× pip subprocess to install build dependencies did not run successfully.│ exit code: ╰─> [ lines of output] Collecting setuptools>=.0 Downloading setuptools-65.5.0-py3-none-any.whl ( MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ /1.2 MB MB/s eta :00:00 Collecting wheel Downloading wheel-0.37.1-py2.py3-none-any.whl ( kB) Collecting Cython<,>=.32 Using cached Cython-0.29.32-cp310-cp310-musllinux_1_1_x86_64.whl ( MB) Collecting oldest-supported-numpy>= Downloading oldest_supported_numpy-2022.8.16-py3-none-any.whl ( kB) Collecting numpy==.6 Downloading numpy-1.21.6.zip ( MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ /10.3 MB MB/s eta :00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Building wheels for collected packages: numpy Building wheel for numpy (pyproject.toml): started Building wheel for numpy (pyproject.toml): finished with status 'error' error: subprocess-exited-with-errorIt is using the wrong version of numpy too. Later in the response it shows the actual pip command which does use the right version.
Collecting appwrite Downloading appwrite-1.1.0.tar.gz (13 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done'Collecting numpy>=1.23.0 Downloading numpy-1.23.4.tar.gz (10.7 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 18.8 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done'Collecting pandas>=1.5.0 Downloading pandas-1.5.1.tar.gz (5.2 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.2/5.2 MB 115.3 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'error'Any help would be appreciated.