ContextLab / hypertools

A Python toolbox for gaining geometric insights into high-dimensional data
http://hypertools.readthedocs.io/en/latest/
MIT License
1.81k stars 161 forks source link

ImportError: numpy.core.multiarray failed to import #208

Open zhouyanasd opened 6 years ago

zhouyanasd commented 6 years ago

I got an ImportError when I import hypertools, and my numpy is 1.12.1 in windows(or 1.14 in mac). How can I run it?

But when import hypertools second time, the error will disapper.

jeremymanning commented 6 years ago

Hi @zhouyanasd -- which version of Python are you running? Also, can you paste in the output of pip freeze?

zhouyanasd commented 6 years ago

Of course and thank you for your reply. My version of python is 3.6, here is the pip freeze:

alabaster==0.7.10
anaconda-client==1.6.3
anaconda-navigator==1.6.2
anaconda-project==0.6.0
asn1crypto==0.22.0
astroid==1.4.9
astropy==1.3.2
Babel==2.4.0
backports.shutil-get-terminal-size==1.0.0
beakerx==0.12.1
beautifulsoup4==4.6.0
bitarray==0.8.1
blaze==0.10.1
bleach==1.5.0
bokeh==0.12.5
boto==2.46.1
Bottleneck==1.2.1
bqplot==0.10.2
Brian2==2.0.2.1
brian2tools==0.2.1.1
certifi==2018.4.16
cffi==1.10.0
chardet==3.0.3
click==6.7
cloudpickle==0.2.2
clyent==1.2.2
colorama==0.3.9
comtypes==1.1.2
conda==4.5.2
contextlib2==0.5.5
cryptography==1.8.1
cycler==0.10.0
Cython==0.25.2
cytoolz==0.8.2
dask==0.14.3
datashape==0.5.4
decorator==4.0.11
deepdish==0.3.6
distributed==1.16.3
Django==1.11.5
djangorestframework==3.6.4
docutils==0.13.1
entrypoints==0.2.2
et-xmlfile==1.0.1
fastcache==1.0.2
Flask==0.12.2
Flask-Cors==3.0.2
future==0.16.0
gevent==1.2.1
graphviz==0.8
greenlet==0.4.12
h5py==2.7.0
hdbscan==0.8.13
HeapDict==1.0.0
html5lib==0.9999999
hypertools==0.5.0
idna==2.5
imagesize==0.7.1
ipykernel==4.6.1
ipyparallel==6.1.1
ipython==5.3.0
ipython-genutils==0.2.0
ipyvolume==0.4.5
ipywebrtc==0.3.0
ipywidgets==7.1.1
isort==4.2.5
itsdangerous==0.24
jdcal==1.3
jedi==0.10.2
Jinja2==2.9.6
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.0.1
jupyter-console==5.1.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.4.0
jupyter-core==4.3.0
jupyter-highlight-selected-word==0.0.10
jupyter-latex-envs==1.3.8.2
jupyter-nbextensions-configurator==0.4.0
Keras==2.0.8
lazy-object-proxy==1.2.2
llvmlite==0.22.0
locket==0.2.0
lxml==3.7.3
Markdown==2.6.9
MarkupSafe==0.23
matplotlib==2.0.2
menuinst==1.4.7
mistune==0.7.4
mod-wsgi==4.5.17+ap24vc14
mpmath==0.19
msgpack-python==0.4.8
multipledispatch==0.4.9
navigator-updater==0.1.0
nbconvert==5.1.1
nbformat==4.3.0
neat-python==0.92
networkx==1.11
nglview==1.0
nltk==3.2.3
nose==1.3.7
notebook==5.0.0
numba==0.37.0
numexpr==2.6.4
numpy==1.12.1
numpydoc==0.6.0
odo==0.5.0
olefile==0.44
openpyxl==2.4.7
packaging==16.8
pandas==0.20.1
pandocfilters==1.4.1
partd==0.3.8
path.py==10.3.1
pathlib2==2.2.1
patsy==0.4.1
pep8==1.7.0
pickleshare==0.7.4
Pillow==5.0.0
ply==3.10
ppca==0.0.3
prompt-toolkit==1.0.14
protobuf==3.5.1
psutil==5.2.2
py==1.4.33
py-cpuinfo==3.3.0
pycosat==0.6.3
pycparser==2.17
pycrypto==2.6.1
pycurl==7.43.0
pyflakes==1.5.0
Pygments==2.2.0
PyLEMS==0.4.9
pylint==1.6.4
pymc==2.3.6
PyMySQL==0.7.11
pyodbc==4.0.16
pyOpenSSL==17.0.0
pyparsing==2.1.4
pytest==3.0.7
python-dateutil==2.6.0
pytz==2017.2
PyWavelets==0.5.2
pywin32==220
PyYAML==3.12
pyzmq==16.0.2
QtAwesome==0.4.4
qtconsole==4.3.0
QtPy==1.2.1
requests==2.14.2
rope-py3k==0.9.4.post1
scikit-image==0.13.0
scikit-learn==0.19.1
scipy==1.0.1
seaborn==0.8.1
setuptools-scm==1.15.6
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
snowballstemmer==1.2.1
sortedcollections==0.5.3
sortedcontainers==1.5.7
sphinx==1.5.6
spyder==3.1.4
SQLAlchemy==1.1.9
statsmodels==0.8.0
sympy==1.0
tables==3.2.2
tblib==1.3.2
tensorflow==1.3.0
tensorflow-tensorboard==0.1.8
testpath==0.3
toolz==0.8.2
tornado==4.5.1
traitlets==4.3.2
traittypes==0.0.6
umap-learn==0.2.3
unicodecsv==0.14.1
wcwidth==0.1.7
Werkzeug==0.12.2
widgetsnbextension==3.1.3
win-unicode-console==0.5
wincertstore==0.2
wrapt==1.10.10
xlrd==1.0.0
XlsxWriter==0.9.6
xlwings==0.10.4
xlwt==1.2.0
zict==0.1.2

