0

Helllo,

I am facing issue in installing sparse-dot-topn on AWS EC2 with below error. Things I tried:

  • Upgraded pip
  • upgrade wheel
  • install cython
  • install cpython
  • install gcc

but nothing seems to work. Kindly advice where I am going wrong.

pip3 install sparse-dot-topn
Defaulting to user installation because normal site-packages is not writeable
Collecting sparse-dot-topn
  Using cached sparse_dot_topn-0.3.1.tar.gz (17 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.16.6 in ./.local/lib/python3.7/site-packages (from sparse-dot-topn) (1.20.3)
Requirement already satisfied: setuptools>=42 in ./.local/lib/python3.7/site-packages (from sparse-dot-topn) (60.5.0)
Requirement already satisfied: scipy>=1.2.3 in ./.local/lib/python3.7/site-packages (from sparse-dot-topn) (1.6.3)
Requirement already satisfied: cython>=0.29.15 in ./.local/lib/python3.7/site-packages (from sparse-dot-topn) (0.29.26)
Building wheels for collected packages: sparse-dot-topn
  Building wheel for sparse-dot-topn (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /home/ec2-user/.local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpkxql22kh
       cwd: /tmp/pip-install-dr3dy2db/sparse-dot-topn_a4e8b8ecc1b44350860d0dcdde789cf0
  Complete output (27 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/__init__.py -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/awesome_cossim_topn.py -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  running egg_info
  writing manifest file 'sparse_dot_topn.egg-info/SOURCES.txt'
  copying sparse_dot_topn/array_wrappers.pxd -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/array_wrappers.pyx -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/sparse_dot_topn.pyx -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/sparse_dot_topn_parallel.h -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/sparse_dot_topn_source.h -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  copying sparse_dot_topn/sparse_dot_topn_threaded.pyx -> build/lib.linux-x86_64-3.7/sparse_dot_topn
  running build_ext
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/sparse_dot_topn
  /usr/local/bin/gcc-8 -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m -I/tmp/pip-build-env-6grtk5m0/normal/lib64/python3.7/site-packages/numpy/core/include -c ./sparse_dot_topn/array_wrappers.cpp -o build/temp.linux-x86_64-3.7/./sparse_dot_topn/array_wrappers.o -std=c++0x -pthread -O3
  /tmp/pip-build-env-6grtk5m0/normal/lib64/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-dr3dy2db/sparse-dot-topn_a4e8b8ecc1b44350860d0dcdde789cf0/sparse_dot_topn/array_wrappers.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)
  /tmp/pip-build-env-6grtk5m0/normal/lib64/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-dr3dy2db/sparse-dot-topn_a4e8b8ecc1b44350860d0dcdde789cf0/sparse_dot_topn/sparse_dot_topn.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  /tmp/pip-build-env-6grtk5m0/normal/lib64/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-dr3dy2db/sparse-dot-topn_a4e8b8ecc1b44350860d0dcdde789cf0/sparse_dot_topn/sparse_dot_topn_threaded.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command '/usr/local/bin/gcc-8' failed: No such file or directory: '/usr/local/bin/gcc-8'
  ----------------------------------------
  ERROR: Failed building wheel for sparse-dot-topn
Failed to build sparse-dot-topn
ERROR: Could not build wheels for sparse-dot-topn, which is required to install pyproject.toml-based projects
FlyingTeller
  • 17,638
  • 3
  • 38
  • 53

1 Answers1

0

For me what worked is to ensure the numpy version is 1.19.5. Also ensure cython is installed as per the official documentation

pip install cython
pip install numpy==1.19.5
pip install sparse-dot-topn