Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install package with shell script in [tool.poetry.scripts] #4289

Open
3 tasks done
ethanabrooks opened this issue Jul 16, 2021 · 1 comment
Open
3 tasks done
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@ethanabrooks
Copy link

ethanabrooks commented Jul 16, 2021

  • 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 (-vvv option).

  • 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.

@ethanabrooks ethanabrooks added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 16, 2021
@kojiromike
Copy link

Is this a duplicate of #2310?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants