Edward Atkins
Edward Atkins

Reputation: 466

Apache, Flask & Tensorflow - "ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory"

I am trying to deploy a flask (python 3.5) application on an AWS EC2 instance using Apache2 that utilizes the GPU for a tensorflow model (AWS Deep Learning AMI - CUDA 8). And I am receiving the following error:

ImportError: libcusolver.so.8.0: cannot open shared object file: No such file
or directory

I have seen various iterations of this problem across StackOverflow and GitHub including, here: Tensorflow: ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory.

However these do not seem to apply to this case, because I only receive this error when deploying with Apache (it works fine when using Flask's in-built development server, or running the associated scripts manually).

Could anyone provide information as to why I might be receiving this error using Apache only and how I might seek to rectify it?

Upvotes: 0

Views: 337

Answers (1)

Edward Atkins
Edward Atkins

Reputation: 466

I was able to resolve the issue, using some information found here: https://github.com/tensorflow/tensorflow/issues/4547. I was ignorant to the fact that Apache2 would ignore system level environment variables, and that they had to be set separately.

I needed to set export LD_LIBRARY_PATH=/usr/local/cuda/lib64 in the Apache2 Environment Variables config file, which I found at /etc/apache2/envvars.

Upvotes: 2

Related Questions