cvangysel / pytrec_eval

pytrec_eval is an Information Retrieval evaluation tool for Python, based on the popular trec_eval.
http://ilps.science.uva.nl/
MIT License
282 stars 32 forks source link

Pip install error on windows 10, possible hardcoded path #32

Open Alkouf opened 3 years ago

Alkouf commented 3 years ago

Hello, I got a series of errors like this:

File "C:\Users\myusername\AppData\Local\Continuum\anaconda3\lib\distutils\util.py", line 111, in convert_path raise ValueError("path '%s' cannot be absolute" % pathname) ValueError: path '/Users/cvangysel/Projects/pytrec_eval/trec_eval/convert_zscores.c' cannot be absolute

when I ran pip install pytrec-eval

It seems that the absolute path is hardcoded somewhere. I modified the util.py file to ignore the prefix '/Users/cvangysel/Projects/pytrec_eval/trec_eval/' and the installation seems to be successful (the example on README.md ran correctly).

JonathanSamelson commented 3 years ago

Hi, I got exactly the same error and did just like you, thank you!

in anaconda3\lib\distutils\util.py, I commented those lines to make it work:

def convert_path (pathname):
    """Return 'pathname' as a name that will work on the native filesystem,
    i.e. split it on '/' and put it back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    """
    if os.sep == '/':
        return pathname
    if not pathname:
        return pathname
#  if pathname[0] == '/':
#       raise ValueError("path '%s' cannot be absolute" % pathname)
    if pathname[-1] == '/':
        raise ValueError("path '%s' cannot end with '/'" % pathname)

Also, in case it can help anyone else, I got another problem: VS14.0 link.exe failed with exit status 1158

I simply copy paste rc.exe and rc.dll from C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64 (or another build version) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64

Alkouf commented 3 years ago

Happy to help. Just to clarify, I only removed the prefix (the path) but kept the actual name of the file. E.g. "/Users/cvangysel/Projects/pytrec_eval/trec_eval/convert_zscores.c" --> "convert_zscores.c"

Something like:

if pathname.startswith("/Users/cvangysel/Projects/pytrec_eval/trec_eval/"):
    pathname = pathname.split("/")[-1]
cmacdonald commented 3 years ago

I created the Windows build for pytrec_eval. I'm not sure where you error has some from

However, I'm investigating Windows binary distributions. This works for me on Python 3.8 on Windows. pip install -i https://test.pypi.org/simple/ pytrec-eval-craigm==0.5.20210329143631

cmacdonald commented 3 years ago

Using our fork, pip install pytrec-eval-terrier now works on Window, Mac and Linux without compiling. Work by @seanmacavaney and myself.

ByShui commented 2 years ago

Thank you! JonathanSamelson and Alkouf. I got exactly the same error and did just like you.

junefeld commented 2 years ago

also having issues with windows 10 python 3.9. Unfortunately, package is a dependency for other packages.... Any other suggestions?

seanmacavaney commented 2 years ago

@christopherfeld -- have you tried instaling the pytrec-eval-terrier fork listed above? A GA build suggests that it works for Windows on Python 3.9.

(The fork is imported as as pytrec_eval, so no changes to code are required to use these builds.)

junefeld commented 2 years ago

Yes, I was able to get that fork to install. However, when I pip install for the key package I want (pip install gdl) it still forces me over to this repo.

cmacdonald commented 2 years ago

Perhaps you could submit a PR to ask them to change to the Windows compatible fork then?

junefeld commented 2 years ago

Great idea! Will do, thanks all!

Update for posterity: I tried running python 3.6-3.9 to no avail. I was able to take the package yml (gpl for my use case) with some light edit and do individual installs for the Beirs and pytrec-eval dependencies (used pytrec-eval-terrier and a conda no-deps flag on the Beirs build).

LukasKriesch commented 1 year ago

Hi, I'm facing the same issues. Are there any updates on that? Or can you @junefeld provide more detail on how you managed the installation? Thanks!

cmacdonald commented 1 year ago

@LukasKriesch What is the problem you are experiencing? the pytrec-eval-terrier fork should work fine.

LukasKriesch commented 1 year ago

@cmacdonald the fork works fine for me. but when i want to install the key package (also gpl) it still installs the standard pytrec-eval version and then crashes.

cmacdonald commented 1 year ago

I made a fork of GPL to change the underlying pytrec_eval

You can try to install it yourself https://github.com/cmacdonald/gpl/tree/patch-1

Craig

LukasKriesch commented 1 year ago

Thanks @cmacdonald I installed the fork but still facing the same issue as the standard version of pytrec_eval is installed even though the dependencies are changed in the yaml file

cmacdonald commented 1 year ago

I cant support gpl. You can try to update my fork.

J-kk911 commented 9 months ago

Thank you very much!

JoTeq-Work commented 4 months ago

Found a solution to the "pytrec_eval" error problem

This worked for me in Amazon SageMaker

cmacdonald commented 4 months ago

@JoTeq-Work Can you make a PR to the beir repo? We (@seanmacavaney and I) maintain pytrec-eval-terrier (with binary releases) while this repo is not maintained, and there are no binary releases.