Closed martiningram closed 2 years ago
Sounds like an installation gone wrong
Interesting, thanks for the report!!!
It looks like somehow BLAS is being improperly configured. Perhaps something is polluting the environment, like some stray environment variables. To isolate the problem a bit more, let's think about:
from aesara import config
print(config.blas__ldflags)
On Linux with the same package specifications, I see
-L/home/mares/micromamba/envs/pymc/lib -lcblas -lblas -lcblas -lblas
but from the traceback it seems like on your system the directory is configured to be the nonexistent /opt/arm64-builds/lib
.
So I think the real question is where is that nonexistent directory coming from? The logic to compute this is a little complicated, but we should be able to see mostly what's going on with
import sys
import numpy as np
print(np.__config__.get_info("blas_opt"))
print(sys.prefix)
print(sys.version)
For me, this gives
{'define_macros': [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)], 'libraries': ['cblas', 'blas', 'cblas', 'blas'], 'library_dirs': ['/home/mares/micromamba/envs/pymc/lib'], 'include_dirs': ['/home/mares/micromamba/envs/pymc/include'], 'language': 'c'}
/home/mares/micromamba/envs/pymc
3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:18)
[GCC 10.3.0]
Hi @maresb , thank you very much for looking into this! I ran your two commands; the first:
from aesara import config
print(config.blas__ldflags)
gives:
-L/opt/arm64-builds/lib -lopenblas -lopenblas -Wl,-rpath,/opt/arm64-builds/lib -Wl,-rpath,/Users/martin.ingram/miniconda3/envs/pymc_problem/lib
The second:
import sys
import numpy as np
print(np.__config__.get_info("blas_opt"))
print(sys.prefix)
print(sys.version)
gives:
{'libraries': ['openblas', 'openblas'], 'library_dirs': ['/opt/arm64-builds/lib'], 'language': 'c', 'define_macros': [('HAVE_CBLAS', None)], 'runtime_library_dirs': ['/opt/arm64-builds/lib']}
/Users/martin.ingram/miniconda3/envs/pymc_problem
3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:16)
[Clang 12.0.1 ]
I checked and, indeed, it seems like /opt/arm64-builds/lib
does not exist. In fact, neither does /opt/arm64-builds
. I hope this helps -- is it looking for BLAS in the wrong place?
Thanks again and all the best, Martin
Yes, that's very interesting, thanks Martin!
To continue narrowing this down, could you please run
python -c 'import numpy.__config__ as c; print(c.__file__)'
What is the path of this file?
Could you also please provide the output of the following?
conda list
Certainly! Here's the output of the first:
/Users/martin.ingram/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/numpy/__config__.py
And here's the output of the second:
# packages in environment at /Users/martin.ingram/miniconda3/envs/pymc_problem:
#
# Name Version Build Channel
aeppl 0.0.35 pyhd8ed1ab_0 conda-forge
aeppl-base 0.0.35 pyhd8ed1ab_0 conda-forge
aesara 2.8.2 py38h50f692f_0 conda-forge
aesara-base 2.8.2 py38h10201cd_0 conda-forge
appnope 0.1.3 pyhd8ed1ab_0 conda-forge
argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forge
argon2-cffi-bindings 21.2.0 py38h33210d7_2 conda-forge
arviz 0.12.1 pyhd8ed1ab_1 conda-forge
asttokens 2.0.8 pyhd8ed1ab_0 conda-forge
attrs 22.1.0 pyh71513ae_1 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
bambi 0.9.1 pypi_0 pypi
beautifulsoup4 4.11.1 pyha770c72_0 conda-forge
blas 2.116 openblas conda-forge
blas-devel 3.9.0 16_osxarm64_openblas conda-forge
bleach 5.0.1 pyhd8ed1ab_0 conda-forge
brotli 1.0.9 h1c322ee_7 conda-forge
brotli-bin 1.0.9 h1c322ee_7 conda-forge
bzip2 1.0.8 h3422bc3_4 conda-forge
c-ares 1.18.1 h3422bc3_0 conda-forge
c-compiler 1.5.0 h5008568_0 conda-forge
ca-certificates 2022.6.15 h4653dfc_0 conda-forge
cachetools 5.2.0 pyhd8ed1ab_0 conda-forge
cctools 973.0.1 hcbb26d4_10 conda-forge
cctools_osx-arm64 973.0.1 he930820_10 conda-forge
certifi 2022.6.15 pyhd8ed1ab_1 conda-forge
cffi 1.15.1 py38h0e10f82_0 conda-forge
cftime 1.6.1 py38hd91e067_0 conda-forge
clang 14.0.4 hce30654_0 conda-forge
clang-14 14.0.4 default_h81a5282_0 conda-forge
clang_osx-arm64 14.0.4 hc634a12_2 conda-forge
clangxx 14.0.4 default_hb7ecf47_0 conda-forge
clangxx_osx-arm64 14.0.4 hb7a33d8_2 conda-forge
cloudpickle 2.1.0 pyhd8ed1ab_0 conda-forge
compiler-rt 14.0.4 h4418234_0 conda-forge
compiler-rt_osx-arm64 14.0.4 hb07f8d1_0 conda-forge
cons 0.4.5 pyhd8ed1ab_0 conda-forge
curl 7.83.1 h7965298_0 conda-forge
cxx-compiler 1.5.0 hffc8910_0 conda-forge
cycler 0.11.0 pyhd8ed1ab_0 conda-forge
debugpy 1.6.3 py38hdba0465_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
entrypoints 0.4 pyhd8ed1ab_0 conda-forge
etuples 0.3.8 pyhd8ed1ab_0 conda-forge
executing 1.0.0 pyhd8ed1ab_0 conda-forge
fastprogress 1.0.3 pyhd8ed1ab_0 conda-forge
filelock 3.8.0 pyhd8ed1ab_0 conda-forge
flit-core 3.7.1 pyhd8ed1ab_0 conda-forge
fonttools 4.37.1 py38hb991d35_0 conda-forge
formulae 0.3.4 pypi_0 pypi
freetype 2.12.1 hd633e50_0 conda-forge
hdf4 4.2.15 hc683e77_4 conda-forge
hdf5 1.12.2 nompi_h33dac16_100 conda-forge
icu 70.1 h6b3803e_0 conda-forge
importlib-metadata 4.11.4 py38h10201cd_0 conda-forge
importlib_resources 5.9.0 pyhd8ed1ab_0 conda-forge
ipykernel 6.15.2 pyh736e0ef_0 conda-forge
ipython 8.5.0 pyhd1c38e8_1 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
ipywidgets 8.0.2 pyhd8ed1ab_1 conda-forge
jedi 0.18.1 pyhd8ed1ab_2 conda-forge
jinja2 3.1.2 pyhd8ed1ab_1 conda-forge
jpeg 9e he4db4b2_2 conda-forge
jsonschema 4.15.0 pyhd8ed1ab_0 conda-forge
jupyter 1.0.0 py38h10201cd_7 conda-forge
jupyter_client 7.3.5 pyhd8ed1ab_0 conda-forge
jupyter_console 6.4.4 pyhd8ed1ab_0 conda-forge
jupyter_core 4.11.1 py38h10201cd_0 conda-forge
jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_widgets 3.0.3 pyhd8ed1ab_0 conda-forge
kiwisolver 1.4.4 py38haa2428a_0 conda-forge
krb5 1.19.3 he492e65_0 conda-forge
lcms2 2.12 had6a04f_0 conda-forge
ld64 609 h619f069_10 conda-forge
ld64_osx-arm64 609 h132958c_10 conda-forge
lerc 4.0.0 h9a09cb3_0 conda-forge
libblas 3.9.0 16_osxarm64_openblas conda-forge
libbrotlicommon 1.0.9 h1c322ee_7 conda-forge
libbrotlidec 1.0.9 h1c322ee_7 conda-forge
libbrotlienc 1.0.9 h1c322ee_7 conda-forge
libcblas 3.9.0 16_osxarm64_openblas conda-forge
libclang-cpp14 14.0.4 default_h81a5282_0 conda-forge
libcurl 7.83.1 h7965298_0 conda-forge
libcxx 14.0.6 h2692d47_0 conda-forge
libdeflate 1.13 h57fd34a_0 conda-forge
libedit 3.1.20191231 hc8eb9b7_2 conda-forge
libev 4.33 h642e427_1 conda-forge
libffi 3.4.2 h3422bc3_5 conda-forge
libgfortran 5.0.0 11_3_0_hd922786_25 conda-forge
libgfortran5 11.3.0 hdaf2cc0_25 conda-forge
libiconv 1.16 h642e427_0 conda-forge
liblapack 3.9.0 16_osxarm64_openblas conda-forge
liblapacke 3.9.0 16_osxarm64_openblas conda-forge
libllvm14 14.0.4 h37c5ba8_0 conda-forge
libnetcdf 4.8.1 nompi_h996a5af_104 conda-forge
libnghttp2 1.47.0 h519802c_1 conda-forge
libopenblas 0.3.21 openmp_hc731615_3 conda-forge
libpng 1.6.37 h9b2ccdc_4 conda-forge
libsodium 1.0.18 h27ca646_1 conda-forge
libsqlite 3.39.3 h76d750c_0 conda-forge
libssh2 1.10.0 h7a5bd25_3 conda-forge
libtiff 4.4.0 hd6ca8d7_3 conda-forge
libwebp-base 1.2.4 h57fd34a_0 conda-forge
libxcb 1.13 h9b22ae9_1004 conda-forge
libxml2 2.9.14 h9d8dfc2_4 conda-forge
libxslt 1.1.35 ha8fb468_0 conda-forge
libzip 1.9.2 h76ab92c_1 conda-forge
libzlib 1.2.12 ha287fd2_2 conda-forge
llvm-openmp 14.0.4 hd125106_0 conda-forge
llvm-tools 14.0.4 h37c5ba8_0 conda-forge
logical-unification 0.4.5 pyhd8ed1ab_0 conda-forge
lxml 4.9.1 py38he5c2ac2_0 conda-forge
markupsafe 2.1.1 py38h33210d7_1 conda-forge
matplotlib-base 3.5.3 py38h4399b95_2 conda-forge
matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge
minikanren 1.0.3 pyhd8ed1ab_0 conda-forge
mistune 2.0.4 pyhd8ed1ab_0 conda-forge
multipledispatch 0.6.0 py_0 conda-forge
munkres 1.1.4 pyh9f0ad1d_0 conda-forge
nbclient 0.6.7 pyhd8ed1ab_0 conda-forge
nbconvert 7.0.0 pyhd8ed1ab_0 conda-forge
nbconvert-core 7.0.0 pyhd8ed1ab_0 conda-forge
nbconvert-pandoc 7.0.0 pyhd8ed1ab_0 conda-forge
nbformat 5.4.0 pyhd8ed1ab_0 conda-forge
ncurses 6.3 h07bb92c_1 conda-forge
nest-asyncio 1.5.5 pyhd8ed1ab_0 conda-forge
netcdf4 1.6.0 nompi_py38hce67723_102 conda-forge
notebook 6.4.12 pyha770c72_0 conda-forge
numpy 1.21.6 pypi_0 pypi
openblas 0.3.21 openmp_hf78f355_3 conda-forge
openjpeg 2.5.0 h5d4e404_1 conda-forge
openssl 3.0.5 h7aea29f_1 conda-forge
packaging 21.3 pyhd8ed1ab_0 conda-forge
pandas 1.4.4 py38h2a4bfaf_0 conda-forge
pandoc 2.12 hca03da5_0
pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge
parso 0.8.3 pyhd8ed1ab_0 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 9.2.0 py38h96fe7ce_2 conda-forge
pip 22.2.2 pyhd8ed1ab_0 conda-forge
pkgutil-resolve-name 1.3.10 pyhd8ed1ab_0 conda-forge
prometheus_client 0.14.1 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.31 pyha770c72_0 conda-forge
prompt_toolkit 3.0.31 hd8ed1ab_0 conda-forge
psutil 5.9.2 py38hb991d35_0 conda-forge
pthread-stubs 0.4 h27ca646_1001 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
pycparser 2.21 pyhd8ed1ab_0 conda-forge
pygments 2.13.0 pyhd8ed1ab_0 conda-forge
pymc 4.1.7 hd8ed1ab_0 conda-forge
pymc-base 4.1.7 pyhd8ed1ab_0 conda-forge
pyparsing 3.0.9 pyhd8ed1ab_0 conda-forge
pyrsistent 0.18.1 py38h33210d7_1 conda-forge
python 3.8.13 hd3575e6_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-fastjsonschema 2.16.1 pyhd8ed1ab_0 conda-forge
python_abi 3.8 2_cp38 conda-forge
pytz 2022.2.1 pyhd8ed1ab_0 conda-forge
pyzmq 23.2.1 py38h6a7385f_0 conda-forge
readline 8.1.2 h46ed386_0 conda-forge
scipy 1.9.1 py38h3aeb131_0 conda-forge
send2trash 1.8.0 pyhd8ed1ab_0 conda-forge
setuptools 65.3.0 pyhd8ed1ab_1 conda-forge
sigtool 0.1.3 h44b9a77_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
soupsieve 2.3.2.post1 pyhd8ed1ab_0 conda-forge
sqlite 3.39.3 h2229b38_0 conda-forge
stack_data 0.5.0 pyhd8ed1ab_0 conda-forge
tapi 1100.0.11 he4954df_0 conda-forge
terminado 0.15.0 py38h10201cd_0 conda-forge
tinycss2 1.1.1 pyhd8ed1ab_0 conda-forge
tk 8.6.12 he1e0b03_0 conda-forge
toolz 0.12.0 pyhd8ed1ab_0 conda-forge
tornado 6.2 py38he5c2ac2_0 conda-forge
traitlets 5.3.0 pyhd8ed1ab_0 conda-forge
typing-extensions 4.3.0 hd8ed1ab_0 conda-forge
typing_extensions 4.3.0 pyha770c72_0 conda-forge
unicodedata2 14.0.0 py38h33210d7_1 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.37.1 pyhd8ed1ab_0 conda-forge
widgetsnbextension 4.0.3 pyhd8ed1ab_0 conda-forge
xarray 2022.6.0 pyhd8ed1ab_1 conda-forge
xarray-einstats 0.3.0 pyhd8ed1ab_0 conda-forge
xorg-libxau 1.0.9 h27ca646_0 conda-forge
xorg-libxdmcp 1.1.3 h27ca646_0 conda-forge
xz 5.2.6 h57fd34a_0 conda-forge
zeromq 4.3.4 hbdafb3b_1 conda-forge
zipp 3.8.1 pyhd8ed1ab_0 conda-forge
zstd 1.5.2 h8128057_4 conda-forge
Aha! It appears that your numpy has been clobbered by pip.
bambi 0.9.1 pypi_0 pypi
formulae 0.3.4 pypi_0 pypi
numpy 1.21.6 pypi_0 pypi
You may be able to fix it with conda install bambi
.
Also, your environment is pretty big. I'd highly recommend using mamba
as a drop-in replacement for conda
. It's way faster.
Hi @maresb , looks like you were right on the money -- it works if I use conda
instead! And I'll have to check out mamba
thanks, conda
is certainly slow sometimes... Thank you very much for your quick help and for solving this problem!
I'll close this now, but if you don't mind, just so I understand: was the problem that pip
installed a second version of numpy
, which expected BLAS
to be in a certain place, while conda
had actually installed it somewhere else?
Hi @martiningram, glad I could help!
The problem was that pip
uninstalled the conda-forge version of numpy
and installed its own. While a Conda package can provide a Python package, a Python package cannot provide a Conda package (since Conda packages have additional structure). Thus conda
and pip
are not really aware of what each other are doing. I don't know precisely what led to the error, but my guess is that the Conda package for NumPy has some post-install and activation magic (and possibly even a monkey-patch) which ensures the paths are set correctly, and when pip
downgrades numpy
this magic is somehow lost.
To avoid these sorts of problems, the recommendation is to avoid using pip
(except for editable installs of a package under development) and favor installing with conda
/mamba
instead. In case you do need to use pip
because, for example, a PyPI package doesn't exist or is broken on conda-forge, it's best to make sure all the dependencies have already been installed with conda
/mamba
. To accomplish that, you can make use of pip
's flags like --dry-run
and --no-deps
, and verify consistency with pip check
.
(And in case a package doesn't exist or is broken, you can create a recipe and submit it, and if a package is broken you can file an issue in the corresponding feedstock, and get support on the website and Gitter.)
As for why pip
was uninstalling NumPy, it's because bambi
's current requirements don't allow for the latest version of NumPy so a downgrade is necessary. But thanks to @aloctavodia, the latest NumPy will be allowed in the next Bambi release.
I see -- thanks a lot for the detailed explanation @maresb , and for fixing the issue! 😊
Description of your problem
Please provide a minimal, self-contained, and reproducible example.
Data file: data.csv
Please provide the full traceback.
Complete error traceback
```python --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/vm.py:1246, in VMLinker.make_all(self, profiler, input_storage, output_storage, storage_map) 1242 # no-recycling is done at each VM.__call__ So there is 1243 # no need to cause duplicate c code by passing 1244 # no_recycling here. 1245 thunks.append( -> 1246 node.op.make_thunk(node, storage_map, compute_map, [], impl=impl) 1247 ) 1248 linker_make_thunk_time[node] = time.time() - thunk_start File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/op.py:131, in COp.make_thunk(self, node, storage_map, compute_map, no_recycling, impl) 130 try: --> 131 return self.make_c_thunk(node, storage_map, compute_map, no_recycling) 132 except (NotImplementedError, MethodNotDefined): 133 # We requested the c code, so don't catch the error. File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/op.py:96, in COp.make_c_thunk(self, node, storage_map, compute_map, no_recycling) 95 raise NotImplementedError("float16") ---> 96 outputs = cl.make_thunk( 97 input_storage=node_input_storage, output_storage=node_output_storage 98 ) 99 thunk, node_input_filters, node_output_filters = outputs File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/basic.py:1202, in CLinker.make_thunk(self, input_storage, output_storage, storage_map, cache, **kwargs) 1201 init_tasks, tasks = self.get_init_tasks() -> 1202 cthunk, module, in_storage, out_storage, error_storage = self.__compile__( 1203 input_storage, output_storage, storage_map, cache 1204 ) 1206 res = _CThunk(cthunk, init_tasks, tasks, error_storage, module) File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/basic.py:1122, in CLinker.__compile__(self, input_storage, output_storage, storage_map, cache) 1121 output_storage = tuple(output_storage) -> 1122 thunk, module = self.cthunk_factory( 1123 error_storage, 1124 input_storage, 1125 output_storage, 1126 storage_map, 1127 cache, 1128 ) 1129 return ( 1130 thunk, 1131 module, (...) 1140 error_storage, 1141 ) File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/basic.py:1634, in CLinker.cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, cache) 1633 try: -> 1634 key = self.cmodule_key() 1635 except KeyError: File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/basic.py:1283, in CLinker.cmodule_key(self) 1211 """ 1212 Return a complete hashable signature of the module we compiled. 1213 (...) 1281 1282 """ -> 1283 return self.cmodule_key_( 1284 self.fgraph, 1285 self.no_recycling, 1286 compile_args=self.compile_args(), 1287 libraries=self.libraries(), 1288 header_dirs=self.header_dirs(), 1289 c_compiler=self.c_compiler(), 1290 ) File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/basic.py:1462, in CLinker.cmodule_key_(self, fgraph, no_recycling, compile_args, libraries, header_dirs, insert_config_hash, c_compiler) 1461 if hasattr(node.op, "c_code_cache_version_apply"): -> 1462 version.append(node.op.c_code_cache_version_apply(node)) 1464 props = getattr(node.op, "__props__", None) File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/link/c/interface.py:238, in CLinkerOp.c_code_cache_version_apply(self, node) 219 """Return a tuple of integers indicating the version of this `Op`. 220 221 An empty tuple indicates an "unversioned" `Op` that will not be (...) 236 237 """ --> 238 return self.c_code_cache_version() File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/tensor/blas_c.py:636, in CGemv.c_code_cache_version(self) 635 def c_code_cache_version(self): --> 636 return (14, blas_header_version(), check_force_gemv_init()) File ~/miniconda3/envs/pymc_problem/lib/python3.8/site-packages/aesara/tensor/blas_c.py:685, in check_force_gemv_init() 665 test_code = """ 666 #includePlease provide any additional information below.
This uses fresh installations of both pymc and bambi, and I'm a bit stumped. I installed pymc with conda-forge as recommended, then bambi using pip.
I do run an ARM machine, and am currently using python 3.8 because I plan to install an older package later that requires it; maybe that's causing issues? I tried another, non-bambi model also, and that worked fine, so could also be bambi-specific.
Thanks for your help!
Versions and main components