Skip to content
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

GBRSA import error: Module 'pandas' has no attribute 'Panel' #515

Open
salilabwfu opened this issue Jun 13, 2022 · 12 comments
Open

GBRSA import error: Module 'pandas' has no attribute 'Panel' #515

salilabwfu opened this issue Jun 13, 2022 · 12 comments

Comments

@salilabwfu
Copy link

I am attempting to follow the tutorial for GBRSA here: https://github.com/brainiak/brainiak/blob/master/examples/reprsimil/bayesian_rsa_example.ipynb but I receive an error that the module 'pandas' has no attribute 'Panel.'

I've followed the installation instructions using Conda. Does GBRSA require an older version of pandas? Thanks in advance!

@mihaic
Copy link
Member

mihaic commented Jun 13, 2022

Hello, @salilabwfu! Yes, please try a version older than 0.25.

@salilabwfu
Copy link
Author

Thanks for your quick response! I tried running conda install -c conda-forge pandas=0.24 and trying again, but it is still giving me the same error. I'm likely doing something wrong with conda. Could you point me to how to use an older version? Thanks again!

@mihaic
Copy link
Member

mihaic commented Jun 14, 2022

That install command should have been enough, if you ran it in the same environment where you installed BrainIAK. Could you please paste here the whole error output?

@salilabwfu
Copy link
Author

Sorry for my slow response. Here is what I have run:
conda create -n venv
condo activate venv
conda install -c brainiak -c defaults -c conda-forge brainiak
conda install -c conda-forge pandas=0.24

When I then start python and attempt to load GBRSA, I get this error message

from brainiak.reprsimil.brsa import GBRSA

Traceback (most recent call last):
File "", line 1, in
File "/Users/anthonysali/miniconda3/envs/venv2/lib/python3.7/site-packages/brainiak/reprsimil/brsa.py", line 53, in
import brainiak.utils.utils as utils
File "/Users/anthonysali/miniconda3/envs/venv2/lib/python3.7/site-packages/brainiak/utils/utils.py", line 19, in
from .fmrisim import generate_stimfunction, _double_gamma_hrf, convolve_hrf
File "/Users/anthonysali/miniconda3/envs/venv2/lib/python3.7/site-packages/brainiak/utils/fmrisim.py", line 81, in
from statsmodels.tsa.arima_model import ARMA
File "/Users/anthonysali/miniconda3/envs/venv2/lib/python3.7/site-packages/statsmodels/tsa/arima_model.py", line 22, in
import statsmodels.tsa.base.tsa_model as tsbase
File "/Users/anthonysali/miniconda3/envs/venv2/lib/python3.7/site-packages/statsmodels/tsa/base/tsa_model.py", line 2, in
from statsmodels.compat.pandas import is_numeric_dtype, Float64Index
File "/Users/anthonysali/miniconda3/envs/venv2/lib/python3.7/site-packages/statsmodels/compat/pandas.py", line 49, in
data_klasses = (pandas.Series, pandas.DataFrame, pandas.Panel)
File "/Users/anthonysali/.local/lib/python3.7/site-packages/pandas/init.py", line 244, in getattr
raise AttributeError(f"module 'pandas' has no attribute '{name}'")
AttributeError: module 'pandas' has no attribute 'Panel'

Thank you again!
Anthony

@mihaic
Copy link
Member

mihaic commented Jun 23, 2022

