DCASE-REPO / DESED_task

Domestic environment sound event detection task
MIT License
126 stars 67 forks source link

numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' #109

Closed chumingqian closed 3 weeks ago

chumingqian commented 4 weeks ago

hello, there: When do the pip install -e ../../. commond, i meet the follwoing problem. Is anyone meet this problem, i just try the dcase2023_task4:

my numpy version =1.22.4


    from sed_scores_eval.base_modules.cy_medfilt import cy_medfilt
  File "sed_scores_eval/base_modules/cy_medfilt.pyx", line 1, in init sed_scores_eval.base_modules.cy_medfilt
ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).
Name: numpy
Version: 1.22.4
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.

Requires: 
Required-by: Bottleneck, contourpy, dcase-util, desed, h5py, jams, lazy-dataset, librosa, matplotlib, mir-eval, mkl-fft, mkl-random, musdb, museval, numba, numexpr, pandas, psds-eval, pyloudnorm, pytorch-lightning, resampy, scaper, scikit-learn, scipy, sed-eval, sed_scores_eval, sox, soxr, stempeg, tensorboard, torchmetrics, torchvision
---
Name: Cython
Version: 3.0.11
Summary: The Cython compiler for writing C extensions in the Python language
chumingqian commented 3 weeks ago

in the other environment, the numpy version =1.24.3 , did not appear this error.

chumingqian commented 1 week ago

i change the setup.py, then do the python3 setup.up, it will generate 2 ".so" file,
copy them to this path anaconda3/envs/SoundDetection/lib/python3.8/site-packages/sed_scores_eval/base_modules


from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy as np
import os

# Ensure the output directory exists
os.makedirs("sed_scores_eval/base_modules", exist_ok=True)

extensions = [
    Extension(
        name="sed_scores_eval.base_modules.cy_detection",
        sources=["/home/yourPcName/anaconda3/envs/SoundDetection/lib/python3.8/site-packages/sed_scores_eval/base_modules/cy_detection.pyx"],
        #sources=["sed_scores_eval/base_modules/cy_detection.pyx"],
        include_dirs=[np.get_include()]
    ),

    Extension(
        name="sed_scores_eval.base_modules.cy_medfilt",
        sources=["/home/yourPcName/anaconda3/envs/SoundDetection/lib/python3.8/site-packages/sed_scores_eval/base_modules/cy_medfilt.pyx"],
        #sources=["sed_scores_eval/base_modules/cy_medfilt.pyx"],
        include_dirs=[np.get_include()],
    )

]

setup(
    name="desed_task",
    version="0.1.1",
    description="Sound Event Detection and Separation in Domestic Environments.",
    author="DCASE Task 4 Organizers",
    author_email="romain.serizel@loria.fr",
    license="MIT",
    packages=["desed_task"],
    python_requires=">=3.8",
    install_requires=[
        "dcase_util>=0.2.16",
        "psds_eval>=0.4.0",
        "sed_eval>=0.2.1",
        "sed_scores_eval>=0.0.0",
    ],
    ext_modules=cythonize(extensions),
    zip_safe=False,
)