question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installation error with editdistance and matplotlib on debian 11 with python3.9

See original GitHub issue

Getting error when trying to install editdistance and matplotlib packages.

check_install.py output

[x] python=3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1 20210110]

Python modules:
[x] torch=1.10.1+cpu
[ ] torch cuda
[ ] torch cudnn
[ ] torch nccl
[ ] chainer
[ ] cupy
[x] torchaudio=0.10.1+cpu
[ ] torch_optimizer
[ ] warpctc_pytorch
[ ] warprnnt_pytorch
[ ] chainer_ctc
[ ] pyopenjtalk
[ ] tdmelodic_pyopenjtalk
[ ] kenlm
[ ] mmseg
[ ] espnet
[ ] fairseq
[ ] phonemizer
[ ] gtn
[ ] s3prl
[ ] transformers
[ ] speechbrain
[ ] k2
[ ] longformer
[ ] nlg-eval
[ ] datasets

Executables:
[ ] sclite
[ ] sph2pipe
[ ] PESQ
[ ] BeamformIt

INFO:
Use 'installers/install_warp-ctc.sh' to install warpctc_pytorch
Use 'installers/install_warp-transducer.sh' to install warprnnt_pytorch
Use 'installers/install_chainer_ctc.sh' to install chainer_ctc
Use 'installers/install_pyopenjtalk.sh' to install pyopenjtalk
Use 'installers/install_tdmelodic_pyopenjtalk.sh' to install tdmelodic_pyopenjtalk
Use 'installers/install_kenlm.sh' to install kenlm
Use 'installers/install_py3mmseg.sh' to install mmseg
Use 'installers/install_fairseq.sh' to install fairseq
Use 'installers/install_phonemizer.sh' to install phonemizer
Use 'installers/install_gtn.sh' to install gtn
Use 'installers/install_s3prl.sh' to install s3prl
Use 'installers/install_transformers.sh' to install transformers
Use 'installers/install_speechbrain.sh' to install speechbrain
Use 'installers/install_k2.sh' to install k2
Use 'installers/install_longformer.sh' to install longformer
Use 'installers/install_longformer.sh' to install nlg-eval
Use 'installers/install_longformer.sh' to install datasets
Use 'installers/install_sctk.sh' to install sclite
Use 'installers/install_sph2pipe.sh' to install sph2pipe
Use 'installers/install_pesq.sh' to install PESQ
Use 'installers/install_beamformit.sh' to install BeamformIt

Basic environments:

- OS information: Linux 5.14.0-0.bpo.2-amd64 #1 SMP Debian 5.14.9-2~bpo11+1 (2021-10-10) x86_64
- python version: `3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1 20210110]`
- espnet version: `espnet 0.10.7a1`
- pytorch version: `pytorch 1.11.0+cu102`
- Git hash: `55b045b286f658eebe044a432d030998fbb375e4`
  - Commit date: `Fri Apr 8 21:16:19 2022 +0800`
 

Environments from torch.utils.collect_env:

PyTorch version: 1.11.0+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 11 (bullseye) (x86_64)
GCC version: (Debian 10.2.1-6) 10.2.1 20210110
Clang version: Could not collect
CMake version: version 3.18.4
Libc version: glibc-2.31

Python version: 3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1 20210110] (64-bit runtime)
Python platform: Linux-5.14.0-0.bpo.2-amd64-x86_64-with-glibc2.31
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.22.3
[pip3] numpy-groupies==0+unknown
[pip3] pytorch-wpe==0.0.1
[pip3] torch==1.11.0
[pip3] torch-complex==0.4.3
[pip3] torchaudio==0.11.0
[conda] Could not collect

To Reproduce

cd <espnet-root>/tools
make

Error logs