I tried reproducing the error on Ubuntu 20.04, but I could not. (I don't have access to MacOS right now.) Installing in a new Conda environment like you did and importing GBRSA works. It works both immediately after installing BrainIAK and after downgrading Pandas.

Can you please try again in a new environment and paste here all the output from your terminal, including the installation commands output?

@salilabwfu
Copy link
Author

Thanks for your help. I am running MacOS 10.15.5. Here are the commands with the corresponding outputs. Please let me know if I can provide any additional information.

conda create -n venv

Collecting package metadata (current_repodata.json): done
Solving environment: done

Package Plan

environment location: /Users/anthonysali/miniconda3/envs/NewEnv

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To activate this environment, use

 $ conda activate NewEnv

To deactivate an active environment, use

 $ conda deactivate

condo activate NewEnv

conda install -c brainiak -c defaults -c conda-forge brainiak

Collecting package metadata (current_repodata.json): done
Solving environment: done

Package Plan

environment location: /Users/anthonysali/miniconda3/envs/NewEnv

added / updated specs:
- brainiak

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
certifi-2022.6.15          |   py37hecd8cb5_0         153 KB
------------------------------------------------------------
                                       Total:         153 KB

The following NEW packages will be INSTALLED:

bottleneck pkgs/main/osx-64::bottleneck-1.3.4-py37h67323c0_0
brainiak brainiak/osx-64::brainiak-0.11-py37h04f5b5a_0
brotli pkgs/main/osx-64::brotli-1.0.9-hb1e8313_2
ca-certificates pkgs/main/osx-64::ca-certificates-2022.4.26-hecd8cb5_0
cached-property pkgs/main/noarch::cached-property-1.5.2-py_0
cctools_osx-64 pkgs/main/osx-64::cctools_osx-64-949.0.1-hc7db93f_23
certifi pkgs/main/osx-64::certifi-2022.6.15-py37hecd8cb5_0
clang pkgs/main/osx-64::clang-12.0.0-hecd8cb5_2
clang-12 pkgs/main/osx-64::clang-12-12.0.0-default_hfcad0e5_2
clang_osx-64 pkgs/main/osx-64::clang_osx-64-12.0.0-h7ad7729_2
clangxx pkgs/main/osx-64::clangxx-12.0.0-default_hfcad0e5_2
clangxx_osx-64 pkgs/main/osx-64::clangxx_osx-64-12.0.0-he0c6f94_2
compiler-rt pkgs/main/osx-64::compiler-rt-12.0.0-hd87ff74_2
compiler-rt_osx-64 pkgs/main/noarch::compiler-rt_osx-64-12.0.0-hfb26b64_2
cycler pkgs/main/noarch::cycler-0.11.0-pyhd3eb1b0_0
cython pkgs/main/osx-64::cython-0.29.28-py37he9d5cce_0
decorator pkgs/main/noarch::decorator-5.1.1-pyhd3eb1b0_0
fonttools pkgs/main/noarch::fonttools-4.25.0-pyhd3eb1b0_0
freetype pkgs/main/osx-64::freetype-2.11.0-hd8bbffd_0
giflib pkgs/main/osx-64::giflib-5.2.1-haf1e3a3_0
h5py pkgs/main/osx-64::h5py-3.6.0-py37h4a1dd59_0
hdf5 pkgs/main/osx-64::hdf5-1.10.6-hdbbcd12_0
joblib pkgs/main/noarch::joblib-1.1.0-pyhd3eb1b0_0
jpeg pkgs/main/osx-64::jpeg-9e-hca72f7f_0
kiwisolver pkgs/main/osx-64::kiwisolver-1.4.2-py37he9d5cce_0
lcms2 pkgs/main/osx-64::lcms2-2.12-hf1fd2bf_0
ld64_osx-64 pkgs/main/osx-64::ld64_osx-64-530-h70f3046_23
ldid pkgs/main/osx-64::ldid-2.1.2-h2d21305_2
libblas conda-forge/osx-64::libblas-3.9.0-15_osx64_openblas
libcblas conda-forge/osx-64::libcblas-3.9.0-15_osx64_openblas
libclang-cpp12 pkgs/main/osx-64::libclang-cpp12-12.0.0-default_hfcad0e5_2
libcxx pkgs/main/osx-64::libcxx-12.0.0-h2f01273_0
libffi pkgs/main/osx-64::libffi-3.3-hb1e8313_2
libgfortran pkgs/main/osx-64::libgfortran-3.0.1-h93005f0_2
liblapack conda-forge/osx-64::liblapack-3.9.0-15_osx64_openblas
libllvm12 pkgs/main/osx-64::libllvm12-12.0.0-h9b2ccf5_3
libopenblas pkgs/main/osx-64::libopenblas-0.3.20-h9a5756b_0
libpng pkgs/main/osx-64::libpng-1.6.37-ha441bb4_0
libtiff pkgs/main/osx-64::libtiff-4.2.0-hdb42f99_1
libwebp pkgs/main/osx-64::libwebp-1.2.2-h56c3ce4_0
libwebp-base pkgs/main/osx-64::libwebp-base-1.2.2-hca72f7f_0
llvm-openmp conda-forge/osx-64::llvm-openmp-8.0.1-h770b8ee_0
llvm-tools pkgs/main/osx-64::llvm-tools-12.0.0-h9b2ccf5_3
lz4-c pkgs/main/osx-64::lz4-c-1.9.3-h23ab428_1
matplotlib-base pkgs/main/osx-64::matplotlib-base-3.5.1-py37hfb0c5b7_1
mpi pkgs/main/osx-64::mpi-1.0-mpich
mpi4py pkgs/main/osx-64::mpi4py-3.0.3-py37h77202c6_0
mpich pkgs/main/osx-64::mpich-3.3.2-hc856adb_0
munkres pkgs/main/noarch::munkres-1.1.4-py_0
ncurses pkgs/main/osx-64::ncurses-6.3-hca72f7f_2
networkx pkgs/main/osx-64::networkx-2.2-py37_1
nibabel conda-forge/noarch::nibabel-4.0.1-pyhd8ed1ab_0
nitime conda-forge/osx-64::nitime-0.9-py37h032687b_3
numexpr conda-forge/osx-64::numexpr-2.8.0-py37h5b83a90_1
numpy conda-forge/osx-64::numpy-1.20.3-py37hdb226fd_2
openmp conda-forge/osx-64::openmp-8.0.1-0
openssl pkgs/main/osx-64::openssl-1.1.1o-hca72f7f_0
packaging pkgs/main/noarch::packaging-21.3-pyhd3eb1b0_0
pandas pkgs/main/osx-64::pandas-1.3.5-py37h743cdd8_0
patsy pkgs/main/osx-64::patsy-0.5.2-py37hecd8cb5_1
pillow pkgs/main/osx-64::pillow-9.0.1-py37hde71d04_0
pip pkgs/main/osx-64::pip-21.2.2-py37hecd8cb5_0
psutil pkgs/main/osx-64::psutil-5.8.0-py37h9ed2024_1
pybind11 pkgs/main/osx-64::pybind11-2.9.1-py37hc29d2bd_0
pydicom conda-forge/noarch::pydicom-2.3.0-pyh6c4a22f_0
pyparsing pkgs/main/noarch::pyparsing-3.0.4-pyhd3eb1b0_0
python pkgs/main/osx-64::python-3.7.13-hdfd78df_0
python-dateutil pkgs/main/noarch::python-dateutil-2.8.2-pyhd3eb1b0_0
python_abi conda-forge/osx-64::python_abi-3.7-2_cp37m
pytz pkgs/main/osx-64::pytz-2022.1-py37hecd8cb5_0
readline pkgs/main/osx-64::readline-8.1.2-hca72f7f_1
scikit-learn conda-forge/osx-64::scikit-learn-0.21.3-py37hd4ffd6c_0
scipy conda-forge/osx-64::scipy-1.2.1-py37hbd7caa9_1
setuptools pkgs/main/osx-64::setuptools-61.2.0-py37hecd8cb5_0
six pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
sqlite pkgs/main/osx-64::sqlite-3.38.3-h707629a_0
statsmodels conda-forge/osx-64::statsmodels-0.9.0-py37h917ab60_1000
tapi pkgs/main/osx-64::tapi-1000.10.8-ha1b3eb9_0
theano pkgs/main/osx-64::theano-1.0.5-py37he9d5cce_1
tk pkgs/main/osx-64::tk-8.6.12-h5d9f67b_0
typing_extensions pkgs/main/noarch::typing_extensions-4.1.1-pyh06a4308_0
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
xz pkgs/main/osx-64::xz-5.2.5-hca72f7f_1
zlib pkgs/main/osx-64::zlib-1.2.12-h4dc903c_2
zstd pkgs/main/osx-64::zstd-1.5.2-hcb37349_0

Proceed ([y]/n)? y

Downloading and Extracting Packages
certifi-2022.6.15 | 153 KB | ################################################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

conda install -c conda-forge pandas=0.24

Collecting package metadata (current_repodata.json): done
Solving environment: done

Package Plan

environment location: /Users/anthonysali/miniconda3/envs/NewEnv

added / updated specs:
- pandas=0.24

The following packages will be UPDATED:

ca-certificates pkgs/main::ca-certificates-2022.4.26-~ --> conda-forge::ca-certificates-2022.6.15-h033912b_0
openssl pkgs/main::openssl-1.1.1o-hca72f7f_0 --> conda-forge::openssl-1.1.1p-hfe4f2af_0

The following packages will be SUPERSEDED by a higher-priority channel:

certifi pkgs/main::certifi-2022.6.15-py37hecd~ --> conda-forge::certifi-2022.6.15-py37hf985489_0
pandas pkgs/main::pandas-1.3.5-py37h743cdd8_0 --> conda-forge::pandas-0.24.2-py37h4f17bb1_1
setuptools pkgs/main::setuptools-61.2.0-py37hecd~ --> conda-forge::setuptools-59.8.0-py37hf985489_1

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

python

Python 3.7.13 (default, Mar 28 2022, 07:24:34)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

from brainiak.reprsimil.brsa import GBRSA

Traceback (most recent call last):
File "", line 1, in
File "/Users/anthonysali/miniconda3/envs/NewEnv/lib/python3.7/site-packages/brainiak/reprsimil/brsa.py", line 53, in
import brainiak.utils.utils as utils
File "/Users/anthonysali/miniconda3/envs/NewEnv/lib/python3.7/site-packages/brainiak/utils/utils.py", line 19, in
from .fmrisim import generate_stimfunction, _double_gamma_hrf, convolve_hrf
File "/Users/anthonysali/miniconda3/envs/NewEnv/lib/python3.7/site-packages/brainiak/utils/fmrisim.py", line 81, in
from statsmodels.tsa.arima_model import ARMA
File "/Users/anthonysali/miniconda3/envs/NewEnv/lib/python3.7/site-packages/statsmodels/tsa/arima_model.py", line 22, in
import statsmodels.tsa.base.tsa_model as tsbase
File "/Users/anthonysali/miniconda3/envs/NewEnv/lib/python3.7/site-packages/statsmodels/tsa/base/tsa_model.py", line 2, in
from statsmodels.compat.pandas import is_numeric_dtype, Float64Index
File "/Users/anthonysali/miniconda3/envs/NewEnv/lib/python3.7/site-packages/statsmodels/compat/pandas.py", line 49, in
data_klasses = (pandas.Series, pandas.DataFrame, pandas.Panel)
File "/Users/anthonysali/.local/lib/python3.7/site-packages/pandas/init.py", line 244, in getattr
raise AttributeError(f"module 'pandas' has no attribute '{name}'")
AttributeError: module 'pandas' has no attribute 'Panel'

@mihaic
Copy link
Member

mihaic commented Jun 24, 2022

It looks like the Pandas 0.24 installation was successful. The error should not appear. Can you try the following command?

python -c "import pandas; print(pandas.Panel)"

And to double check, does Conda show the version 0.24 for Pandas?

conda list pandas

@salilabwfu
Copy link
Author

Thanks again! I'm still stumped:

python -c "import pandas; print(pandas.Panel)"
Traceback (most recent call last):
File "", line 1, in
File "/Users/anthonysali/.local/lib/python3.7/site-packages/pandas/init.py", line 244, in getattr
raise AttributeError(f"module 'pandas' has no attribute '{name}'")
AttributeError: module 'pandas' has no attribute 'Panel'

conda list pandas

packages in environment at /Users/anthonysali/miniconda3/envs/NewEnv:

Name Version Build Channel
pandas 0.24.2 py37h4f17bb1_1 conda-forge

I appreciate all of the help!

@mihaic
Copy link
Member

mihaic commented Jun 24, 2022

On my machine, Pandas 0.24 does not produce that error. Can you try the import command in a new environment with just Pandas 0.24?

@yibeichan
Copy link

hello, I had the similar error module 'pandas' has no attribute 'Panel' (my conda env is python 3.7) when using from brainiak.isc import isc
so I uninstalled pandas in my conda env (the same one, I didn't create a new env), then installed pandas 0.24 using conda install -c conda-forge pandas=0.24.
Now I got ModuleNotFoundError: No module named 'brainiak.isc' when from brainiak.isc import isc
Thanks in advance for the help.

@yibeichan
Copy link

okay, I found the solution, create the new conda env with pandas 0.24 specified, then install brainiak

conda create -n brainiak pandas=0.24
conda activate brainiak
conda install -c brainiak -c defaults -c conda-forge brainiak

everything works fine from brainiak.isc import isc no more problem

@mihaic
Copy link
Member

mihaic commented Aug 22, 2022

Thanks for sharing your workaround, @yibeichan!

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

No branches or pull requests

3 participants