[Bug]: multipletests import fails in receptive_field.py
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 92/100
Research direction
Start at line 37 of allensdk/brain_observatory/receptive_field_analysis/receptive_field.py and compare the failing statsmodels import with the location of multipletests described in the issue. Re-run the reported receptive_field import with statsmodels 0.15.0; done means the module imports successfully without the ImportError.
Written by the indexing model from the issue text.
Description
Describe the bug
With statsmodels>=0.15.0, receptive_field.py fails to import multipletests from statsmodels.sandbox.stats.multicomp.
multipletests has been technically importable from sandbox.stats.multicomp for many versions (at least since some version 0.4.x). This is because in sandbox.stats.multicomp, multipletests was imported it globally from statsmodels.stats.multitest. In version 0.15.0, the global import was removed. As a result, the import in the allensdk's receptive_field.py now fails.
To reproduce
With statsmodels>=0.15.0 installed:
from allensdk.brain_observatory.receptive_field_analysis import receptive_field
Expected behavior
Import successful.
Actual behavior
Cell In[1], line 1
----> 1 from allensdk.brain_observatory.receptive_field_analysis import receptive_field
File python3.11/site-packages/allensdk/brain_observatory/receptive_field_analysis/receptive_field.py:37
1 # Allen Institute Software License - This software license is the 2-clause BSD
2 # license plus a third clause that prohibits redistribution for commercial
3 # purposes without further permission.
(...) 34 # POSSIBILITY OF SUCH DAMAGE.
35 #
36 from .eventdetection import detect_events
---> 37 from statsmodels.sandbox.stats.multicomp import multipletests
38 import numpy as np
39 from .utilities import get_A, get_A_blur, get_shuffle_matrix, get_components, \
40 dict_generator
ImportError: cannot import name 'multipletests' from 'statsmodels.sandbox.stats.multicomp' (python3.11/site-packages/statsmodels/sandbox/stats/multicomp.py)
Solution
The function should be imported as:
from statsmodels.stats.multitest import multipletests
That is where it is defined in the current version of statsmodels. And as noted above, as far as I can tell, that is where it has been since one of the 0.4.x versions from 14 years ago. So, I would not expect any backward compatibility problems.
The earliest version I was able to install in my environment was statsmodels==0.13.5 (from around 4 years ago?), and the import worked.
Environment
- OS and version: Ubuntu 24.04.4 LTS
- Python version: 3.11
- AllenSDK version: 2.16.2
- Install method (pip/conda/source): pip
- Execution context (local/CI/notebook/cluster): local
- Any pinned dependencies or unusual environment details: Statsmodels version 0.15.0
Are you willing to submit a fix?
- Yes, I can work on a PR for this
- No, but I can help test a proposed fix
- Dominant language
- Jupyter Notebook
- Stars
- 398
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AllenInstitute/AllenSDK
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
AllenInstitute/AllenSDK#2782 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
AllenInstitute/AllenSDK#2776 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
AllenInstitute/AllenSDK#2773 ·
-
Tro Openbug
Difficulty 5/5 Over a week Newbie friendliness 5/100
AllenInstitute/AllenSDK#2766 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 25/100
AllenInstitute/AllenSDK#2763 ·
All issues in AllenInstitute/AllenSDK
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
open-compass/VLMEvalKit#1698 ·
-
triage:deciding
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
open-telemetry/otel-arrow#4123 · 1 reaction ·