pytrec_eval icon indicating copy to clipboard operation
pytrec_eval copied to clipboard

Pip install error on windows 10, possible hardcoded path

Open Alkouf opened this issue 3 years ago • 19 comments

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

Alkouf avatar Mar 12 '21 17:03 Alkouf

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

JonathanSamelson avatar Mar 25 '21 15:03 JonathanSamelson

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]

Alkouf avatar Mar 25 '21 16:03 Alkouf

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 avatar Mar 29 '21 14:03 cmacdonald

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

cmacdonald avatar May 12 '21 11:05 cmacdonald

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

ByShui avatar Dec 27 '21 04:12 ByShui

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

junefeld avatar May 25 '22 23:05 junefeld

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

seanmacavaney avatar May 26 '22 09:05 seanmacavaney

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.

junefeld avatar May 26 '22 16:05 junefeld

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

cmacdonald avatar May 26 '22 16:05 cmacdonald

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

junefeld avatar May 27 '22 22:05 junefeld

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!

LukasKriesch avatar Jul 06 '23 09:07 LukasKriesch

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

cmacdonald avatar Jul 06 '23 09:07 cmacdonald

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

LukasKriesch avatar Jul 06 '23 10:07 LukasKriesch

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

cmacdonald avatar Jul 06 '23 10:07 cmacdonald

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

LukasKriesch avatar Jul 06 '23 11:07 LukasKriesch

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

cmacdonald avatar Jul 06 '23 11:07 cmacdonald

Thank you very much!

J-kk911 avatar Nov 26 '23 14:11 J-kk911

Found a solution to the "pytrec_eval" error problem

  • Cloned the beir repo https://github.com/beir-cellar/beir/wiki/Installing-beir - ! git clone https://github.com/beir-cellar/beir.git
  • Changed "pytrec_eval" to "pytrec-eval-terrier" in install_requires of setup.py in beir
  • Installed the package from cloned repo - %pip install -e ./beir
  • Installed gpl - %pip install -q gpl

This worked for me in Amazon SageMaker

JoTeq-Work avatar Apr 30 '24 13:04 JoTeq-Work

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

cmacdonald avatar Apr 30 '24 14:04 cmacdonald