Paddle avx_supported function in fluid core fails on linux when called from systemd context

hrirmatl  于 2021-12-07  发布在  Java
关注(0)|答案(4)|浏览(401)

I had paddleocr example served from a Flask application on Ubuntu 18.04. The Flask application was hosted on Gunicorn and added as a systemd service.
When starting the service, it was failing due to issue "modulenotfounderror: no module named 'paddle.fluid.core_noavx'". After analyzing the issue, it turned out that paddle was not detecting the support of AVX on the machine, when it is actually supported.

It turned out that paddle.fluid.core avx_supported function is reading the avx support using this method.

has_avx = os.popen('cat /proc/cpuinfo | grep -i avx').read() != ''

When running from the systemd context, the above function is failing, when looked at the syslog I found. "/bin/sh 1: cat not found" same for grep. I had to change the line above to use absolute path to the command instead.

has_avx = os.popen('/bin/cat /proc/cpuinfo | /bin/grep -i avx').read() != ''

Wanted to share my finding, not sure if others faced the same issue. Not sure if there is another way to solve this when setting up the paddle or the systemd service.

gmxoilav

gmxoilav1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

cbeh67ev

cbeh67ev2#

你好,应该是你机器不支持avx指令集但是安装的是带avx的paddle版本,可以卸载之后重新安装一下paddle试下,或者使用https://www.paddlepaddle.org.cn/documentation/docs/zh/install/Tables.html#whl-release 这里的版本试下

zf9nrax1

zf9nrax13#

The machine does support the AVX, as I mentioned above it worked when I fixed the function that checks for the avx on the machine. Please double check my original post.

y53ybaqx

y53ybaqx4#

Your environment variable is are set incorrectly. Please print "os.environ['PATH']", "/usr/bin" should be in the output.
环境变量PATH被设置错误,"/usr/bin" 应该被包含在 "os.environ['PATH']"的执行结果中。

相关问题