pytrec_eval
pytrec_eval copied to clipboard
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).
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
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]
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
Using our fork, pip install pytrec-eval-terrier
now works on Window, Mac and Linux without compiling. Work by @seanmacavaney and myself.
Thank you! JonathanSamelson and Alkouf. I got exactly the same error and did just like you.
also having issues with windows 10 python 3.9. Unfortunately, package is a dependency for other packages.... Any other suggestions?
@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.)
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.
Perhaps you could submit a PR to ask them to change to the Windows compatible fork then?
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).
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 What is the problem you are experiencing? the pytrec-eval-terrier fork should work fine.
@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.
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
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
I cant support gpl. You can try to update my fork.
Thank you very much!
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 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.