pypa/build

ERROR: The --python option must be placed before the pip subcommand name

shan-weiqiang opened this issue · 1 comments

When i run command, i got following error:

(work) ➜  mbd python3 -m build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - setuptools
> /home/shan/miniconda3/envs/work/bin/python3 -m pip --python /tmp/build-env-7tpwh0p_/bin/python install --use-pep517 --no-warn-script-location --no-compile -r /tmp/build-reqs-z8_7un5c.txt
< ERROR: The --python option must be placed before the pip subcommand name

Traceback (most recent call last):
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/__main__.py", line 178, in _handle_build_error
    yield
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/__main__.py", line 429, in main
    built = build_call(
            ^^^^^^^^^^^
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/__main__.py", line 268, in build_package_via_sdist
    sdist = _build(isolation, srcdir, outdir, 'sdist', config_settings, skip_dependency_check, installer)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/__main__.py", line 170, in _build
    return _build_in_isolated_env(srcdir, outdir, distribution, config_settings, installer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/__main__.py", line 135, in _build_in_isolated_env
    env.install(builder.build_system_requires)
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/env.py", line 136, in install
    self._env_backend.install_requirements(requirements)
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/env.py", line 265, in install_requirements
    run_subprocess(cmd)
  File "/home/shan/miniconda3/envs/work/lib/python3.12/site-packages/build/_ctx.py", line 71, in run_subprocess
    subprocess.run(cmd, capture_output=True, check=True, env=env)
  File "/home/shan/miniconda3/envs/work/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/shan/miniconda3/envs/work/bin/python3', '-m', 'pip', '--python', '/tmp/build-env-7tpwh0p_/bin/python', 'install', '--use-pep517', '--no-warn-script-location', '--no-compile', '-r', '/tmp/build-reqs-z8_7un5c.txt']' returned non-zero exit status 1.

ERROR Command '['/home/shan/miniconda3/envs/work/bin/python3', '-m', 'pip', '--python', '/tmp/build-env-7tpwh0p_/bin/python', 'install', '--use-pep517', '--no-warn-script-location', '--no-compile', '-r', '/tmp/build-reqs-z8_7un5c.txt']' returned non-zero exit status 1.

My environment:
OS: Linux shan 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Interpreter: Python 3.12.7
build 1.2.2.post1
packaging 24.1
pip 24.2
pyproject_hooks 1.2.0
setuptools 75.1.0
wheel 0.44.0

This is due to a pip.py script in my current working dir, stupid yet very hard to find mistake.
closed