Module installation error (Error installing requirements.)

Good evening
I receive the following error in the cloud console, trying to reboot the app. ( Error installing requirements.)I tried adding lxml to the requirements before anything else - > same error. Alas, this venerable forum was not much of a help. Any assistance will be VERY appreciated!

  1. Publicly deployed app link: https://stockpredictio.streamlit.app/.
  2. Github link including requirements: GitHub - alex-platonov/stock_prediction: Stock prediction web app using ML
  3. Error text:
Collecting lxml
  Downloading lxml-5.0.0.tar.gz (3.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 67.4 MB/s eta 0:00:00[2023-12-29 23:12:16.140463] 
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      /tmp/pip-install-u6ri47x_/lxml_ef913bea948448b6941de9b549d33c7f/setup.py:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        import pkg_resources
      Building lxml version 5.0.0.
      Building without Cython.
      Error: Please make sure the libxml2 and libxslt development packages are installed.
      [end of output]
  1. Streamlit (1.29.0) and Python (3.11)

Hi there. I had the same issue with my app when I updated and rebooted it. It would not install lxml-5.0.0.

The solution: downgrade the lxml package in the requirements.txt file.

I used lxml==4.6.2 and now my app works without a hitch (well, there are hitches, but those are due to my terrible coding skills)

Hope this helps.

Thank u Tony! Specifying the lxml version really helped with prerequisite installation, however now there is an issu with keras module:

2023-12-30 10:41:45.375 503 GET /script-health-check (10.12.194.147) 976.90ms

2023-12-30 10:41:49.941 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/stock_prediction/stock_prediction.py", line 9, in <module>

    model = load_model('Stock_Predictions_Model.keras')

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_api.py", line 254, in load_model

    return saving_lib.load_model(

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_lib.py", line 281, in load_model

    raise e

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_lib.py", line 269, in load_model

    _load_state(

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_lib.py", line 466, in _load_state

    _load_container_state(

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_lib.py", line 534, in _load_container_state

    _load_state(

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_lib.py", line 457, in _load_state

    _load_state(

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/saving/saving_lib.py", line 435, in _load_state

    trackable.load_own_variables(weights_store.get(inner_path))

  File "/home/adminuser/venv/lib/python3.9/site-packages/keras/src/engine/base_layer.py", line 3531, in load_own_variables

    raise ValueError(

ValueError: Layer 'lstm_cell' expected 3 variables, but received 0 variables during loading. Expected: ['lstm_8/lstm_cell/kernel:0', 'lstm_8/lstm_cell/recurrent_kernel:0', 'lstm_8/lstm_cell/bias:0']

2023-12-30 10:41:50.473 503 GET /script-health-check (10.12.194.147) 1046.16ms

Hello Alexander,

Were you able to solve your problem? From the example given, it seems you are loading weights into the LSTM layer but the saved model does not have the same number of weights. Can you check your saved model to be sure?