Building wheels for collected packages: editdistance, matplotlib
  Building wheel for editdistance (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [103 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      creating build/lib.linux-x86_64-3.9/editdistance
      copying editdistance/__init__.py -> build/lib.linux-x86_64-3.9/editdistance
      copying editdistance/_editdistance.h -> build/lib.linux-x86_64-3.9/editdistance
      copying editdistance/def.h -> build/lib.linux-x86_64-3.9/editdistance
      running build_ext
      building 'editdistance.bycython' extension
      creating build/temp.linux-x86_64-3.9
      creating build/temp.linux-x86_64-3.9/editdistance
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./editdistance -I/home/nik/github/espnet/tools/venv/include -I/usr/include/python3.9 -c editdistance/_editdistance.cpp -o build/temp.linux-x86_64-3.9/editdistance/_editdistance.o
      In file included from /usr/include/c++/10/vector:68,
                       from editdistance/_editdistance.cpp:20:
      /usr/include/c++/10/bits/stl_bvector.h:75:5: error: ‘OBit_type’ does not name a type
         75 |     OBit_type _M_mask;
            |     ^~~~~~~~~
      ....
      editdistance/_editdistance.cpp:97:67:   required from ‘unsigned int edit_distance_map_(const int64_t*, size_t, const int64_t*, size_t) [with long unsigned int N = 10; int64_t = long int; size_t = long unsigned int]’
      editdistance/_editdistance.cpp:128:80:   required from here
      editdistance/_editdistance.cpp:44:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const unsigned int’ [-Wsign-compare]
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for editdistance
  Running setup.py clean for editdistance
  Building wheel for matplotlib (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [539 lines of output]
      ================================================================================
      Edit setup.cfg to change the build options
      
      BUILDING MATPLOTLIB
        matplotlib: yes [3.1.0]
            python: yes [3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1
                        20210110]]
          platform: yes [linux]
      
      OPTIONAL SUBPACKAGES
       sample_data: yes [installing]
             tests: no  [skipping due to configuration]
      
      OPTIONAL BACKEND EXTENSIONS
               agg: yes [installing]
             tkagg: yes [installing; run-time loading from Python Tcl/Tk]
            macosx: no  [Mac OS-X only]
      
      OPTIONAL PACKAGE DATA
              dlls: no  [skipping due to configuration]
      
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      copying lib/pylab.py -> build/lib.linux-x86_64-3.9
      creating build/lib.linux-x86_64-3.9/mpl_toolkits
      copying lib/mpl_toolkits/__init__.py -> build/lib.linux-x86_64-3.9/mpl_toolkits
      creating build/lib.linux-x86_64-3.9/matplotlib
      ...
     
      creating build/temp.linux-x86_64-3.9/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -I/home/nik/github/espnet/tools/venv/lib/python3.9/site-packages/numpy/core/include -I/home/nik/github/espnet/tools/venv/include -I/usr/include/python3.9 -c src/checkdep_freetype2.c -o build/temp.linux-x86_64-3.9/src/checkdep_freetype2.o -I/usr/include/freetype2 -I/usr/include/libpng16
      src/checkdep_freetype2.c:7:9: note: ‘#pragma message: Compiling with FreeType version 2.10.4.’
          7 | #pragma message("Compiling with FreeType version " \
            |         ^~~~~~~
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -I/home/nik/github/espnet/tools/venv/lib/python3.9/site-packages/numpy/core/include -I/home/nik/github/espnet/tools/venv/include -I/usr/include/python3.9 -c src/ft2font.cpp -o build/temp.linux-x86_64-3.9/src/ft2font.o -I/usr/include/freetype2 -I/usr/include/libpng16
      In file included from /usr/include/c++/10/vector:68,
                       from src/ft2font.h:6,
                       from src/ft2font.cpp:9:
      /usr/include/c++/10/bits/stl_bvector.h:75:5: error: ‘OBit_type’ does not name a type
         75 |     OBit_type _M_mask;
            |     ^~~~~~~~~
      /usr/include/c++/10/bits/stl_bvector.h: In constructor ‘std::_Bit_reference::_Bit_reference(std::_Bit_type*, std::_Bit_type)’:
      /usr/include/c++/10/bits/stl_bvector.h:78:18: error: class ‘std::_Bit_reference’ does not have any field named ‘_M_mask’
         78 |     : _M_p(__x), _M_mask(__y) { }
            |                  ^~~~~~~
      /usr/include/c++/10/bits/stl_bvector.h: In constructor ‘std::_Bit_reference::_Bit_reference()’:
      /usr/include/c++/10/bits/stl_bvector.h:80:51: error: class ‘std::_Bit_reference’ does not have any field named ‘_M_mask’
         80 |     _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { }
            |                                                   ^~~~~~~
      /usr/include/c++/10/bits/stl_bvector.h: In member function ‘std::_Bit_reference::operator bool() const’:
      /usr/include/c++/10/bits/stl_bvector.h:87:25: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
         87 |     { return !!(*_M_p & _M_mask); }
            |                         ^~~~~~~
            |                         fd_mask
      /usr/include/c++/10/bits/stl_bvector.h: In member function ‘std::_Bit_reference& std::_Bit_reference::operator=(bool)’:
      /usr/include/c++/10/bits/stl_bvector.h:93:11: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
         93 |  *_M_p |= _M_mask;
            |           ^~~~~~~
            |           fd_mask
      /usr/include/c++/10/bits/stl_bvector.h:95:12: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
         95 |  *_M_p &= ~_M_mask;
            |            ^~~~~~~
            |            fd_mask
      /usr/include/c++/10/bits/stl_bvector.h: In member function ‘void std::_Bit_reference::flip()’:
      /usr/include/c++/10/bits/stl_bvector.h:113:16: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
        113 |     { *_M_p ^= _M_mask; }
            |                ^~~~~~~
            |                fd_mask
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for matplotlib
  Running setup.py clean for matplotlib
Failed to build editdistance matplotlib
Installing collected packages: editdistance, distance, certifi, audioread, appdirs, zipp, werkzeug, urllib3, unidecode, typeguard, tqdm, torch_complex, threadpoolctl, tensorboard-data-server, soupsieve, smmap, six, simplejson, shortuuid, setproctitle, scipy, rsa, regex, PyYAML, pytorch_wpe, PySocks, pyrsistent, pypinyin, pyparsing, pycparser, pyasn1-modules, psutil, protobuf, portalocker, pillow, oauthlib, llvmlite, kiwisolver, kaldiio, joblib, inflect, idna, humanfriendly, h5py, future, filelock, fastdtw, decorator, Cython, cycler, configargparse, colorama, click, charset-normalizer, cachetools, bottleneck, attrs, sentry-sdk, scikit-learn, sacrebleu, requests, pyworld, python-dateutil, pystoi, pysptk, pyaml, promise, packaging, numba, nltk, mir-eval, jsonschema, importlib-metadata, grpcio, google-auth, gitdb, ffmpeg-python, docker-pycreds, ctc-segmentation, ci_sdr, cffi, beautifulsoup4, absl-py, stempeg, soundfile, resampy, requests-oauthlib, pooch, pandas, nnmnkwii, matplotlib, markdown, huggingface-hub, GitPython, g2p-en, wandb, nara_wpe, musdb, librosa, google-auth-oauthlib, gdown, espnet_tts_frontend, tensorboard, museval, espnet, espnet_model_zoo
  Running setup.py install for editdistance ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for editdistance did not run successfully.
  │ exit code: 1
  ╰─> [103 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      creating build/lib.linux-x86_64-3.9/editdistance
      copying editdistance/__init__.py -> build/lib.linux-x86_64-3.9/editdistance
      copying editdistance/_editdistance.h -> build/lib.linux-x86_64-3.9/editdistance
      copying editdistance/def.h -> build/lib.linux-x86_64-3.9/editdistance
      running build_ext
      building 'editdistance.bycython' extension
      creating build/temp.linux-x86_64-3.9
      creating build/temp.linux-x86_64-3.9/editdistance
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./editdistance -I/home/nik/github/espnet/tools/venv/include -I/usr/include/python3.9 -c editdistance/_editdistance.cpp -o build/temp.linux-x86_64-3.9/editdistance/_editdistance.o
      In file included from /usr/include/c++/10/vector:68,
                       from editdistance/_editdistance.cpp:20:
      /usr/include/c++/10/bits/stl_bvector.h:75:5: error: ‘OBit_type’ does not name a type
         75 |     OBit_type _M_mask;
            |     ^~~~~~~~~
      /usr/include/c++/10/bits/stl_bvector.h: In constructor ‘std::_Bit_reference::_Bit_reference(std::_Bit_type*, std::_Bit_type)’:
      /usr/include/c++/10/bits/stl_bvector.h:78:18: error: class ‘std::_Bit_reference’ does not have any field named ‘_M_mask’
         78 |     : _M_p(__x), _M_mask(__y) { }
            |                  ^~~~~~~
      /usr/include/c++/10/bits/stl_bvector.h: In constructor ‘std::_Bit_reference::_Bit_reference()’:
      /usr/include/c++/10/bits/stl_bvector.h:80:51: error: class ‘std::_Bit_reference’ does not have any field named ‘_M_mask’
         80 |     _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { }
            |                                                   ^~~~~~~
      /usr/include/c++/10/bits/stl_bvector.h: In member function ‘std::_Bit_reference::operator bool() const’:
      /usr/include/c++/10/bits/stl_bvector.h:87:25: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
         87 |     { return !!(*_M_p & _M_mask); }
            |                         ^~~~~~~
            |                         fd_mask
      /usr/include/c++/10/bits/stl_bvector.h: In member function ‘std::_Bit_reference& std::_Bit_reference::operator=(bool)’:
      /usr/include/c++/10/bits/stl_bvector.h:93:11: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
         93 |  *_M_p |= _M_mask;
            |           ^~~~~~~
            |           fd_mask
      /usr/include/c++/10/bits/stl_bvector.h:95:12: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
         95 |  *_M_p &= ~_M_mask;
            |            ^~~~~~~
            |            fd_mask
      /usr/include/c++/10/bits/stl_bvector.h: In member function ‘void std::_Bit_reference::flip()’:
      /usr/include/c++/10/bits/stl_bvector.h:113:16: error: ‘_M_mask’ was not declared in this scope; did you mean ‘fd_mask’?
        113 |     { *_M_p ^= _M_mask; }
            |                ^~~~~~~
            |                fd_mask
      editdistance/_editdistance.cpp: In instantiation of ‘unsigned int edit_distance_dp(const T*, size_t, const T*, size_t) [with T = long int; size_t = long unsigned int]’:
      editdistance/_editdistance.cpp:129:62:   required from here
     ...
      editdistance/_editdistance.cpp:97:67:   required from ‘unsigned int edit_distance_map_(const int64_t*, size_t, const int64_t*, size_t) [with long unsigned int N = 10; int64_t = long int; size_t = long unsigned int]’
      editdistance/_editdistance.cpp:128:80:   required from here
      editdistance/_editdistance.cpp:44:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const unsigned int’ [-Wsign-compare]
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> editdistance

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
make: *** [Makefile:108: espnet.done] Error 1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
nikolas-ncommented, Apr 13, 2022

The error was due to the gcc compiler used.

Let me explain just in case someone else bumps into the same problem.

This compiler /usr/bin/x86_64-linux-gnu-gcc was linking to gcc-10 but it seems this is not compatible with python3.9(?). I used gcc-9 instead. This is what I did:

# apt install gcc-9 g++-9
# rm /usr/bin/x86_64-linux-gnu-gcc
# ln -s gcc-9 /usr/bin/x86_64-linux-gnu-gcc

I ran make again and it worked.

1reaction
b-flocommented, Apr 11, 2022

Hi,

error: command ‘/usr/bin/x86_64-linux-gnu-gcc’ failed with exit code 1

You’re missing some packages it sems. Try:

sudo apt-get install python3-dev build-essential

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python, Error while installing matplotlib - Stack Overflow
If tried installing matplotlib in 3.10 version of python by pip install matplotlib. Results in : Error: Building wheel for matplotlib ...
Read more >
Installation — Matplotlib 3.6.2 documentation
Installing an official release#. Matplotlib releases are available as wheel packages for macOS, Windows and Linux on PyPI. Install it using pip :....
Read more >
Debian -- Software Packages in "bullseye", Subsection python
Django application for handling CORS. python3-django-countries (6.0-1): provides a country field for Django models (Python3 version); python3-django-crispy- ...
Read more >
editdistance - PyPI
Fast implementation of the edit distance (Levenshtein distance). This library simply implements Levenshtein distance with C++ and Cython.
Read more >
fatal error :"python.h" no file or directory? - Ask Ubuntu
For Python 3: sudo apt-get install python-dev python3-dev. You can also install it for specific versions of Python (if available for your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found