The impor error is like this:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-d87dfbf4b63d> in <module>()
      1 import pandas as pd
----> 2 import hypertools as hyp
      3 get_ipython().magic('matplotlib inline')

C:\ProgramData\Anaconda3\lib\site-packages\hypertools\__init__.py in <module>()
      1 #!/usr/bin/env python
      2 from .config import __version__
----> 3 from .plot.plot import plot
      4 from .tools.load import load
      5 from .tools.analyze import analyze

C:\ProgramData\Anaconda3\lib\site-packages\hypertools\plot\plot.py in <module>()
     14 from .._shared.helpers import *
     15 from .._shared.params import default_params
---> 16 from ..tools.analyze import analyze
     17 from ..tools.cluster import cluster as clusterer
     18 from ..tools.df2mat import df2mat

C:\ProgramData\Anaconda3\lib\site-packages\hypertools\tools\__init__.py in <module>()
      3 from .reduce import reduce
      4 from .missing_inds import missing_inds
----> 5 from .cluster import cluster
      6 from .df2mat import df2mat
      7 from .normalize import normalize

C:\ProgramData\Anaconda3\lib\site-packages\hypertools\tools\cluster.py in <module>()
      4 import numpy as np
      5 import six
----> 6 from hdbscan import HDBSCAN
      7 from .._shared.helpers import *
      8 from .format_data import format_data as formatter

C:\ProgramData\Anaconda3\lib\site-packages\hdbscan\__init__.py in <module>()
----> 1 from .hdbscan_ import HDBSCAN, hdbscan
      2 from .robust_single_linkage_ import RobustSingleLinkage, robust_single_linkage
      3 from .validity import validity_index
      4 from .prediction import approximate_predict, membership_vector, all_points_membership_vectors
      5 

C:\ProgramData\Anaconda3\lib\site-packages\hdbscan\hdbscan_.py in <module>()
     19 from scipy.sparse import csgraph
     20 
---> 21 from ._hdbscan_linkage import (single_linkage,
     22                                mst_linkage_core,
     23                                mst_linkage_core_vector,

hdbscan/dist_metrics.pxd in init hdbscan._hdbscan_linkage (hdbscan/_hdbscan_linkage.c:20936)()

ImportError: numpy.core.multiarray failed to import
codeisbeauty commented 6 years ago

pip install --user numpy

works for me.

I m in win 7 and the numpy version is 1.13.3 after updating

zhouyanasd commented 6 years ago

Hi Thank you for your reply and sorry for the delayed reply, I have tried in another environment with numpy 1.13.3, but this issue still exists. Is it some other thing I missed?