graspologic-org / graspologic

Python package for graph statistics

Home Page:https://graspologic-org.github.io/graspologic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Graspologic import returns a scipy error.

alyakin314 opened this issue · comments

Expected Behavior

Graspologic should import after an install in a clean environment.

Actual Behavior

Exits due to some scipy import. Technically attempted a hyppo import and then broke, but since I installed everything from pip install grapologic - thought posting here is more appropriate. Unsure if some dependence mess or it's on my end of installation.

Example Code

Please see How to create a Minimal, Reproducible example for some guidance on creating the best possible example of the problem

(standard) antonalyakin@Antons-MBP-2 Code % mkvirtualenv test-graspologic --python=python3
created virtual environment CPython3.8.5.final.0-64 in 837ms
  creator CPython3Posix(dest=/Users/antonalyakin/.virtualenvs/test-graspologic, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/Users/antonalyakin/Library/Application Support/virtualenv/seed-app-data/v1.0.1)
  activators PythonActivator,FishActivator,XonshActivator,CShellActivator,PowerShellActivator,BashActivator
virtualenvwrapper.user_scripts creating /Users/antonalyakin/.virtualenvs/test-graspologic/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/antonalyakin/.virtualenvs/test-graspologic/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/antonalyakin/.virtualenvs/test-graspologic/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/antonalyakin/.virtualenvs/test-graspologic/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/antonalyakin/.virtualenvs/test-graspologic/bin/get_env_details
(test-graspologic) antonalyakin@Antons-MBP-2 Code % which pip3
/Users/antonalyakin/.virtualenvs/test-graspologic/bin/pip3
(test-graspologic) antonalyakin@Antons-MBP-2 Code % pip3 install graspologic
Processing /Users/antonalyakin/Library/Caches/pip/wheels/53/b4/c4/f4015dd4d42b9c874035d1d182910e800ddba87972d122b0c3/graspologic-0.3.1-py3-none-any.whl
Collecting seaborn>=0.11.0
  Using cached seaborn-0.11.2-py3-none-any.whl (292 kB)
Collecting joblib>=0.17.0
  Using cached joblib-1.1.0-py2.py3-none-any.whl (306 kB)
Collecting POT>=0.7.0
  Using cached POT-0.8.1.0-cp38-cp38-macosx_10_9_x86_64.whl (189 kB)
Collecting matplotlib!=3.3.*,>=3.0.0
  Using cached matplotlib-3.5.1-cp38-cp38-macosx_10_9_x86_64.whl (7.3 MB)
Collecting anytree>=2.8.0
  Using cached anytree-2.8.0-py2.py3-none-any.whl (41 kB)
Processing /Users/antonalyakin/Library/Caches/pip/wheels/2e/14/ab/ee6f0a3d0e4295f7a63a917956c4480a10e3b60670b74c3ae8/hyppo-0.2.2-py3-none-any.whl
Collecting beartype>=0.7.1
  Using cached beartype-0.9.1-py3-none-any.whl (524 kB)
Collecting gensim<=3.9.0,>=3.8.0
  Using cached gensim-3.8.3-cp38-cp38-macosx_10_9_x86_64.whl (24.2 MB)
Collecting numpy>=1.8.1
  Using cached numpy-1.22.2-cp38-cp38-macosx_10_14_x86_64.whl (17.6 MB)
Collecting scipy>=1.4.0
  Using cached scipy-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl (34.8 MB)
Collecting graspologic-native>=1.0.0
  Using cached graspologic_native-1.1.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (597 kB)
Processing /Users/antonalyakin/Library/Caches/pip/wheels/f2/64/75/df601da9514261c8cb0830b9515d2b94b5a51f09ddeae92b9e/umap_learn-0.5.2-py3-none-any.whl
Collecting scikit-learn>=0.22.0
  Using cached scikit_learn-1.0.2-cp38-cp38-macosx_10_13_x86_64.whl (7.9 MB)
