MTG / essentia

C++ library for audio and music analysis, description and synthesis, including Python bindings
http://essentia.upf.edu
GNU Affero General Public License v3.0
2.85k stars 533 forks source link

Strange build error "KeyError: /home/skrowten-hermit/work/audioprism/lib/essentia" and "TypeError: expected str, bytes or os.PathLike object, not Nod3" #1043

Closed skrowten-hermit closed 4 years ago

skrowten-hermit commented 4 years ago

Having successfully configured using python3 waf configure as shown below:

skrowten-hermit@HOLY-DIVER-W10LT:~/work/audioprism/lib/essentia$ python3 waf configure --build-static --with-python --with-cpptests --with-examples --with-vamp --with-tensorflow --mode=debug --with-gaia
Setting top to                           : /home/skrowten-hermit/work/audioprism/lib/essentia
Setting out to                           : /home/skrowten-hermit/work/audioprism/lib/essentia/build
→ configuring the project in /home/skrowten-hermit/work/audioprism/lib/essentia
→ Building in debug mode
Checking for 'g++' (C++ compiler)        : /usr/bin/g++
Checking for 'gcc' (C compiler)          : /usr/bin/gcc
Checking for program 'pkg-config'        : /usr/bin/pkg-config
Checking for 'eigen3'                    : yes
Checking for 'libavcodec' >= 55.34.1     : yes
Checking for 'libavformat'               : yes
Checking for 'libavutil'                 : yes
Checking for 'libavresample'             : yes
Checking for 'samplerate'                : yes
Checking for 'taglib' >= 1.9             : yes
Checking for 'yaml-0.1'                  : yes
Checking for 'fftw3f'                    : yes
Checking for 'libchromaprint'            : yes
Checking for 'gaia2'                     : yes
Checking for 'tensorflow'                : yes
Checking for 'gcc' (C compiler)          : /usr/bin/gcc
Checking for program 'python'            : /usr/bin/python3
Checking for python version >= 2.7.0     : 3.6.9
→ Configuring for python3
python-config                            : /usr/bin/python3-config
Asking python-config for pyext '--cflags --libs --ldflags' flags : yes
Testing pyext configuration                                      : yes
Checking for python module 'numpy'                               : 1.19.1

================================ CONFIGURATION SUMMARY ================================
- using FFTW for FFT

- fftw detected!
- FFmpeg / libav detected!
- libsamplerate (SRC) detected!
  The following algorithms will be included: ['Resample', 'AudioLoader', 'AudioWriter', 'EasyLoader', 'MonoWriter', 'MonoLoader', 'EqloudLoader']

- TagLib detected!
  The following algorithms will be included: ['MetadataReader', 'MusicExtractor', 'FreesoundExtractor']

- libyaml detected!
  The following algorithms will be included: ['YamlInput', 'YamlOutput']

- Gaia2 detected!
  The following algorithms will be included: ['GaiaTransform', 'MusicExtractorSVM']

- Chromaprint detected!
  The following algorithms will be included: ['Chromaprinter']

- Tensorflow detected!
  The following algorithms will be included: ['TensorflowPredict', 'TensorflowPredictMusiCNN', 'TensorflowPredictVGGish', 'TensorflowPredictTempoCNN', 'TempoCNN']

- Compiling 56 examples
  standard_beatsmarker, standard_fadedetection, standard_mfcc, standard_onsetrate, standard_pitchdemo, standard_rhythmtransform, standard_spectralcontrast, standard_vibrato, standard_harmonicmodel, standard_hpsmodel, standard_hprmodel, standard_predominantmask, standard_sinemodel, standard_sinesubtraction, standard_sprmodel, standard_spsmodel, standard_stft, standard_stochasticmodel, standard_chromaprinter, standard_pca, standard_discontinuitydetector, standard_extractor_la-cupula, standard_gapsdetector, standard_humdetector, standard_loudnessebur128_double_input, standard_saturationdetector, standard_snr, standard_welch, streaming_humdetector, standard_crosssimilaritymatrix, standard_chromacrosssimilarity, standard_coversongsimilarity, streaming_beatsmarker, streaming_beattracker_multifeature_mirex2013, streaming_key, streaming_gfcc, streaming_md5, streaming_mfcc, streaming_spectrogram, streaming_rhythmextractor_multifeature, streaming_onsetrate, streaming_panning, streaming_pitchyinfft, streaming_predominantpitchmelodia, streaming_chromacrosssimilarity, streaming_coversongsimilarity, streaming_stft, streaming_tuningfrequency, streaming_vibrato, streaming_tensorflowpredict, streaming_yinprobabilistic, streaming_musicnn_predict, streaming_vggish_predict, streaming_extractor_music, streaming_extractor_freesound, streaming_extractor_music_svm
