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 plugins within poetry #171042

Open
4 tasks done
twam opened this issue May 7, 2024 · 3 comments
Open
4 tasks done

Cannot install plugins within poetry #171042

twam opened this issue May 7, 2024 · 3 comments
Labels
bug Reproducible Homebrew/homebrew-core bug

Comments

@twam
Copy link
Contributor

twam commented May 7, 2024

brew gist-logs <formula> link OR brew config AND brew doctor output

$ brew config                                       
HOMEBREW_VERSION: 4.2.21
ORIGIN: https://github.com/Homebrew/brew
HEAD: 82c2e743a5bcea725f9ca1429e3e21c3088ff904
Last commit: 30 hours ago
Core tap JSON: 07 May 12:18 UTC
Core cask tap JSON: 07 May 12:18 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: ["--no-quarantine"]
HOMEBREW_EDITOR: subl --wait
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 16
Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 16-core 64-bit skylake
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.4.1-x86_64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.3
$ brew doctor
Your system is ready to brew.

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

Install a plugin (poetry-dynamic-versioning) within poetry by

poetry self add "poetry-dynamic-versioning[plugin]"

What happened (include all command output)?

Installation fails as poetry is trying to update pycparser which was installed by brew:

poetry self add "poetry-dynamic-versioning[plugin]"
Using version ^1.3.0 for poetry-dynamic-versioning

Updating dependencies
Resolving dependencies... (0.9s)

Package operations: 4 installs, 9 updates, 0 removals

  - Updating certifi (2024.2.2 /private/tmp/python-certifi-20240202-5063-q0mlj8/certifi-2024.2.2 -> 2024.2.2)
  - Updating pycparser (2.22 /usr/local/lib/python3.12/site-packages -> 2.22): Failed

  CalledProcessError

  Command '['/usr/local/Cellar/poetry/1.8.2_2/libexec/bin/python', '/usr/local/Cellar/poetry/1.8.2_2/libexec/lib/python3.12/site-packages/virtualenv/seed/wheels/embed/pip-24.0-py3-none-any.whl/pip', 'uninstall', 'pycparser', '-y']' returned non-zero exit status 1.

  at /usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py:571 in run
       567│             # We don't call process.wait() as .__exit__ does that for us.
       568│             raise
       569│         retcode = process.poll()
       570│         if check and retcode:
    →  571│             raise CalledProcessError(retcode, process.args,
       572│                                      output=stdout, stderr=stderr)
       573│     return CompletedProcess(process.args, retcode, stdout, stderr)
       574│ 
       575│ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['/usr/local/Cellar/poetry/1.8.2_2/libexec/bin/python', '/usr/local/Cellar/poetry/1.8.2_2/libexec/lib/python3.12/site-packages/virtualenv/seed/wheels/embed/pip-24.0-py3-none-any.whl/pip', 'uninstall', 'pycparser', '-y'] errored with the following return code 1
  
  Output:
  Found existing installation: pycparser 2.22
  ERROR: Cannot uninstall pycparser 2.22, RECORD file not found. Hint: The package was installed by brew.
  

  at /usr/local/Cellar/poetry/1.8.2_2/libexec/lib/python3.12/site-packages/poetry/utils/env/base_env.py:342 in _run
      338│                 output = subprocess.check_output(
      339│                     cmd, stderr=stderr, env=env, text=True, **kwargs
      340│                 )
      341│         except CalledProcessError as e:
    → 342│             raise EnvCommandError(e)
      343│ 
      344│         return output
      345│ 
      346│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Cannot install pycparser.

What did you expect to happen?

Plugin is successfully installed.

Step-by-step reproduction instructions (by running brew commands)

brew install poetry
# weeks later
poetry self add "poetry-dynamic-versioning[plugin]"
@twam twam added the bug Reproducible Homebrew/homebrew-core bug label May 7, 2024
@woodruffw
Copy link
Member

Unfortunately I suspect this won't work, at least not with any poetry plugin that wants to upgrade Homebrew's Python environment: allowing these kinds of resolution changes would allow anything that gets brew installed to break other Homebrew-managed Python applications.

I believe there are two resolutions possible here:

  • We could package this poetry plugin as a formula with the same Python dependency as poetry itself, which would drop it into the same environment. Then, you could do brew install poetry-dynamic-version to enable it.
  • You could put poetry into its own environment, which is (probably) how it wants to be used (I don't know poetry super well, but this is what their docs suggest). I think brew install pipx; pipx install poetry; pipx inject poetry "poetry-dynamic-versioning[plugin]" would suffice for that.

@twam
Copy link
Contributor Author

twam commented May 17, 2024

I personally would prefer a way, that is managed by brew, so that a brew upgrade will also update poetry and its plugins.

The second suggestion works for now, but feels wrong, as there is a poetry package provided by brew which I cannot use. :)

@SMillerDev
Copy link
Member

You can make your own tap and maintain a package there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/homebrew-core bug
Projects
None yet
Development

No branches or pull requests

3 participants