Collecting networkx>=2.1
  Using cached networkx-2.6.3-py3-none-any.whl (1.9 MB)
Collecting pandas>=0.23
  Using cached pandas-1.4.0-cp38-cp38-macosx_10_9_x86_64.whl (11.4 MB)
Collecting pillow>=6.2.0
  Using cached Pillow-9.0.1-cp38-cp38-macosx_10_10_x86_64.whl (3.0 MB)
Collecting fonttools>=4.22.0
  Using cached fonttools-4.29.1-py3-none-any.whl (895 kB)
Collecting packaging>=20.0
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pyparsing>=2.2.1
  Using cached pyparsing-3.0.7-py3-none-any.whl (98 kB)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl (61 kB)
Collecting six>=1.9.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting numba>=0.46
  Using cached numba-0.55.1-cp38-cp38-macosx_10_14_x86_64.whl (2.3 MB)
Collecting smart-open>=1.8.1
  Using cached smart_open-5.2.1-py3-none-any.whl (58 kB)
Processing /Users/antonalyakin/Library/Caches/pip/wheels/1d/07/6e/9ae4e883392994fd1d7c61a0377f0177e3f8e2faff6c677341/pynndescent-0.5.6-py3-none-any.whl
Collecting tqdm
  Using cached tqdm-4.62.3-py2.py3-none-any.whl (76 kB)
Collecting threadpoolctl>=2.0.0
  Using cached threadpoolctl-3.1.0-py3-none-any.whl (14 kB)
Collecting pytz>=2020.1
  Using cached pytz-2021.3-py2.py3-none-any.whl (503 kB)
Collecting llvmlite<0.39,>=0.38.0rc1
  Using cached llvmlite-0.38.0-cp38-cp38-macosx_10_9_x86_64.whl (25.5 MB)
Requirement already satisfied: setuptools in /Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages (from numba>=0.46->hyppo>=0.2.0->graspologic) (46.1.3)
ERROR: numba 0.55.1 has requirement numpy<1.22,>=1.18, but you'll have numpy 1.22.2 which is incompatible.
Installing collected packages: numpy, scipy, pillow, fonttools, pyparsing, packaging, six, python-dateutil, cycler, kiwisolver, matplotlib, pytz, pandas, seaborn, joblib, POT, anytree, llvmlite, numba, threadpoolctl, scikit-learn, hyppo, beartype, smart-open, gensim, graspologic-native, pynndescent, tqdm, umap-learn, networkx, graspologic
Successfully installed POT-0.8.1.0 anytree-2.8.0 beartype-0.9.1 cycler-0.11.0 fonttools-4.29.1 gensim-3.8.3 graspologic-0.3.1 graspologic-native-1.1.1 hyppo-0.2.2 joblib-1.1.0 kiwisolver-1.3.2 llvmlite-0.38.0 matplotlib-3.5.1 networkx-2.6.3 numba-0.55.1 numpy-1.22.2 packaging-21.3 pandas-1.4.0 pillow-9.0.1 pynndescent-0.5.6 pyparsing-3.0.7 python-dateutil-2.8.2 pytz-2021.3 scikit-learn-1.0.2 scipy-1.8.0 seaborn-0.11.2 six-1.16.0 smart-open-5.2.1 threadpoolctl-3.1.0 tqdm-4.62.3 umap-learn-0.5.2
WARNING: You are using pip version 20.0.2; however, version 22.0.3 is available.
You should consider upgrading via the '/Users/antonalyakin/.virtualenvs/test-graspologic/bin/python -m pip install --upgrade pip' command.
(test-graspologic) antonalyakin@Antons-MBP-2 Code % which python
/Users/antonalyakin/.virtualenvs/test-graspologic/bin/python
(test-graspologic) antonalyakin@Antons-MBP-2 Code % python 
Python 3.8.5 (default, Jul 21 2020, 10:48:26) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import graspologic

