python-poetry / python-poetry/poetry
Cannot install package with shell script in `[tool.poetry.scripts]`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
-
I am on the latest Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption). -
OS version and name: Ubuntu 18.04.5 LTS
-
Poetry version: Poetry (version 1.2.0a1)
-
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/ethanabrooks/2de35e1c59d9d08f7695123485fcf044
Issue
I am trying to create a package that includes a shell script that I would like to make available to any projects that install this package. https://github.com/ethanabrooks/poetry-issue is the package that I want to install. To set up the project that I want to install the package into, I run:
poetry new poetry-issue2
cd poetry-issue2
poetry shell
Then both
poetry add git+https://github.com/ethanabrooks/poetry-issue.git@main
and
poetry add ../poetry-issue
yield the same error:
poetry-issue2-fWI-Kq6B-py3.6 ❯ poetry add ../poetry-issue
Updating dependencies
Resolving dependencies... (0.1s)
Package operations: 1 install, 0 updates, 0 removals
• Installing poetry-issue (0.1.0 /home/ethanbro/poetry-issue): Failed
CalledProcessError
Command '['/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6/bin/python', '/home/ethanbro/.local/share/pypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6', '--upgrade', '--no-deps', '/home/ethanbro/poetry-issue']' returned non-zero exit status 1.
at /usr/lib/python3.6/subprocess.py:438 in run
434│ raise
435│ retcode = process.poll()
436│ if check and retcode:
437│ raise CalledProcessError(retcode, process.args,
→ 438│ output=stdout, stderr=stderr)
439│ return CompletedProcess(process.args, retcode, stdout, stderr)
440│
441│
442│ def list2cmdline(seq):
The following error occurred when trying to handle this error:
EnvCommandError
Command ['/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6/bin/python', '/home/ethanbro/.local/share/pypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6', '--upgrade', '--no-deps', '/home/ethanbro/poetry-issue'] errored with the following return code 1, and output:
Processing /home/ethanbro/poetry-issue
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6/bin/python /home/ethanbro/.local/share/pypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpxlxn6z_q
cwd: /tmp/pip-req-build-zmy6kyn0
Complete output (1 lines):
/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6/bin/python: can't find '__main__' module in '/home/ethanbro/.local/share/pypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/pep517/_in_process.py'
----------------------------------------
WARNING: Discarding file:///home/ethanbro/poetry-issue. Command errored out with exit status 1: /home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6/bin/python /home/ethanbro/.local/share/p
ypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpxlxn6z_q Check the logs for full command
output. ERROR: Command errored out with exit status 1: /home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6/bin/python /home/ethanbro/.local/share/pypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpxlxn6z_q Check the logs for full command output.
at ~/.local/share/pypoetry/venv/lib/python3.6/site-packages/poetry/utils/env.py:1300 in _run
1296│ output = subprocess.check_output(
1297│ cmd, stderr=subprocess.STDOUT, env=env, **kwargs
1298│ )
1299│ except CalledProcessError as e:
→ 1300│ raise EnvCommandError(e, input=input_)
1301│
1302│ return decode(output)
1303│
1304│ def execute(self, bin: str, *args: str, **kwargs: Any) -> Optional[int]:
The following error occurred when trying to handle this error:
CalledProcessError
Command '['/tmp/tmpzu5vptq1/.venv/bin/python', '/tmp/tmpzu5vptq1/.venv/bin/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6', '--upgrade', '--no-deps', '/home/ethanbro/poetry-issue']' returned non-zero exit status 1.
at /usr/lib/python3.6/subprocess.py:438 in run
434│ raise
435│ retcode = process.poll()
436│ if check and retcode:
437│ raise CalledProcessError(retcode, process.args,
→ 438│ output=stdout, stderr=stderr)
439│ return CompletedProcess(process.args, retcode, stdout, stderr)
440│
441│
442│ def list2cmdline(seq):
The following error occurred when trying to handle this error:
EnvCommandError
Command ['/tmp/tmpzu5vptq1/.venv/bin/python', '/tmp/tmpzu5vptq1/.venv/bin/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue2-fWI-Kq6B-py3.6', '--upgrade', '--no-deps', '/home/ethanbro/poetry-issue'] errored with the following return code 1, and output:
Processing /home/ethanbro/poetry-issue
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /tmp/tmpzu5vptq1/.venv/bin/python /tmp/tmpzu5vptq1/.venv/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpn5b58em1
cwd: /tmp/pip-req-build-ufprx1xr
Complete output (14 lines):
Traceback (most recent call last):
File "/tmp/tmpzu5vptq1/.venv/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/tmp/tmpzu5vptq1/.venv/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmpzu5vptq1/.venv/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-9zyzmw6o/overlay/lib/python3.6/site-packages/poetry/core/masonry/api.py", line 51, in prepare_metadata_for_build_wheel
builder._write_entry_points(f)
File "/tmp/pip-build-env-9zyzmw6o/overlay/lib/python3.6/site-packages/poetry/core/masonry/builders/wheel.py", line 330, in _write_entry_points
entry_points = self.convert_entry_points()
File "/tmp/pip-build-env-9zyzmw6o/overlay/lib/python3.6/site-packages/poetry/core/masonry/builders/builder.py", line 285, in convert_entry_points
extras = "[{}]".format(", ".join(ep["extras"]))
KeyError: 'extras'
----------------------------------------
WARNING: Discarding file:///home/ethanbro/poetry-issue. Command errored out with exit status 1: /tmp/tmpzu5vptq1/.venv/bin/python /tmp/tmpzu5vptq1/.venv/lib/python3.6/site-packages/pip/_vendor/pep517/_in_proc
ess.py prepare_metadata_for_build_wheel /tmp/tmpn5b58em1 Check the logs for full command output. ERROR: Command errored out with exit status 1: /tmp/tmpzu5vptq1/.venv/bin/python /tmp/tmpzu5vptq1/.venv/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpn5b58em1 Check the logs for full command output.
at ~/.local/share/pypoetry/venv/lib/python3.6/site-packages/poetry/utils/env.py:1300 in _run
1296│ output = subprocess.check_output(
1297│ cmd, stderr=subprocess.STDOUT, env=env, **kwargs
1298│ )
1299│ except CalledProcessError as e:
→ 1300│ raise EnvCommandError(e, input=input_)
1301│
1302│ return decode(output)
1303│
1304│ def execute(self, bin: str, *args: str, **kwargs: Any) -> Optional[int]:
Failed to add packages, reverting the pyproject.toml file to its original content.
If I remove the last two lines (the [tool.poetry.scripts] section), the package installs fine.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the linked package and a pyproject.toml containing the [tool.poetry.scripts] section, then trace the entry-point metadata generation shown in the error. Verify the package installs successfully with the shell script entry point while preserving the existing behavior for other scripts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100