Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

ImportError: cannot import name '_distance_wrap' on v0.3.3 #9

Closed
mumumumu opened this issue Aug 8, 2018 · 7 comments
Closed

ImportError: cannot import name '_distance_wrap' on v0.3.3 #9

mumumumu opened this issue Aug 8, 2018 · 7 comments

Comments

@mumumumu
Copy link

mumumumu commented Aug 8, 2018

Started getting this error after the latest version bump:

/usr/local/lib/python3.6/site-packages/dedupe/__init__.py:6: in <module>
--
  | from dedupe._init import *  # noqa
  | /usr/local/lib/python3.6/site-packages/dedupe/_init.py:1: in <module>
  | from dedupe.api import StaticDedupe, Dedupe  # noqa: F401
  | /usr/local/lib/python3.6/site-packages/dedupe/api.py:27: in <module>
  | import dedupe.clustering as clustering
  | /usr/local/lib/python3.6/site-packages/dedupe/clustering.py:12: in <module>
  | import hcluster
  | /usr/local/lib/python3.6/site-packages/hcluster/__init__.py:1: in <module>
  | from .hierarchy import *
  | /usr/local/lib/python3.6/site-packages/hcluster/hierarchy.py:175: in <module>
  | from . import distance
  | /usr/local/lib/python3.6/site-packages/hcluster/distance.py:73: in <module>
  | from . import _distance_wrap
  | E   ImportError: cannot import name '_distance_wrap'

This is running on Python 3.6.5.

@fgregg
Copy link
Contributor

fgregg commented Aug 8, 2018

Thanks for the report. Would you mind trying again. I just pushed a bugfix version to pypi.

@mumumumu
Copy link
Author

mumumumu commented Aug 8, 2018

Now I'm getting this error when trying to upgrade via pip:

/app # pip install -U dedupe-hcluster
Collecting dedupe-hcluster
  Downloading https://files.pythonhosted.org/packages/e4/83/0bae57e3433afd9c231bfbaaa29fef053c18632f8e131902fc499e6c4c8e/dedupe-hcluster-0.3.4.tar.gz (194kB)
    100% |████████████████████████████████| 204kB 6.7MB/s
Requirement not upgraded as not directly required: future in /usr/local/lib/python3.6/site-packages (from dedupe-hcluster) (0.16.0)
Requirement not upgraded as not directly required: numpy>=1.12.1 in /usr/local/lib/python3.6/site-packages (from dedupe-hcluster) (1.15.0)
Building wheels for collected packages: dedupe-hcluster
  Running setup.py bdist_wheel for dedupe-hcluster ... error
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4foijzon/dedupe-hcluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-tf2ktyu8 --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/hcluster
  copying hcluster/__init__.py -> build/lib.linux-x86_64-3.6/hcluster
  copying hcluster/distance.py -> build/lib.linux-x86_64-3.6/hcluster
  copying hcluster/hierarchy.py -> build/lib.linux-x86_64-3.6/hcluster
  running build_ext
  building 'hcluster._distance_wrap' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/hcluster
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/lib/python3.6/site-packages/numpy/core/include -I/usr/local/include/python3.6m -c hcluster/distance_wrap.c -o build/temp.linux-x86_64-3.6/hcluster/distance_wrap.o
  In file included from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
                   from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                   from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from hcluster/distance_wrap.c:38:
  /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   #warning "Using deprecated NumPy API, disable it by " \
    ^~~~~~~
  hcluster/distance_wrap.c:40:27: fatal error: distance_impl.h: No such file or directory
   #include "distance_impl.h"
                             ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for dedupe-hcluster
  Running setup.py clean for dedupe-hcluster
Failed to build dedupe-hcluster
Installing collected packages: dedupe-hcluster
  Found existing installation: dedupe-hcluster 0.3.2
    Uninstalling dedupe-hcluster-0.3.2:
      Successfully uninstalled dedupe-hcluster-0.3.2
  Running setup.py install for dedupe-hcluster ... error
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4foijzon/dedupe-hcluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vc0hnac0/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/hcluster
    copying hcluster/__init__.py -> build/lib.linux-x86_64-3.6/hcluster
    copying hcluster/distance.py -> build/lib.linux-x86_64-3.6/hcluster
    copying hcluster/hierarchy.py -> build/lib.linux-x86_64-3.6/hcluster
    running build_ext
    building 'hcluster._distance_wrap' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/hcluster
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/lib/python3.6/site-packages/numpy/core/include -I/usr/local/include/python3.6m -c hcluster/distance_wrap.c -o build/temp.linux-x86_64-3.6/hcluster/distance_wrap.o
    In file included from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
                     from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from hcluster/distance_wrap.c:38:
    /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it by " \
      ^~~~~~~
    hcluster/distance_wrap.c:40:27: fatal error: distance_impl.h: No such file or directory
     #include "distance_impl.h"
                               ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of dedupe-hcluster
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4foijzon/dedupe-hcluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vc0hnac0/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-4foijzon/dedupe-hcluster/

I'm trying to install this in an Alpine 3.6.2 docker container.

@fgregg
Copy link
Contributor

fgregg commented Aug 8, 2018

Thanks for the report. I wonder why it's not grabbing one of the manylinux wheels? Anway, I'll include that header file in the sdist.

@fgregg
Copy link
Contributor

fgregg commented Aug 8, 2018

What version of pip do you have?

@mumumumu
Copy link
Author

mumumumu commented Aug 8, 2018

I was on pip 10.0.1 when I tried installing earlier. Tried again just now on pip 18.0 and got the same error.

@fgregg
Copy link
Contributor

fgregg commented Aug 8, 2018

Okay, pushed a new version. I still don't understand why it didn't use the manylinux wheel, but that's a separate problem.

@mumumumu
Copy link
Author

mumumumu commented Aug 8, 2018

New version is installing without a hitch. Thanks for all the help!

@mumumumu mumumumu closed this as completed Aug 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants