sbelharbi/fcam-wsol

ImportError: numpy.core.multiarray failed to import

Closed this issue · 2 comments

I've downloaded all the necessary requirements and dependencies, but ultimately I'm ending up with this error after running the following command:

time python main_wsol.py --task STD_CL \
                         --encoder_name resnet50 \
                         --arch STDClassifier \
                         --opt__name_optimizer sgd \
                         --batch_size 32 \
                         --opt__step_size 15 \
                         --opt__gamma 0.1 \
                         --max_epochs 50 \
                         --freeze_cl False \
                         --support_background True \
                         --method CAM \
                         --spatial_pooling WGAP \
                         --dataset CUB \
                         --box_v2_metric False \
                         --cudaid $cudaid \
                         --debug_subfolder None \
                         --opt__lr 0.0017 \
                         --exp_id 08_19_2021_14_05_20_620912__6229687

The error:

RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
Traceback (most recent call last):
  File "/mnt/DATA/fcam-wsol/main_wsol.py", line 5, in <module>
    from dlib.process.parseit import parse_input
  File "/mnt/DATA/fcam-wsol/dlib/__init__.py", line 25, in <module>
    from dlib import losses
  File "/mnt/DATA/fcam-wsol/dlib/losses/__init__.py", line 16, in <module>
    from dlib.losses.core import MasterLoss
  File "/mnt/DATA/fcam-wsol/dlib/losses/core.py", line 14, in <module>
    from dlib.crf.dense_crf_loss import DenseCRFLoss
  File "/mnt/DATA/fcam-wsol/dlib/crf/dense_crf_loss.py", line 21, in <module>
    from bilateralfilter import bilateralfilter, bilateralfilter_batch
  File "/home/iit/anaconda3/envs/F_CAM/lib/python3.9/site-packages/bilateralfilter-0.1-py3.9-linux-x86_64.egg/bilateralfilter.py", line 15, in <module>
    import _bilateralfilter
ImportError: numpy.core.multiarray failed to import

I am assuming that it is an error related to the versions of Numpy but I am not able to come to a proper conclusion.

hi,
i recommend to remove numpy, and reinstall it. after that, remove then rebuild crf. it looks crf package didnt like the numpy version you are using.
double check the versions in the requirements file.
make sure you are doing package installation within the right virtual environment.
installing some package may downgrade or upgrade some other packages.

thanks

Hey!

The issue has been resolved. I have completely closed the terminal and installed the python packages again using setup.py. I have also removed numpy and reinstalled it again.

Thanks!