bambinos / bambi

BAyesian Model-Building Interface (Bambi) in Python.
https://bambinos.github.io/bambi/
MIT License
1.08k stars 124 forks source link

problem with aesara when importing bambi #737

Closed ChristophBg closed 1 year ago

ChristophBg commented 1 year ago

Hello Bambi team, I have following issue: When I import bambi, I get following error:

import bambi Traceback (most recent call last): File "", line 1, in File "/Applications/miniconda3/envs/science/lib/python3.9/site-packages/bambi/init.py", line 7, in from .models import Model File "/Applications/miniconda3/envs/science/lib/python3.9/site-packages/bambi/models.py", line 16, in from .backend import PyMCModel File "/Applications/miniconda3/envs/science/lib/python3.9/site-packages/bambi/backend/init.py", line 1, in from .pymc import PyMCModel File "/Applications/miniconda3/envs/science/lib/python3.9/site-packages/bambi/backend/pymc.py", line 19, in class PyMCModel: File "/Applications/miniconda3/envs/science/lib/python3.9/site-packages/bambi/backend/pymc.py", line 31, in PyMCModel "softmax": at.nnet.softmax, File "/Applications/miniconda3/envs/science/lib/python3.9/site-packages/aesara/tensor/init.py", line 175, in getattr raise AttributeError(f"module {name} has no attribute {name}") AttributeError: module aesara.tensor has no attribute nnet


The package versions I use are: aesara 2.8.12 py39hb4c90a2_2 conda-forge aesara-base 2.8.12 py39h6e9494a_2 conda-forge aesara-nightly 2.9.1.post9 pypi_0 pypi bambi 0.10.0 pypi_0 pypi pymc 5.0.2 hd8ed1ab_0 conda-forge pymc-base 5.0.2 pyhd8ed1ab_0 conda-forge

(I tried using aesara-nightly instead but got the same error).

on a Mac OS 12.7

I read that nnet is/ should be deprecated in apsara (https://github.com/aesara-devs/aesara/issues/674), so I am not sure why I am getting this error.
Your help is much appreciated!

ColCarroll commented 1 year ago

Unfortunately I think your installs are a little messed up: pymc no longer depends on aesara (It uses pytensor), and bambi 0.9.3 was the last version to use the aesara version of pymc.

Can you double check that the bambi version where you get that error is actually 0.10.0? Or perhaps create a new environment with upgraded versions of everything?

ChristophBg commented 1 year ago

thanks for the quick reply! That was indeed my problem, I updated pymc and pytensor based on the dependencies list (https://github.com/bambinos/bambi/blob/main/pyproject.toml) and now I can import bambi without issues. Many thanks!