lakritidis / FLAGR

Unsupervised Distance-Based Weighted Rank Aggregation with List Pruning
http://lakritidis.github.io/FLAGR
Other
3 stars 2 forks source link

Unable to load PyFLAGR #2

Open ayushnoori opened 3 months ago

ayushnoori commented 3 months ago

Hi there,

Thank you for creating this valuable rank aggregation package. I am attempting to use PyFLAGR but have encountered an issue when creating the aggregator object. Per the instructions in the documentation, I have installed PyFLAGR with pip install pyflagr. I am also able to load pyflagr with:

# Import the PyFLAGR modules for rank aggregation
import pyflagr.Linear as Linear
import pyflagr.Majoritarian as Majoritarian
import pyflagr.MarkovChains as MarkovChains
import pyflagr.Kemeny as Kemeny
import pyflagr.RRA as RRA
import pyflagr.Weighted as Weighted

However, I cannot define an aggregator. The following line raises an OSError:

csum = Linear.CombSUM(norm='score')
OSError                                   Traceback (most recent call last)
Cell In[26], line 1
----> 1 csum = Linear.CombSUM(norm='score')

File ~/miniforge3/envs/myenv/lib/python3.10/site-packages/pyflagr/Linear.py:12, in CombSUM.__init__(self, norm, eval_pts)
     11 def __init__(self, norm=\"borda\", eval_pts=10):
---> 12     RAM.__init__(self, eval_pts)
     14     self.normalization = norm
     15     self.flagr_lib.Linear.argtypes = [
     16         ctypes.c_char_p,  # Input data file with the lists to be aggregated
     17         ctypes.c_char_p,  # Input data file with the relevant elements per query - used for evaluation
   (...)
     20         ctypes.c_char_p,  # Random string to be embedded into the output file names
     21         ctypes.c_char_p]  # The directory where the output files will be written

File ~/miniforge3/envs/myenv/lib/python3.10/site-packages/pyflagr/RAM.py:41, in RAM.__init__(self, eval_pts)
     38     self.flagr_lib = ctypes.CDLL(os.path.dirname(os.path.realpath(__file__)) + '/flagr.dll')
     40 elif platform == \"darwin\":
---> 41     self.flagr_lib = ctypes.CDLL(os.path.dirname(os.path.realpath(__file__)) + \"/flagr.dylib\")

File ~/miniforge3/envs/myenv/lib/python3.10/ctypes/__init__.py:374, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 self._FuncPtr = _FuncPtr
    373 if handle is None:
--> 374     self._handle = _dlopen(self._name, mode)
    375 else:
    376     self._handle = handle

OSError: dlopen(/Users/an123/miniforge3/envs/myenv/lib/python3.10/site-packages/pyflagr/flagr.dylib, 0x0006): tried: '/Users/an123/miniforge3/envs/myenv/lib/python3.10/site-packages/pyflagr/flagr.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/an123/miniforge3/envs/myenv/lib/python3.10/site-packages/pyflagr/flagr.dylib' (no such file), '/Users/an123/miniforge3/envs/myenv/lib/python3.10/site-packages/pyflagr/flagr.dylib' (no such file)

I would be grateful for your assistance in resolving this issue. Thank you.

MCarzolio2 commented 1 week ago

agree this is an issue for me as well @lakritidis. pyflagr appears to be looking for a flagr.dylib file that does not exist.