有下面这个报错,请问是怎么回事?

有下面这个报错,请问是怎么回事?

依赖是在本地的开发环境内将依赖装到入口文件同级目录,然后整体打包成zip传上去。本地的开发环境是mac,用的python3.9,新建函数的时候选的是pathon3.9, 但是报错一直是pathon 3.7。

提问4.png

"The function either cannot be started or exited. ContainerStartDuration: 2 seconds.Function instance exited unexpected(code 1) with start command 'python main.py ' in 2.182 seconds. Logs:Traceback (most recent call last): File "/code/numpy/core/init.py", line 23, in from . import multiarray File "/code/numpy/core/multiarray.py", line 10, in from . import overrides File "/code/numpy/core/overrides.py", line 6, in from numpy.core._multiarray_umath import ( ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 2, in from app.roi_forecast import Forecast File "/code/app/roi_forecast.py", line 1, in from app.handler.roi_func_handler import RoiFuncHandler File "/code/app/handler/roi_func_handler.py", line 2, in from app.mathlib.roi_func import RoiMathFunc File "/code/app/mathlib/roi_func.py", line 1, in import numpy as np File "/code/numpy/ init.py", line 140, in from . import core File "/code/numpy/core/ init.py", line 49, in raise ImportError(msg) ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  • The Python version is: Python3.7 from "/usr/local/bin/python"
  • The NumPy version is: "1.23.0"

and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'"

展开
收起
云上静思 2022-07-26 13:04:02 787 分享 版权
1 条回答
写回答
取消 提交回答
  • 安装依赖的话,要保证安装依赖时python版本和线上选的一致。还有就是有些依赖windows和mac上安装是不行的,必须要在linux环境安装。然后,可以点一下代码页面的“编辑层”,然后添加一个层,可以在线构建一个依赖层。

    此答案来自钉钉群“阿里函数计算官网客户”

    2022-07-26 13:59:29
    赞同 展开评论
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

收录在圈子:
+ 订阅
阿里云 云原生应用平台 肩负阿里巴巴集团基础设施云化以及核心技术互联网化的重要职责,致力于打造稳定、标准、先进的云原生产品,成为云原生时代的引领者,推动行业全面想云原生的技术升级,成为阿里云新增长引擎。商业化产品包括容器、云原生中间件、函数计算等。
还有其他疑问?
咨询AI助理