Building all the algorithms
Ignoring the following algorithms: IFFTK, FFTAComplex, IFFTAComplex, IFFTA, IFFTKComplex, FFTA, FFTK, FFTKComplex
Created algorithms registration file

---------------------------------------------------------------------------------------
- Building static library
- Building Python extension
- Building examples
- Building Vamp plugin
=======================================================================================
'configure' finished successfully (9.014s)

I'm getting the errors KeyError: /home/skrowten-hermit/work/audioprism/lib/essentia and TypeError: expected str, bytes or os.PathLike object, not Nod3 during build step as shown below:

skrowten-hermit@HOLY-DIVER-W10LT:~/work/audioprism/lib/essentia$ python3 waf
Waf: Entering directory `/home/skrowten-hermit/work/audioprism/lib/essentia/build'
→ building from /home/skrowten-hermit/work/audioprism/lib/essentia
→ building from /home/skrowten-hermit/work/audioprism/lib/essentia/src
Building all the algorithms
Ignoring the following algorithms: FFTA, IFFTKComplex, FFTKComplex, FFTK, IFFTAComplex, IFFTA, FFTAComplex, IFFTK
Created algorithms registration file
Traceback (most recent call last):
  File "/usr/lib/python3.6/pkgutil.py", line 412, in get_importer
    importer = sys.path_importer_cache[path_item]
KeyError: /home/skrowten-hermit/work/audioprism/lib/essentia

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Scripting.py", line 119, in waf_entry_point
    run_commands()
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Scripting.py", line 182, in run_commands
    ctx=run_command(cmd_name)
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Scripting.py", line 173, in run_command
    ctx.execute()
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Scripting.py", line 375, in execute
    return execute_method(self)
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Build.py", line 93, in execute
    self.execute_build()
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Build.py", line 96, in execute_build
    self.recurse([self.run_dir])
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Context.py", line 126, in recurse
    user_function(self)
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/wscript", line 315, in build
    ctx.recurse('src')
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Context.py", line 126, in recurse
    user_function(self)
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/src/wscript", line 571, in build
    ctx.recurse('examples')
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Context.py", line 120, in recurse
    wscript_module=load_module(node.abspath(),encoding=encoding)
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/.waf3-2.0.18-77b2fa32f72970f15a949a4a564841e2/waflib/Context.py", line 355, in load_module
    exec(compile(code,path,'exec'),module.__dict__)
  File "/home/skrowten-hermit/work/audioprism/lib/essentia/src/examples/wscript", line 6, in <module>
    import distutils.sysconfig
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "/usr/local/lib/python3.6/dist-packages/_distutils_hack/__init__.py", line 82, in create_module
    return importlib.import_module('._distutils', 'setuptools')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/usr/local/lib/python3.6/dist-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3238, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3222, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3251, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 558, in _build_master
    ws = cls()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 551, in __init__
    self.add_entry(entry)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 607, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 1961, in find_distributions
    importer = get_importer(path_item)
  File "/usr/lib/python3.6/pkgutil.py", line 416, in get_importer
    importer = path_hook(path_item)
TypeError: expected str, bytes or os.PathLike object, not Nod3

How can I fix this? Tried Googling and it seemed to suggest issues with setuptools. But when trying to upgrade it shows it's already the latest version. It would be great if someone could help me fix this.

skrowten-hermit commented 4 years ago

@dbogdanov and @pabloEntropia Could you guys please give me a few pointers on how to fix this error?

skrowten-hermit commented 4 years ago

I don't know how, but the following seems to fix the above issue:

skrowten-hermit@HOLY-DIVER-W10LT:~/work/audioprism/lib/essentia$ sudo pip3 install --upgrade setuptools
[sudo] password for skrowten-hermit:
WARNING: The directory '/home/skrowten-hermit/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools
  Downloading setuptools-50.1.0-py3-none-any.whl (784 kB)
     |████████████████████████████████| 784 kB 65 kB/s
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 50.0.0
    Uninstalling setuptools-50.0.0:
      Successfully uninstalled setuptools-50.0.0
Successfully installed setuptools-50.1.0

After the above, compilation is done successfully using python3 waf. The errors mentioned above are not thrown anymore.