简体   繁体   中英

Adding pyproject.toml to project makes pip install fail

I am using pyproject.toml to configure black . However, when this file is added, pip3 install -e . --user pip3 install -e . --user fails with the following error:

    ERROR: Complete output from command /usr/bin/python3 -c 'import setuptools, tokenize;__file__='"'"'/home/sean/git/auto-md/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=:
    ERROR: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --user not recognized
    ----------------------------------------
ERROR: Command "/usr/bin/python3 -c 'import setuptools, tokenize;__file__='"'"'/home/sean/git/auto-md/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=" failed with error code 1 in /home/sean/git/auto-md/

Why is this error occuring and how can I resolve it?

According to the discussion in this GitHub issue , to resolve this issue, you need to run pip3 install -e . --user --no-use-pep517 pip3 install -e . --user --no-use-pep517 .

The reasons for this are complicated, but essentially:

  1. By using pyproject.toml , you're indicating to pip that you should use the new pep517 installation process.

  2. pep517 does not support -e or --user , so it fails.

  3. There is no other way to automatically configure black , so you're stuck with pyproject.toml and --no-use-pep517 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM