LeonYang95/PLELog

PLElog.py running problem(numpy version)

Closed this issue · 3 comments

Hello, Dr. Yang. I mentioned the problem of library conflicts in # issue19. You removed the required version of numpy. I tested it today and found that it entered an endless cycle.
Numpy=1.21.2 is compatible with mkl_fft=1.3.1 and mkl_random=1.2.2, provided that numpy, mkl_fft and mkl_random cannot be installed with requirement.txt. When I tested it, I installed numpy=1.21.2 first, and then installed mkl_fft and mkl_random manually, thus solving this problem.
When I thought everything ok, I found that PLElog still can not run, the program gave me an error: ValueError: numpy.ndarray size changed, may indicate binary incompatibility.
Expected 96 from C header, got 88 from PyObject .
I checked this problem because the numpy version is too low, and when you upgrade numpy, you will get an error: RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf.
I found the answer to this question in the rest of the github code: lower the version of numpy, tensorflow/tensorflow#57106 he reduced the numpy version from 1.22.4 to 1.21.
in this situation, I don't know how to run the code, and I hope you take the time to look at this problem.thanks a lot.

(1)problem will happen when i changed numpy version from 1.21.2 to 1.22.4 :

Traceback (most recent call last):
File "F:\code\PLELog\approaches\PLELog.py", line 9, in
from preprocessing.AutoLabeling import Probabilistic_Labeling
File "F:\code\PLELog\preprocessing\AutoLabeling.py", line 3, in
from models.clustering import Solitary_HDBSCAN
File "F:\code\PLELog\models\clustering.py", line 7, in
from hdbscan import HDBSCAN as dbscan
File "E:\app\anaconda\envs\PLElog_py\lib\site-packages\hdbscan_init_.py", line 1, in
from .hdbscan_ import HDBSCAN, hdbscan
File "E:\app\anaconda\envs\PLElog_py\lib\site-packages\hdbscan\hdbscan_.py", line 21, in
from ._hdbscan_linkage import (single_linkage,
File "hdbscan/_hdbscan_linkage.pyx", line 1, in init hdbscan._hdbscan_linkage
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

(2)problem will happen when i changed numpy version from 1.22.4 to 1.21.2:

2023-05-18 23:45:45,332 - Statistics_Template_Encoder - SESSION_fbd73c53bc62b07b79da9e657917a461 - INFO: Construct Statistics Template Encoder success, current working directory: F:\code\PLELog\approaches, logs will be written in F:\code\PLELog\logs
2023-05-18 23:45:45,354 - StatisticsRepresentation. - SESSION_fbd73c53bc62b07b79da9e657917a461 - INFO: Construct StatisticsLogger success, current working directory: F:\code\PLELog\approaches, logs will be written in F:\code\PLELog\logs
Traceback (most recent call last):
File "init.pxd", line 882, in numpy.import_array
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem .

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:\code\PLELog\approaches\PLELog.py", line 9, in
from preprocessing.AutoLabeling import Probabilistic_Labeling
File "F:\code\PLELog\preprocessing\AutoLabeling.py", line 3, in
from models.clustering import Solitary_HDBSCAN
File "F:\code\PLELog\models\clustering.py", line 7, in
from hdbscan import HDBSCAN as dbscan
File "E:\app\anaconda\envs\PLElog_py\lib\site-packages\hdbscan_init_.py", line 1, in
from .hdbscan_ import HDBSCAN, hdbscan
File "E:\app\anaconda\envs\PLElog_py\lib\site-packages\hdbscan\hdbscan_.py", line 21, in
from ._hdbscan_linkage import (single_linkage,
File "hdbscan/_hdbscan_linkage.pyx", line 1, in init hdbscan._hdbscan_linkage
File "hdbscan/dist_metrics.pyx", line 13, in init hdbscan.dist_metrics
File "init.pxd", line 884, in numpy.import_array
ImportError: numpy.core.multiarray failed to import

Process finished with exit code 1

The requirements.txt file was exported from my anaconda environment. Honestly, I have no idea what do mkl_fft and mkl_random do, at least they are not required by PLELog.

I understand that this project was build 2 years ago, and the packages are definitely upgrading during this period. Therefore, my suggestion is, you can try to ignore all version requirements, and install the required package via conda or pipdirectly. Hopefully, they will take care of the version problem. You can start with Pytorch, HDBSCAN and Override.

I will try to recover the old environment, and if possible, I may upload a docker image to the dockerhub for future usage.

thanks a lot, docker image is a good choice, I will continue to try as you suggest

I solved this problem by conda and pip command. if you are experiencing the same problem as me, maybe try this method instead of installing through the requirement .txt