Панды: не могу импортировать numpy используя mod_wsgi - PullRequest
0 голосов
/ 04 марта 2019

Я установил панд вместе с зависимостями и могу импортировать из командной строки-

[root@ip-172-16-6-131 ~]# python3.6 
Python 3.6.6 (default, Jan 24 2019, 07:48:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> pandas.__version__
'0.23.4'

Другая информация

Version-
Python=3.6.6
Pip=19.0.1
Pandas=0.23.4
Httpd=2.4.6
mod_Wsgi=3.4
OS=CentOS Linux release 7.6.1810 

При получении ошибки при импорте панд с использованием мода wsgi-

ImportError: Missing required dependencies ['numpy']
ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app 
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/var/app/dealer-reco-engine-qa/hello.py", line 22, in hello1
import pandas
File "/usr/local/lib/python3.6/site-packages/pandas/__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))<br> [Mon Mar 04 11:49:59.839292 2019] [:error] [pid 31771] [client ::1:43918] 
ImportError: Missing required dependencies ['numpy']

Numpy также установлен-

import numpy numpy. версия '1.15.4'

Ниже приведен httpd conf file-

    WSGIPythonPath /usr/local/lib/python3.6/site-packages/
    <VirtualHost *>
        ServerName test.com

        ErrorLog "/var/log/httpd/test_error_log"
        CustomLog "/var/log/httpd/test_access_log" combined
        WSGIScriptAlias / /var/app/test-qa/test.wsgi
        WSGIScriptReloading On
        <Directory /var/app/test-qa/>
            Require all granted
        </Directory>
    </VirtualHost>

wsgi file-

    import sys
    sys.path.insert(0, '/path/to/test-qa/')
    from myapp import app as application

cat /path/to/test-qa/my.app

    #!/usr/bin/python
    from flask import Flask
    app = Flask(__name__)

    @app.route("/")
    def test():
        import pandas
        return "Checking pandas if install.."

    if __name__ == "__main__":
        app.run(host='0.0.0.0', port=8000)
...