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

py3-pywinpty/2.0.14 package update #31028

Closed
wants to merge 4 commits into from

Conversation

octo-sts[bot]
Copy link
Contributor

@octo-sts octo-sts bot commented Oct 17, 2024

@octo-sts octo-sts bot added request-version-update request for a newer version of a package automated pr labels Oct 17, 2024
Copy link
Contributor Author

octo-sts bot commented Oct 17, 2024

Gen AI suggestions to solve the build error:

The error message indicates a failure to resolve `Win32` in the `windows` crate. To fix this, ensure the `windows` crate is included in your `Cargo.toml`, verify the version supports `Win32`, check for correct feature flags, update the crate if necessary, and review import paths for accuracy.

@rawlingsj rawlingsj closed this Nov 6, 2024
@rawlingsj rawlingsj reopened this Nov 6, 2024
Copy link
Contributor Author

octo-sts bot commented Nov 26, 2024

Gen AI suggestions to solve the build error:

• Detected Error:

error[E0433]: failed to resolve: could not find `Win32` in `windows`
[...]
error: could not compile `winpty-rs` (lib) due to 9 previous errors

• Error Category: Build/Dependency

• Failure Point: Rust compilation of winpty-rs native extension

• Root Cause Analysis:
The package pywinpty is Windows-specific and attempts to compile Windows-dependent Rust code on a Linux system. The Windows-specific dependencies from the windows-rs crate cannot be resolved in a Linux build environment.

• Suggested Fix:
This package should be marked as Windows-only and should not be built on Linux systems. Modify the melange.yaml to skip build on Linux:

# Add at top level
conditions:
  if: ${{target.platform == "windows"}}

Or remove it entirely from the Linux build as it's not functional on Linux systems.

• Explanation:
pywinpty provides pseudo terminal support specifically for Windows systems using the Windows API through winpty. The Rust code explicitly depends on Windows-specific APIs (Win32) which cannot be cross-compiled on Linux systems. This package should only be built and distributed for Windows targets.

• Additional Notes:

  • pywinpty is specifically designed for Windows pseudo-terminal support
  • The package name itself indicates Windows specificity (winpty)
  • There are Linux-native alternatives like 'pty' for Unix-like systems
  • This package should not be included in Wolfi OS as it's Windows-specific

• References:

@powersj powersj added the P1 This label indicates our scanning found High, Medium or Low CVEs for these packages. label Nov 26, 2024
Copy link
Contributor Author

octo-sts bot commented Dec 9, 2024

Gen AI suggestions to solve the build error:

• Detected Error: The log doesn't show a direct error message, but the build appears to stop during Rust compilation of pyo3 dependencies for pywinpty

• Error Category: Platform Compatibility

• Failure Point: Building the Rust components of pywinpty package during pip wheel creation

• Root Cause Analysis: pywinpty is a Windows-specific package that provides pseudo terminal support for Windows. It cannot be built on Linux systems as it requires Windows-specific APIs and dependencies.

• Suggested Fix:

  1. Add a platform restriction to skip building on Linux:
package:
  name: py3-pywinpty
  version: 2.0.14
  epoch: 0
  description: Pseudo terminal support for Windows from Python.
  copyright:
    - license: MIT
  # Add platform restriction
  arch:
    - disabled # Skip building on all architectures since this is Windows-only

• Explanation:

  • pywinpty is specifically designed for Windows systems and uses Windows-specific APIs (winpty)
  • The package cannot be built on Linux systems as it requires native Windows components
  • Adding the arch: disabled directive will prevent the package from attempting to build on Linux systems
  • This is the correct approach for Windows-only packages in Wolfi OS

• Additional Notes:

• References:

@mamccorm
Copy link
Member

mamccorm commented Dec 9, 2024

Project has migrated from pip to pyproject.toml. For comparison:

Not currently sure how we update this package, conforming to the new python package standard

@pnasrat
Copy link
Member

pnasrat commented Dec 9, 2024

@mamccorm - this is a win32 only package (see upstream releases) and brought in mistakenly via jupyter-server when it was an os constrained dependency (currently ignored by melange convert) - this should be removed from any requiring packages eg jupyter-server and withdrawn from wolfi.

https://github.com/jupyter-server/jupyter_server/blob/535d7df3c0b358e31f514842c5509ca6ce64f056/pyproject.toml#L36

@pnasrat
Copy link
Member

pnasrat commented Dec 9, 2024

Looking why prior version builds and diffs

andfoy/pywinpty@v2.0.13...v2.0.14

Main dep changes are

[dependencies]
winpty-rs = "0.4"

[dependencies.pyo3]
version = "0.22.3"

The compile error is in winpty-rs

2024/12/09 07:50:38 WARN      Compiling winpty-rs v0.4.0 subpackage=py3.10-pywinpty uses=py/pip-build-install name="pip build"
2024/12/09 07:50:39 WARN   error[E0433]: failed to resolve: could not find `Win32` in `windows` subpackage=py3.10-pywinpty uses=py/pip-build-install name="pip build"
2024/12/09 07:50:39 WARN    --> /home/build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winpty-rs-0.4.0/src/pty/base.rs:3:14 subpackage=py3.10-pywinpty uses=py/pip-build-install name="pip build"
2024/12/09 07:50:39 WARN     | subpackage=py3.10-pywinpty uses=py/pip-build-install name="pip build"
2024/12/09 07:50:39 WARN   3 | use windows::Win32::Foundation::{CloseHandle, HANDLE, STATUS_PENDING, S_OK, WAIT_FAILED, WAIT_OBJECT_0, WAIT_TIMEOUT}; subpackage=py3.10-pywinpty uses=py/pip-build-install name="pip build"
2024/12/09 07:50:39 WARN     |              ^^^^^ could not find `Win32` in `windows` subpackage=py3.10-pywinpty uses=py/pip-build-install name="pip build"

@pnasrat
Copy link
Member

pnasrat commented Dec 9, 2024

note the current package despite compiling is non-functional anyway

>>> from winpty import PtyProcess
>>> proc = PtyProcess.spawn('python3.12')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.12/site-packages/winpty/ptyprocess.py", line 94, in spawn
    proc = PTY(dimensions[1], dimensions[0],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywinpty.WinptyError: "\"There were some errors trying to instantiate a PTY:\" (ConPTY) -> \"pty_rs was compiled without ConPTY enabled\";" (WinPTY) -> "winpty_rs was compiled without WinPTY enabled"

@mamccorm
Copy link
Member

PR to delete package and withdraw:

Once merged, this can be closed

pnasrat pushed a commit that referenced this pull request Dec 13, 2024
#36706)

We had a failing package update PR that popped up in sustaining:
 - #31028

On closer inspection, this was a win32 package, and should never have
been added to wolfi. Whilst it may have been compiling before, it was
non-functional. It's highly likely it was wrongly imported when
jupyter-server was built / imported.

**Please see the following GH issue comments for more information:**
- #31028 (comment)

This PR cleans up the package, as well as adds it to the withdrawn list.
There are no other packages (in wolfi or elsewhere), or images with
dependencies on this broken package.

Signed-off-by: Mark McCormick <[email protected]>
@mamccorm
Copy link
Member

closing, package deleted:
#36706

@mamccorm mamccorm closed this Dec 13, 2024
@mamccorm mamccorm deleted the wolfictl-5b13fafe-4133-4d6f-a1ee-c6ab2a5e95d9 branch December 13, 2024 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated pr P1 This label indicates our scanning found High, Medium or Low CVEs for these packages. request-version-update request for a newer version of a package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants