开发者社区 > 云原生 > 正文

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

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

依赖是在本地的开发环境内将依赖装到入口文件同级目录,然后整体打包成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 757 0
1 条回答
写回答
取消 提交回答
  • 安装依赖的话,要保证安装依赖时python版本和线上选的一致。还有就是有些依赖windows和mac上安装是不行的,必须要在linux环境安装。然后,可以点一下代码页面的“编辑层”,然后添加一个层,可以在线构建一个依赖层。

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

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

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

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载