Skip to content

blas IndexError: list index out of range error #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
twiecki opened this issue Nov 16, 2023 · 4 comments · Fixed by #506
Closed

blas IndexError: list index out of range error #504

twiecki opened this issue Nov 16, 2023 · 4 comments · Fixed by #506

Comments

@twiecki
Copy link
Member

twiecki commented Nov 16, 2023

Description

~ $ python -c "import pytensor"
WARNING (pytensor.configdefaults): g++ not detected!  PyTensor will be unable to compile C-implementations and will default to Python. Performance may be severely degraded. To remove this warning, set PyTensor flags cxx to an empty string.
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/configparser.py", line 202, in fetch_val_for_key
    return self._pytensor_cfg.get(section, option)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/configparser.py", line 797, in get
    d = self._unify_values(section, vars)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/configparser.py", line 1168, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'blas'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/configparser.py", line 318, in __get__
    val_str = cls.fetch_val_for_key(self.name, delete_key=delete_key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/configparser.py", line 206, in fetch_val_for_key
    raise KeyError(key)
KeyError: 'blas__ldflags'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/__init__.py", line 119, in <module>
    from pytensor import scalar, tensor
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/tensor/__init__.py", line 107, in <module>
    from pytensor.tensor import (  # noqa
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/tensor/blas.py", line 101, in <module>
    from pytensor.tensor.blas_headers import blas_header_text, blas_header_version
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/tensor/blas_headers.py", line 1015, in <module>
    if not config.blas__ldflags:
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/configparser.py", line 322, in __get__
    val_str = self.default()
              ^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/link/c/cmodule.py", line 2782, in default_blas_ldflags
    cxx_library_dirs = get_cxx_library_dirs()
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/pytensor/link/c/cmodule.py", line 2734, in get_cxx_library_dirs
    maybe_lib_dirs = [
                     ^
IndexError: list index out of range

Could be related to #444 ? CC @lucianopaz

@twiecki
Copy link
Member Author

twiecki commented Nov 16, 2023

It works when I install clang++ and openblas.

@ricardoV94
Copy link
Member

Is that a truncated stack track? Where is the indexing operation actually happening?

@twiecki
Copy link
Member Author

twiecki commented Nov 16, 2023

It's the full traceback I got.

@lucianopaz
Copy link
Member

This happens because the default blas config function fails to find a cxx compiler to query for the search paths. We should add a try or if block to see if the compiler exists and if it doesn't return an empty string as the blas ld flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants