有下面这个报错,请问是怎么回事?
依赖是在本地的开发环境内将依赖装到入口文件同级目录,然后整体打包成zip传上去。本地的开发环境是mac,用的python3.9,新建函数的时候选的是pathon3.9, 但是报错一直是pathon 3.7。
"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:
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'"
安装依赖的话,要保证安装依赖时python版本和线上选的一致。还有就是有些依赖windows和mac上安装是不行的,必须要在linux环境安装。然后,可以点一下代码页面的“编辑层”,然后添加一个层,可以在线构建一个依赖层。
此答案来自钉钉群“阿里函数计算官网客户”
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。