首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尽管我明确地定义了依赖项,但Appwrite函数构建仍然无法安装依赖项。

尽管我明确地定义了依赖项,但Appwrite函数构建仍然无法安装依赖项。
EN

Stack Overflow用户
提问于 2022-10-22 20:05:00
回答 1查看 71关注 0票数 0

我一直试图上传一个允许我将CSV转换成JSON文件的函数。代码可以工作,但是当我尝试将它部署到AppWrit时,构建会失败。

这是我的功能:

代码语言:javascript
复制
from appwrite.client import Client
from appwrite.services.storage import Storage
import pandas as pd


def 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
})

我的requirements.txt:

代码语言:javascript
复制
appwrite
numpy>=1.23.0
pandas>=1.5.0

在构建失败日志中,这是它失败的地方。

代码语言:javascript
复制
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-error

它也使用了错误的numpy版本。在后面的响应中,它显示了实际的pip命令,它确实使用了正确的版本。

代码语言:javascript
复制
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'

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2022-10-24 00:47:36

不幸的是,您不能在Appwrite函数中使用熊猫,因为安装numpy似乎需要一些在开放运行时中不可用的OS包。有关此问题的更新,您可以跟踪问题。

对于基本的CSV到JSON任务,不如使用标准的csv包而不是熊猫?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74166731

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档