Full Traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/graspologic/__init__.py", line 8, in <module>
    import graspologic.inference
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/graspologic/inference/__init__.py", line 4, in <module>
    from .latent_distribution_test import latent_distribution_test
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/graspologic/inference/latent_distribution_test.py", line 7, in <module>
    from hyppo.ksample import KSample
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/hyppo/__init__.py", line 1, in <module>
    import hyppo.discrim
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/hyppo/discrim/__init__.py", line 1, in <module>
    from .discrim_one_samp import DiscrimOneSample
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/hyppo/discrim/discrim_one_samp.py", line 5, in <module>
    from ._utils import _CheckInputs
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/hyppo/discrim/_utils.py", line 4, in <module>
    from ..tools import check_ndarray_xy, check_reps, contains_nan, convert_xy_float64
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/hyppo/tools/__init__.py", line 1, in <module>
    from .common import *
  File "/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/hyppo/tools/common.py", line 6, in <module>
    from scipy.stats.stats import _contains_nan
ImportError: cannot import name '_contains_nan' from 'scipy.stats.stats' (/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/scipy/stats/stats.py)

Your Environment

  • Python version: 3.8.5
  • graspologic version: 0.3.1

Additional Details

Packages I have after installation.

(test-graspologic) antonalyakin@Antons-MBP-2 Code % pip list
Package            Version
------------------ -------
anytree            2.8.0  
beartype           0.9.1  
cycler             0.11.0 
fonttools          4.29.1 
gensim             3.8.3  
graspologic        0.3.1  
graspologic-native 1.1.1  
hyppo              0.2.2  
joblib             1.1.0  
kiwisolver         1.3.2  
llvmlite           0.38.0 
matplotlib         3.5.1  
networkx           2.6.3  
numba              0.55.1 
numpy              1.22.2 
packaging          21.3   
pandas             1.4.0  
Pillow             9.0.1  
pip                20.0.2 
POT                0.8.1.0
pynndescent        0.5.6  
pyparsing          3.0.7  
python-dateutil    2.8.2  
pytz               2021.3 
scikit-learn       1.0.2  
scipy              1.8.0  
seaborn            0.11.2 
setuptools         46.1.3 
six                1.16.0 
smart-open         5.2.1  
threadpoolctl      3.1.0  
tqdm               4.62.3 
umap-learn         0.5.2  
wheel              0.34.2 

I lurked around stackoverflow for scipy.stats.stats._contains_nan errors, but couldnt find anything, other than this:
https://stackoverflow.com/questions/48491649/importerror-on-scipy-stats

(test-graspologic) antonalyakin@Antons-MBP-2 Code % python 
Python 3.8.5 (default, Jul 21 2020, 10:48:26) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> scipy.__version__
'1.8.0'
>>> scipy.__file__
'/Users/antonalyakin/.virtualenvs/test-graspologic/lib/python3.8/site-packages/scipy/__init__.py'

Here is what happened:
neurodata/hyppo#303
neurodata/hyppo#304

Waiting for a release of hyppo and then we can pin our hyppo dependency to that version.

In the meantime, can either install dev version of hyppo locally, or just manually go back to scipy <=1.7

@bdpedigo

Gotcha, appreciate.

Feel free to close.

fyi: also had to downgrade numpy to 1.21.5 due to incompatability with numba

which graspologic version are you using?

i saw this issue last week but thought we fixed it on most recent

i.e. you could see if you still get it with the dev version on github?

dev version of hyppo (installed by cloning, pip install --editable .), graspologic 0.3.1 (still from pip)

i.e. it resolved scipy, but still had to downgrade numpy to <1.22

so I believe this #913 fixed the numpy/numba/etc issue (it was passing on all platforms). So the dev version of graspologic i would think this would work, but id be curious if we're wrong. should be releasing graspologic 1.0.0 soon thought

Closed by #921

@alyakin314 lmk if you still have issues in 1.0.0