pytrec_eval: Pip install error on windows 10, possible hardcoded path

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).

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 8
  • Comments: 19 (8 by maintainers)

Most upvoted comments

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]

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

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

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

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

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