Python / AWS / conda-ImportError:无法导入名称“ multiarray”

时间:2018-07-18 13:25:57

标签: python apache numpy mod-wsgi miniconda

我正在尝试使用Apache和mod_wsgi在AWS EC2中部署基于Flask的应用程序(Python 3),并将所有必需的软件包安装在miniconda环境中。

下面您可以找到我的app.wsgi文件:

import sys
import logging
import site

site.addsitedir('/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/')
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/html/flaskapp/")
sys.stdout = sys.stderr

from app import app as application

另外,这是我的Apache配置文件:

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

WSGIDaemonProcess flaskapp threads=5 python-home=/home/ubuntu/miniconda3/envs/app_env
WSGIScriptAlias / /var/www/html/flaskapp/app.wsgi

<Directory flaskapp>
        WSGIProcessGroup flaskapp
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

但是,当我重新加载服务器时,仍然出现相同的错误:

[Wed Jul 18 12:24:12.897534 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] mod_wsgi (pid=10224): Target WSGI script '/var/www/html/flaskapp/app.wsgi' cannot be loaded as Python module., referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.897592 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] mod_wsgi (pid=10224): Exception occurred processing WSGI script '/var/www/html/flaskapp/app.wsgi'., referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900007 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] Traceback (most recent call last):, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900033 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/numpy/core/__init__.py", line 16, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900045 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from . import multiarray, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900062 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] ImportError: cannot import name 'multiarray', referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900072 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] , referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900075 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] During handling of the above exception, another exception occurred:, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900078 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] , referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900083 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] Traceback (most recent call last):, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900171 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/var/www/html/flaskapp/app.wsgi", line 10, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900176 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from app import app as application, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900181 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/var/www/html/flaskapp/app.py", line 4, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900184 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     app = create_app(), referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900189 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/var/www/html/flaskapp/app/__init__.py", line 33, in create_app, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900192 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from app.data import bp as data_bp, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900197 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/var/www/html/flaskapp/app/data/__init__.py", line 18, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900200 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from app.data import views, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900205 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/var/www/html/flaskapp/app/data/views.py", line 7, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900207 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from app.lca import mongo, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900212 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/var/www/html/flaskapp/app/lca/__init__.py", line 3, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900215 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     import brightway2 as bw2, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900223 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/brightway2/__init__.py", line 2, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900226 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from bw2data import *, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900231 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/bw2data/__init__.py", line 33, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900234 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from .project import projects, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900239 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/bw2data/project.py", line 9, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900242 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from .utils import python_2_unicode_compatible, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900246 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/bw2data/utils.py", line 19, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900249 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     import stats_arrays as sa, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900254 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/stats_arrays/__init__.py", line 5, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900257 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from .distributions import *, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900262 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/stats_arrays/distributions/__init__.py", line 1, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900265 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from .base import UncertaintyBase, BoundedUncertaintyBase, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900270 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/stats_arrays/distributions/base.py", line 5, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900273 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from ..utils import one_row_params_array, construct_params_array, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900277 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/stats_arrays/utils.py", line 3, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900280 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     import numpy as np, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900287 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900290 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from . import add_newdocs, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900295 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900298 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from numpy.lib import add_newdoc, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900302 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900305 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     from .type_check import *, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900310 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900313 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     import numpy.core.numeric as _nx, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/    
[Wed Jul 18 12:24:12.900318 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]   File "/home/ubuntu/miniconda3/envs/app_env/lib/python3.6/site-packages/numpy/core/__init__.py", line 26, in <module>, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900321 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351]     raise ImportError(msg), referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900336 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] ImportError: , referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900352 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] Importing the multiarray numpy extension module failed.  Most, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900355 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] likely you are trying to import a failed build of numpy., referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900357 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] If you're working with a numpy git repo, try `git clean -xdf` (removes all, referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900360 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] files not under version control).  Otherwise reinstall numpy., referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900362 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] , referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900365 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] Original error was: cannot import name 'multiarray', referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/
[Wed Jul 18 12:24:12.900369 2018] [wsgi:error] [pid 10224:tid 140691482736384] [client 89.115.58.201:23351] , referer: http://ec2-52-47-138-159.eu-west-3.compute.amazonaws.com/

我已经尝试过多次重新安装numpy并创建一个新的conda环境,但是问题似乎仍然存在……有人可以帮助我吗?

谢谢!

0 个答案:

没有答案