facebookresearch/DPR

Unable to install dependencies

jigsaw2212 opened this issue · 2 comments

Why I try to run pip install . in the DPR directory, it returns the following error:

`Processing /export/home/conversational_retrieval/DPR
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
error: Multiple top-level packages discovered in a flat-layout: ['dpr', 'conf'].

  To avoid accidental inclusion of unwanted files or directories,
  setuptools will not proceed with this build.
  
  If you are trying to create a single distribution with multiple packages
  on purpose, you should not rely on automatic discovery.
  Instead, consider the following options:
  
  1. set up custom discovery (`find` directive with `include` or `exclude`)
  2. use a `src-layout`
  3. explicitly set `py_modules` or `packages` with a list of names
  
  To find more information, look for "package discovery" on setuptools docs.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.`

@jigsaw2212
I had the exactly same issue. A solution worked for me is to simply add py_modules=[] to the setup() arguements in setup.py.
This error seems to be coming from the setuptools, and similar issues have been reported in other repositories (e.g., setuptools/issues/3197).

e.g.,

setup(
    name="dpr",
    version="1.0.0",
....
    setup_requires=[
        "setuptools>=18.0",
    ],
    py_modules=[], 
    install_requires=[
        "faiss-cpu>=1.6.1",
        "filelock",
        "numpy",
        "regex",
        "torch>=1.5.0",
        "transformers>=4.3",
        "tqdm>=4.27",
        "wget",
        "spacy>=2.1.8",
        "hydra-core>=1.0.0",
        "omegaconf>=2.0.1",
        "jsonlines",
        "soundfile",
        "editdistance",
    ],

Thanks for the help @AkariAsai. I ended up copying all these dependencies into a requirements.txt and installing that separately, which worked for me!