Jump to content

[Solved] Install ML libraries in Flask website


coronavs

Recommended Posts

Hi,

 

I have developed a web app in Flask that uses machine learning libraries such as Tensorflow, Keras, Scipy etc that need to be installed on the server in order to work.

I followed the tutorial for flask on the gitbook but it is not enough as I need to install additional libraries. 

I hosted on Johnny server and currently I receive http 500 error. 

I have attached the requirement txt file for further detail about the packages.

 

Could someone help me install these libraries or if it is any other way to run it? 

 

Thank you in advance. 

 

requirements.txt

Link to comment
Share on other sites

Hi,

 

thank you for your response.

 

I can see some of the modules are already installed on Johnny's. Although, It would be certainly needed to install the following:

 

  1. Flask-Uploads==0.2.1
  2. Keras==2.4.3

  3. Keras-Preprocessing==1.1.2

  4. opencv-python==4.3.0.36

  5. Pillow==7.2.0 (update)

  6. scikit-learn==0.23.1

  7. scipy==1.4.1 (update)

  8. h5py==2.10.0

  9. tensorboard-plugin-wit==1.7.0

  10. tensorflow==2.2.0

  11. tensorflow-addons==0.10.0

  12. kiwisolver==1.2.0 (update)

  13. opt-einsum==3.2.1

  14. requests==2.24.0(update)

Thank you for your assistance in this matter 

 

 

 

Link to comment
Share on other sites

Thank you Krydos. 

 

I can see them now installed in the list you mentioned. Although, I am having trouble in the imports.

For instance, in the first line of the imports I have tensorflow but the server returns the following: 

 

 

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@coronavs.heliohost.org to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

 

 

 

 

But this is happening for all of the modules I requested to be installed.

When I comment out the imports the app works so I am sure is something wrong with that. 

 

However, I've tested locally and it works fine. 

 

My app runs from the public_html/flask folder. 

Do you have any idea why this is happening? 

 

Thank you

Link to comment
Share on other sites

It looks like there are two solutions to this issue

  • Use an older version of python, such as 3.6, that is compatible with CentOS's older gcc
  • Upgrade CentOS's gcc to a newer version that is compatible with newer versions of python, such as 3.7 that we have installed or even 3.8
Neither of these things are possible because upgrading gcc would break many other things on the server, and hundreds of other people are using already using python 3.7 so downgrading it would likely break everyone else's code.

 

This won't work on Tommy either, because he has the same gcc version and python 3.7 too. Ricky has flask on python 2.7 so that probably isn't an option either. It looks like the only options left for you is

  • Figure out how to do what you're trying to do without tensorflow
  • Switch to a vps https://www.heliohost.org/vps/ where you will have root command line access to install whatever versions of gcc and python and tensorflow that will work together.
Link to comment
Share on other sites

As I am understanding right, you are describing that the gcc is incompatible with CentOs version that is currently on?

Is there any way to work on virtual environment?  that would fix the issue.

 

In regards to the option you offer:

unfortunately, there is no way to work without tensorflow at the moment while the latter option can't be considered, thank you. 

Edited by coronavs
Link to comment
Share on other sites

As I am understanding right, you are describing that the gcc is incompatible with CentOs version that is currently on?

No, CentOS ships with a fairly old version of gcc. The version of gcc that we're currently using is fully compatible with CentOS, but if I was to update gcc it wouldn't be anymore.

 

Is there any way to work on virtual environment?  that would fix the issue.

No.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...