Skip to content

Error: Kernel fails to start due to missing 'imghdr' module #45

@ackalker

Description

@ackalker

Description

When attempting to execute a PowerShell cell in a Jupyter notebook using VSCode, the kernel fails to start with the following error:

The kernel failed to start due to the missing module 'imghdr'. Consider installing this module.

This error occurs in a Python virtual environment with ipykernel and powershell_kernel installed.

Environment

  • OS: Windows 11 Home (23H2, 22631.4602)
  • Python version: 3.13.1
  • VSCode version: 1.97.0-insider
  • powershell_kernel version: 0.1.4
  • ipykernel version: 6.29.5

Steps to Reproduce

  1. Create a new Python virtual environment in a VSCode workspace
  2. Install ipykernel and powershell_kernel in the virtual environment
  3. Open a Jupyter notebook in VSCode using this environment, make sure to select the PowerShell kernel
  4. Attempt to execute a PowerShell cell

Expected Behavior

The PowerShell cell should execute without errors.

Actual Behavior

The kernel fails to start, citing a missing imghdr module.

Additional Context

The imghdr module was deprecated in Python 3.11 and removed in Python 3.13. It appears that powershell_kernel or one of its dependencies still relies on this module.

Possible Solutions

  1. Update powershell_kernel to use an alternative to imghdr (e.g., filetype, puremagic, or python-magic)
  2. Add standard-imghdr as a dependency for powershell_kernel
  3. Provide clear documentation on how users can resolve this issue (e.g., by installing standard-imghdr)

Question

Is there a plan to address this compatibility issue with newer Python versions that no longer include the imghdr module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions