WARNING (pytensor.tensor.blas)

Hi,
I am getting this warning while installing pymc - WARNING (pytensor.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

I am PyMC version: 5.10.0 and I use pip to install pymc.

Based on this link, it seems this warning is leading to poor performance and slowness. And I have not installed theano for my work. My python version is - Python 3.9.1

I know this is just a warning but wasn’t sure if this slows down performance.
It would be helpful if anyone can help me on this issue?

Theano is no longer relevant for PyMC. The current backend is called Pytensor.

The warning is telling you that you haven’t installed a BLAS package for your specific hardware. This is a suite of highly specialized linear algebra routines that significantly speed up computation.

The installation instructions recommend using conda precisely for this reason. Conda is configured to help handle these sorts of non-python requirements, whereas pip is not.

I might add that even with conda/mamba installed environments things are currently not as smooth as we’d like them to be.
I’m currently having a tough time with this myself (here) and if I understand correctly the issue of BLAS flags detection is not fully sorted out yet: BUG: Regression in C blas flags detection · Issue #508 · pymc-devs/pytensor · GitHub

1 Like

Hi,
I tried using conda to install pymc but still getting the same blas warning. Here is the output of conda list -

Output
Name Version
_libgcc_mutex 0.1
_openmp_mutex 4.5
arviz 0.16.1
atk-1.0 2.38.0
binutils_impl_linux-64 2.4
binutils_linux-64 2.4
blas 2.12
blas-devel 3.9.0
brotli 1.1.0
brotli-bin 1.1.0
bzip2 1.0.8
c-ares 1.22.1
ca-certificates 2023.11.17
cached-property 1.5.2
cached_property 1.5.2
cachetools 5.3.2
cairo 1.18.0
certifi 2023.11.17
cloudpickle 3.0.0
cons 0.4.6
contourpy 1.2.0
cycler 0.12.1
etuples 0.3.9
expat 2.5.0
fastprogress 1.0.3
filelock 3.13.1
font-ttf-dejavu-sans-mono 2.37
font-ttf-inconsolata 3
font-ttf-source-code-pro 2.038
font-ttf-ubuntu 0.83
fontconfig 2.14.2
fonts-conda-ecosystem 1
fonts-conda-forge 1
fonttools 4.45.1
freetype 2.12.1
fribidi 1.0.10
gcc 12.3.0
gcc_impl_linux-64 12.3.0
gcc_linux-64 12.3.0
gdk-pixbuf 2.42.10
gettext 0.21.1
giflib 5.2.1
graphite2 1.3.13
graphviz 9.0.0
gtk2 2.24.33
gts 0.7.6
gxx 12.3.0
gxx_impl_linux-64 12.3.0
gxx_linux-64 12.3.0
h5netcdf 1.3.0
h5py 3.10.0
harfbuzz 8.3.0
hdf5 1.14.2
icu 73.2
kernel-headers_linux-64 2.6.32
keyutils 1.6.1
kiwisolver 1.4.5
krb5 1.21.2
lcms2 2.15
ld_impl_linux-64 2.4
lerc 4.0.0
libaec 1.1.2
libblas 3.9.0
libbrotlicommon 1.1.0
libbrotlidec 1.1.0
libbrotlienc 1.1.0
libcblas 3.9.0
libcurl 8.4.0
libdeflate 1.19
libedit 3.1.20191231
libev 4.33
libexpat 2.5.0
libffi 3.4.2
libgcc-devel_linux-64 12.3.0
libgcc-ng 13.2.0
libgd 2.3.3
libgfortran-ng 13.2.0
libgfortran5 13.2.0
libglib 2.78.1
libgomp 13.2.0
libhwloc 2.9.3
libiconv 1.17
libjpeg-turbo 3.0.0
liblapack 3.9.0
liblapacke 3.9.0
libnghttp2 1.58.0
libnsl 2.0.1
libopenblas 0.3.25
libpng 1.6.39
librsvg 2.56.3
libsanitizer 12.3.0
libsqlite 3.44.2
libssh2 1.11.0
libstdcxx-devel_linux-64 12.3.0
libstdcxx-ng 13.2.0
libtiff 4.6.0
libuuid 2.38.1
libwebp 1.3.2
libwebp-base 1.3.2
libxcb 1.15
libxml2 2.11.6
libzlib 1.2.13
llvm-openmp 17.0.6
logical-unification 0.4.6
matplotlib-base 3.8.2
minikanren 1.0.3
mkl 2022.2.1
mkl-service 2.4.0
multipledispatch 0.6.0
munkres 1.1.4
ncurses 6.4
numpy 1.26.2
openblas 0.3.25
openjpeg 2.5.0
openssl 3.2.0
packaging 23.2
pandas 2.1.3
pango 1.50.14
pcre2 10.42
pillow 10.1.0
pip 23.3.1
pixman 0.42.2
pthread-stubs 0.4
pymc 5.10.0
pymc-base 5.10.0
pyparsing 3.1.1
pytensor 2.18.1
pytensor-base 2.18.1
python 3.11.6
python-dateutil 2.8.2
python-graphviz 0.20.1
python-tzdata 2023.3
python_abi 3.11
pytz 2023.3.post1
readline 8.2
scipy 1.11.4
setuptools 68.2.2
six 1.16.0
sysroot_linux-64 2.12
tbb 2021.10.0
tk 8.6.13
toolz 0.12.0
typing-extensions 4.8.0
typing_extensions 4.8.0
tzdata 2023c
wheel 0.42.0
xarray 2023.11.0
xarray-einstats 0.6.0
xorg-kbproto 1.0.7
xorg-libice 1.1.1
xorg-libsm 1.2.4
xorg-libx11 1.8.7
xorg-libxau 1.0.11
xorg-libxdmcp 1.1.3
xorg-libxext 1.3.4
xorg-libxrender 0.9.11
xorg-renderproto 0.11.1
xorg-xextproto 7.3.0
xorg-xproto 7.0.31
xz 5.2.6
zlib 1.2.13
zstd 1.5.5

Did you use the conda-forge channel specifically?

Can you show the output of conda list?

I have used conda-forge channel and the output of conda list is shared above

The output seems to be missing information. Mine includes build and channel info:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                  2_kmp_llvm    conda-forge
absl-py                   1.4.0              pyhd8ed1ab_0    conda-forge
alsa-lib                  1.2.9                hd590300_0    conda-forge
arviz                     0.16.1             pyhd8ed1ab_0    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
atk-1.0                   2.38.0               hd4edc92_1    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge

Sorry, I had removed the last two columns -

Output
Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_kmp_llvm conda-forge
arviz 0.16.1 pyhd8ed1ab_1 conda-forge
atk-1.0 2.38.0 hd4edc92_1 conda-forge
binutils_impl_linux-64 2.4 hf600244_0 conda-forge
binutils_linux-64 2.4 hbdbef99_2 conda-forge
blas 2.12 openblas conda-forge
blas-devel 3.9.0 20_linux64_openblas conda-forge
brotli 1.1.0 hd590300_1 conda-forge
brotli-bin 1.1.0 hd590300_1 conda-forge
bzip2 1.0.8 hd590300_5 conda-forge
c-ares 1.22.1 hd590300_0 conda-forge
ca-certificates 2023.11.17 hbcca054_0 conda-forge
cached-property 1.5.2 hd8ed1ab_1 conda-forge
cached_property 1.5.2 pyha770c72_1 conda-forge
cachetools 5.3.2 pyhd8ed1ab_0 conda-forge
cairo 1.18.0 h3faef2a_0 conda-forge
certifi 2023.11.17 pyhd8ed1ab_0 conda-forge
cloudpickle 3.0.0 pyhd8ed1ab_0 conda-forge
cons 0.4.6 pyhd8ed1ab_0 conda-forge
contourpy 1.2.0 py311h9547e67_0 conda-forge
cycler 0.12.1 pyhd8ed1ab_0 conda-forge
etuples 0.3.9 pyhd8ed1ab_0 conda-forge
expat 2.5.0 hcb278e6_1 conda-forge
fastprogress 1.0.3 pyhd8ed1ab_0 conda-forge
filelock 3.13.1 pyhd8ed1ab_0 conda-forge
font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge
font-ttf-inconsolata 3 h77eed37_0 conda-forge
font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge
font-ttf-ubuntu 0.83 h77eed37_1 conda-forge
fontconfig 2.14.2 h14ed4e7_0 conda-forge
fonts-conda-ecosystem 1 0 conda-forge
fonts-conda-forge 1 0 conda-forge
fonttools 4.45.1 py311h459d7ec_0 conda-forge
freetype 2.12.1 h267a509_2 conda-forge
fribidi 1.0.10 h36c2ea0_0 conda-forge
gcc 12.3.0 h8d2909c_2 conda-forge
gcc_impl_linux-64 12.3.0 he2b93b0_3 conda-forge
gcc_linux-64 12.3.0 h76fc315_2 conda-forge
gdk-pixbuf 2.42.10 h829c605_4 conda-forge
gettext 0.21.1 h27087fc_0 conda-forge
giflib 5.2.1 h0b41bf4_3 conda-forge
graphite2 1.3.13 h58526e2_1001 conda-forge
graphviz 9.0.0 h78e8752_1 conda-forge
gtk2 2.24.33 h90689f9_2 conda-forge
gts 0.7.6 h977cf35_4 conda-forge
gxx 12.3.0 h8d2909c_2 conda-forge
gxx_impl_linux-64 12.3.0 he2b93b0_3 conda-forge
gxx_linux-64 12.3.0 h8a814eb_2 conda-forge
h5netcdf 1.3.0 pyhd8ed1ab_0 conda-forge
h5py 3.10.0 nompi_py311h3839ddf_100 conda-forge
harfbuzz 8.3.0 h3d44ed6_0 conda-forge
hdf5 1.14.2 nompi_h4f84152_100 conda-forge
icu 73.2 h59595ed_0 conda-forge
kernel-headers_linux-64 2.6.32 he073ed8_16 conda-forge
keyutils 1.6.1 h166bdaf_0 conda-forge
kiwisolver 1.4.5 py311h9547e67_1 conda-forge
krb5 1.21.2 h659d440_0 conda-forge
lcms2 2.15 hb7c19ff_3 conda-forge
ld_impl_linux-64 2.4 h41732ed_0 conda-forge
lerc 4.0.0 h27087fc_0 conda-forge
libaec 1.1.2 h59595ed_1 conda-forge
libblas 3.9.0 20_linux64_openblas conda-forge
libbrotlicommon 1.1.0 hd590300_1 conda-forge
libbrotlidec 1.1.0 hd590300_1 conda-forge
libbrotlienc 1.1.0 hd590300_1 conda-forge
libcblas 3.9.0 20_linux64_openblas conda-forge
libcurl 8.4.0 hca28451_0 conda-forge
libdeflate 1.19 hd590300_0 conda-forge
libedit 3.1.20191231 he28a2e2_2 conda-forge
libev 4.33 h516909a_1 conda-forge
libexpat 2.5.0 hcb278e6_1 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-devel_linux-64 12.3.0 h8bca6fd_103 conda-forge
libgcc-ng 13.2.0 h807b86a_3 conda-forge
libgd 2.3.3 h119a65a_9 conda-forge
libgfortran-ng 13.2.0 h69a702a_3 conda-forge
libgfortran5 13.2.0 ha4646dd_3 conda-forge
libglib 2.78.1 h783c2da_1 conda-forge
libgomp 13.2.0 h807b86a_3 conda-forge
libhwloc 2.9.3 default_h554bfaf_1009 conda-forge
libiconv 1.17 h166bdaf_0 conda-forge
libjpeg-turbo 3.0.0 hd590300_1 conda-forge
liblapack 3.9.0 20_linux64_openblas conda-forge
liblapacke 3.9.0 20_linux64_openblas conda-forge
libnghttp2 1.58.0 h47da74e_0 conda-forge
libnsl 2.0.1 hd590300_0 conda-forge
libopenblas 0.3.25 pthreads_h413a1c8_0 conda-forge
libpng 1.6.39 h753d276_0 conda-forge
librsvg 2.56.3 h98fae49_0 conda-forge
libsanitizer 12.3.0 h0f45ef3_3 conda-forge
libsqlite 3.44.2 h2797004_0 conda-forge
libssh2 1.11.0 h0841786_0 conda-forge
libstdcxx-devel_linux-64 12.3.0 h8bca6fd_103 conda-forge
libstdcxx-ng 13.2.0 h7e041cc_3 conda-forge
libtiff 4.6.0 ha9c0a0a_2 conda-forge
libuuid 2.38.1 h0b41bf4_0 conda-forge
libwebp 1.3.2 h658648e_1 conda-forge
libwebp-base 1.3.2 hd590300_0 conda-forge
libxcb 1.15 h0b41bf4_0 conda-forge
libxml2 2.11.6 h232c23b_0 conda-forge
libzlib 1.2.13 hd590300_5 conda-forge
llvm-openmp 17.0.6 h4dfa4b3_0 conda-forge
logical-unification 0.4.6 pyhd8ed1ab_0 conda-forge
matplotlib-base 3.8.2 py311h54ef318_0 conda-forge
minikanren 1.0.3 pyhd8ed1ab_0 conda-forge
mkl 2022.2.1 h84fe81f_16997 conda-forge
mkl-service 2.4.0 py311hb711fc7_0 conda-forge
multipledispatch 0.6.0 py_0 conda-forge
munkres 1.1.4 pyh9f0ad1d_0 conda-forge
ncurses 6.4 h59595ed_2 conda-forge
numpy 1.26.2 py311h64a7726_0 conda-forge
openblas 0.3.25 pthreads_h7a3da1a_0 conda-forge
openjpeg 2.5.0 h488ebb8_3 conda-forge
openssl 3.2.0 hd590300_1 conda-forge
packaging 23.2 pyhd8ed1ab_0 conda-forge
pandas 2.1.3 py311h320fe9a_0 conda-forge
pango 1.50.14 ha41ecd1_2 conda-forge
pcre2 10.42 hcad00b1_0 conda-forge
pillow 10.1.0 py311ha6c5da5_0 conda-forge
pip 23.3.1 pyhd8ed1ab_0 conda-forge
pixman 0.42.2 h59595ed_0 conda-forge
pthread-stubs 0.4 h36c2ea0_1001 conda-forge
pymc 5.10.0 hd8ed1ab_0 conda-forge
pymc-base 5.10.0 pyhd8ed1ab_0 conda-forge
pyparsing 3.1.1 pyhd8ed1ab_0 conda-forge
pytensor 2.18.1 py311hb755f60_0 conda-forge
pytensor-base 2.18.1 py311h320fe9a_0 conda-forge
python 3.11.6 hab00c5b_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-graphviz 0.20.1 pyh22cad53_0 conda-forge
python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge
python_abi 3.11 4_cp311 conda-forge
pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge
readline 8.2 h8228510_1 conda-forge
scipy 1.11.4 py311h64a7726_0 conda-forge
setuptools 68.2.2 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
sysroot_linux-64 2.12 he073ed8_16 conda-forge
tbb 2021.10.0 h00ab1b0_2 conda-forge
tk 8.6.13 noxft_h4845f30_101 conda-forge
toolz 0.12.0 pyhd8ed1ab_0 conda-forge
typing-extensions 4.8.0 hd8ed1ab_0 conda-forge
typing_extensions 4.8.0 pyha770c72_0 conda-forge
tzdata 2023c h71feb2d_0 conda-forge
wheel 0.42.0 pyhd8ed1ab_0 conda-forge
xarray 2023.11.0 pyhd8ed1ab_0 conda-forge
xarray-einstats 0.6.0 pyhd8ed1ab_0 conda-forge
xorg-kbproto 1.0.7 h7f98852_1002 conda-forge
xorg-libice 1.1.1 hd590300_0 conda-forge
xorg-libsm 1.2.4 h7391055_0 conda-forge
xorg-libx11 1.8.7 h8ee46fc_0 conda-forge
xorg-libxau 1.0.11 hd590300_0 conda-forge
xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge
xorg-libxext 1.3.4 h0b41bf4_2 conda-forge
xorg-libxrender 0.9.11 hd590300_0 conda-forge
xorg-renderproto 0.11.1 h7f98852_1002 conda-forge
xorg-xextproto 7.3.0 h0b41bf4_1003 conda-forge
xorg-xproto 7.0.31 h7f98852_1007 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
zlib 1.2.13 hd590300_5 conda-forge
zstd 1.5.5 hfc55251_0 conda-forge

Is this a fresh env, or did you conda install into the same one you had previously pip installed into?

I created a new env and installed pymc -
conda create -c conda_forge -n pymc_env “pymc=5.10.0”

Having similar issues on my end when performing a fresh conda install using the recommended install command.

Conda install command:
conda create -c conda-forge -n pymc_env "pymc>=5"

When attempting the following imports in a jupyter notebook, I get the following error:

import arviz as az
import numpy as np
import pandas as pd
import math
import pymc as pm
import pytensor
import pytensor.tensor as pt
import scipy.stats as stats

import matplotlib.pyplot as plt
---------------------------------------------------------------------------
NoSectionError                            Traceback (most recent call last)
File ~/miniconda3/envs/pymc_env/lib/python3.11/site-packages/pytensor/configparser.py:201, in PyTensorConfigParser.fetch_val_for_key(self, key, delete_key)
    200 try:
--> 201     return self._pytensor_cfg.get(section, option)
    202 except InterpolationError:

File ~/miniconda3/envs/pymc_env/lib/python3.11/configparser.py:797, in RawConfigParser.get(self, section, option, raw, vars, fallback)
    796 try:
--> 797     d = self._unify_values(section, vars)
    798 except NoSectionError:

File ~/miniconda3/envs/pymc_env/lib/python3.11/configparser.py:1168, in RawConfigParser._unify_values(self, section, vars)
   1167     if section != self.default_section:
-> 1168         raise NoSectionError(section) from None
   1169 # Update with the entry specific variables

NoSectionError: No section: 'blas'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~/miniconda3/envs/pymc_env/lib/python3.11/site-packages/pytensor/configparser.py:317, in ConfigParam.__get__(self, cls, type_, delete_key)
    316 try:
--> 317     val_str = cls.fetch_val_for_key(self.name, delete_key=delete_key)
...
-> 2720     blas_info = np.__config__.get_info("blas_opt")
   2722     # If we are in a EPD installation, mkl is available
   2723     if "EPD" in sys.version:

AttributeError: module 'numpy.__config__' has no attribute 'get_info'

That suggests you have installed an old version of PyMC and numpy>2.6. Can you confirm which version of PyMC got installed?

Interesting, is this just a result of conda trying to find compatible versions?

From the conda environment:

pymc                      5.6.1           py311hea593b9_0
numpy                     1.26.2          py311h6d074dd_0

Probably conda is installing from the defaults channel and not conda-forge: BUG: Can not run 'AttributeError: module 'numpy.__config__' has no attribute 'get_info'' · Issue #7043 · pymc-devs/pymc · GitHub

Ah gotcha, adding nodefaults worked for me, thank you!

If I am not using Conda but Pycharm and getting the same warning, do I:

  1. Set warning level
  2. Install a particular package

Thanks

You can still use conda as the interpreter/package manager in a pycharm project