在apache服务器上导入 pandas 导致超时错误 [英] Import Pandas on apache server causes timeout error

查看:190
本文介绍了在apache服务器上导入 pandas 导致超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django项目在Apache服务器上工作。



我安装了大熊猫,并希望使用它开始操纵数据 - 但是奇怪的是发生了。



随着我在生产环境中使用 import pandas ,服务器将挂断(一段时间后)抛出408超时错误。



我可以注释掉 pandas 部分,服务器正常响应而无问题。我不能在django的开发环境或命令行界面中重新创建它。



这里是 httpd-app.conf file:

  Alias / tooltrack / staticC:/ Users / myfolder / Bitnami Django Stack Projects / tooltrack / static /
< DirectoryC:/ Users / myfolder / Bitnami Django Stack Projects / tooltrack / static />
选项+ MultiViews
AllowOverride全部
< IfVersion< 2.3>
订单允许,拒绝
允许从所有
< / IfVersion>
< IfVersion> = 2.3>
要求全部授予
< / IfVersion>

< IfVersion< 2.3>
订单允许,拒绝
允许从所有
< / IfVersion>
< IfVersion> = 2.3>
要求全部授予
< / IfVersion>
< / Directory>


WSGIScriptAlias /'C:/ Users / myfolder / Bitnami Django Stack projects / tooltrack / tooltrack / wsgi.py'

< DirectoryC: Users / myfolder / Bitnami Django Stack projects / tooltrack / tooltrack>
选项+ MultiViews
AllowOverride全部
< IfVersion< 2.3>
订单允许,拒绝
允许从所有
< / IfVersion>
< IfVersion> = 2.3>
要求全部授予
< / IfVersion>

< IfVersion< 2.3>
订单允许,拒绝
允许从所有
< / IfVersion>
< IfVersion> = 2.3>
要求全部授予
< / IfVersion>
< / Directory>

< DirectoryC:/ Users / myfolder / Bitnami Django Stack projects / tooltrack>
选项+ MultiViews
AllowOverride全部
< IfVersion< 2.3>
订单允许,拒绝
允许从所有
< / IfVersion>
< IfVersion> = 2.3>
要求全部授予
< / IfVersion>
< / Directory>

由于这一点,我知道它挂在大熊猫的进口上:

  def panda_dataframe_r():
print'importing pandas'+ str(timezone.now())
import pandas
打印'import done'+ str(timezone.now())

我可以看到在日志中导入熊猫,但是没有以下导入完成



任何帮助非常感谢!!

解决方案

尝试添加:

  WSGIApplicationGroup%{GLOBAL} 

需要在Python子解释器中不起作用。该指令将强制使用主要的口译员环境。


I've got a Django project working on an Apache server.

I installed pandas and want to use it to start manipulating data - however something odd is happening.

Anytime I use the import pandas on the production environment, the server will hang up and (after a while) throw a 408 timeout error.

I can comment out the pandas portion and the server responds normally without issue. I can't recreate it in the development environment or command line interface with django.

Here are the httpd-app.conf file:

Alias /tooltrack/static "C:/Users/myfolder/Bitnami Django Stack Projects/tooltrack/static/"
<Directory "C:/Users/myfolder/Bitnami Django Stack Projects/tooltrack/static/">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.3>
    Require all granted
</IfVersion>

<IfVersion < 2.3 >
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.3>
    Require all granted
</IfVersion> 
</Directory>


WSGIScriptAlias / 'C:/Users/myfolder/Bitnami Django Stack projects/tooltrack/tooltrack/wsgi.py'

<Directory "C:/Users/myfolder/Bitnami Django Stack projects/tooltrack/tooltrack">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.3>
    Require all granted
</IfVersion>

<IfVersion < 2.3 >
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.3>
    Require all granted
</IfVersion> 
</Directory>

<Directory "C:/Users/myfolder/Bitnami Django Stack projects/tooltrack">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.3>
    Require all granted
</IfVersion>
</Directory>

I know its hanging up on the import of pandas due to this:

def panda_dataframe_r():
print 'importing pandas ' + str(timezone.now())
import pandas
print 'import done ' + str(timezone.now())

I can see the importing pandas in the log, however no following import done

Any help is greatly appreciated!!

解决方案

Try adding:

WSGIApplicationGroup %{GLOBAL}

Various of the scientific packages that it is going to need will not work in Python sub interpreters. That directive will force the use of the main interpreter context.

这篇关于在apache服务器上导入 pandas 导致超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