microsoft / ANCE

A novel embedding training algorithm leveraging ANN search and achieved SOTA retrieval on Trec DL 2019 and OpenQA benchmarks
MIT License
359 stars 49 forks source link

PYTHONPATH should be set explicitly #5

Open Yu-Shi opened 4 years ago

Yu-Shi commented 4 years ago

Hello,

I get this error when I follow the instructions to run the code:

  File "drivers/run_warmup.py", line 14, in <module>
    from utils.eval_mrr import passage_dist_eval
ModuleNotFoundError: No module named 'utils'

Users need to run this command before to eliminate that error:

export PYTHONPATH=${PYTHONPATH}:`pwd`

I suggest adding that command explicitly in README.md.

robro612 commented 1 year ago

One can also go the __init__.py route. I had success adding an empty __init__.py file in each subdirectory that throws this sort of error (e.g. utils). I'm not an expert with the new Python package logic, but I believe the __init__.py file allows Python to make subdirectories recognizable/importable as packages as is done here.