Skip to content

Dash and libxml2 upgrades break web app #103

Description

@clegaspi

With dash > 3.0

(saml_env) ❰redacted❙~❱✔≻ saml_web_app                              17:41:53
Browser should open shortly after server starts. If webpage does not load, refresh the page.
NOTE: Use Ctrl+C to stop the web server when finished. Closing the webpage will not stop the server!

--keep-alive was not specified, so the web server will stop after 30 minutes.

Traceback (most recent call last):
  File "/Users/redacted/saml_env/bin/saml_web_app", line 8, in <module>
    sys.exit(start_web_app_from_cli())
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/cli_hook.py", line 78, in start_web_app_from_cli
    web_cli(sys.argv[1:])
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/cli_hook.py", line 72, in web_cli
    run_web_app(host=parsed_args.host, port=parsed_args.port, server_timeout=server_timeout)
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/run.py", line 36, in run_web_app
    server_func = partial(app.run_server, host=host, port=port, **options)
                          ^^^^^^^^^^^^^^
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/dash/_obsolete.py", line 22, in __getattr__
    raise err.exc(err.message)
dash.exceptions.ObsoleteAttributeException: app.run_server has been replaced by app.run

With some upgraded version of libxml2 when the old xmlsec python library was compiled with an older version.

(saml_env) ❰redacted❙~❱✘≻ saml_web_app                                                                                                                                                                                                                     16:35:13
Traceback (most recent call last):
  File "/Users/redacted/saml_env/bin/saml_web_app", line 5, in <module>
    from saml_reader.web.cli_hook import start_web_app_from_cli
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/cli_hook.py", line 9, in <module>
    from saml_reader.web.run import run_web_app
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/run.py", line 15, in <module>
    import saml_reader.web.callbacks
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/callbacks/__init__.py", line 5, in <module>
    import saml_reader.web.callbacks.analyze
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/web/callbacks/analyze.py", line 9, in <module>
    from saml_reader.cli import run_analysis, OutputStream
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/cli.py", line 13, in <module>
    from saml_reader.text_reader import TextReader
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/text_reader.py", line 9, in <module>
    from saml_reader.saml.parser import RegexSamlParser, StandardSamlParser
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/saml_reader/saml/parser.py", line 11, in <module>
    from onelogin.saml2.utils import OneLogin_Saml2_Utils as utils
  File "/Users/redacted/saml_env/lib/python3.11/site-packages/onelogin/saml2/utils.py", line 23, in <module>
    import xmlsec
ImportError: dlopen(/Users/redacted/saml_env/lib/python3.11/site-packages/xmlsec.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '_xmlSecOpenSSLTransformHmacRipemd160GetKlass'

Solution for this one is to:

brew cleanup
brew reinstall libxml2 libxmlsec1

Then when the install prompts you with this, run the commands:

libxml2 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libxml2 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/libxml2/bin:$PATH"' >> ~/.zshrc

For compilers to find libxml2 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/libxml2/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/libxml2/include"

For pkg-config to find libxml2 you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/libxml2/lib/pkgconfig"

Then run

pip uninstall python3-saml xmlsec
pip install python3-saml xmlsec --no-cache-dir --force-reinstall --ignore-installed --no-binary :all:

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions