[Python] Cannot install/run Ipykernel in VS code

Discussão em 'Python' iniciado por Stack, Junho 12, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to VS code and python. When I tried to use interactive window I failed to install ipykernel. I am using Mac system and has already installed Jupyter and python in vs code. I am using conda environment and looked for some solutions but they didn't work.

    When I tried to run interactive window it showed:

    Running cells with 'Python 3.13.3' requires the ipykernel package.
    Create a Python Environment with the required packages.
    Or install 'ipykernel' using the command: '/usr/local/bin/python3 -m pip install ipykernel -U --user --force-reinstall'


    I then tried to install it but it seems that it was already installed:

    python % pip install ipython ipykernel
    Requirement already satisfied: ipython in/Users/huahuademac/.local/lib/python3.12/site-packages (9.3.0)
    Requirement already satisfied: ipykernel in /Users/huahuademac/.local/lib/python3.12/site-packages (6.29.5)
    Requirement already satisfied: decorator in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (5.2.1)
    Requirement already satisfied: ipython-pygments-lexers in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (1.1.1)
    Requirement already satisfied: jedi>=0.16 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (0.19.2)
    Requirement already satisfied: matplotlib-inline in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (0.1.7)
    Requirement already satisfied: pexpect>4.3 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (4.9.0)
    Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (3.0.51)
    Requirement already satisfied: pygments>=2.4.0 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (2.19.1)
    Requirement already satisfied: stack_data in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (0.6.3)
    Requirement already satisfied: traitlets>=5.13.0 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipython) (5.14.3)
    Requirement already satisfied: wcwidth in /Users/huahuademac/.local/lib/python3.12/site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython) (0.2.13)
    Requirement already satisfied: appnope in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (0.1.4)
    Requirement already satisfied: comm>=0.1.1 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (0.2.2)
    Requirement already satisfied: debugpy>=1.6.5 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (1.8.14)
    Requirement already satisfied: jupyter-client>=6.1.12 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (8.6.3)
    Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (5.8.1)
    Requirement already satisfied: nest-asyncio in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (1.6.0)
    Requirement already satisfied: packaging in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (25.0)
    Requirement already satisfied: psutil in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (7.0.0)
    Requirement already satisfied: pyzmq>=24 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (26.4.0)
    Requirement already satisfied: tornado>=6.1 in /Users/huahuademac/.local/lib/python3.12/site-packages (from ipykernel) (6.5.1)
    Requirement already satisfied: parso<0.9.0,>=0.8.4 in /Users/huahuademac/.local/lib/python3.12/site-packages (from jedi>=0.16->ipython) (0.8.4)
    Requirement already satisfied: python-dateutil>=2.8.2 in /Users/huahuademac/.local/lib/python3.12/site-packages (from jupyter-client>=6.1.12->ipykernel) (2.9.0.post0)
    Requirement already satisfied: platformdirs>=2.5 in /Users/huahuademac/.local/lib/python3.12/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (4.3.8)
    Requirement already satisfied: ptyprocess>=0.5 in /Users/huahuademac/.local/lib/python3.12/site-packages (from pexpect>4.3->ipython) (0.7.0)
    Requirement already satisfied: six>=1.5 in /Users/huahuademac/.local/lib/python3.12/site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel) (1.17.0)
    Requirement already satisfied: executing>=1.2.0 in /Users/huahuademac/.local/lib/python3.12/site-packages (from stack_data->ipython) (2.2.0)
    Requirement already satisfied: asttokens>=2.1.0 in /Users/huahuademac/.local/lib/python3.12/site-packages (from stack_data->ipython) (3.0.0)
    Requirement already satisfied: pure-eval in /Users/huahuademac/.local/lib/python3.12/site-packages (from stack_data->ipython) (0.2.3)


    I then tried the command

    /usr/local/bin/python3 -m pip install ipykernel -U --user --force-reinstall' ,
    m pip install ipython ipykernel


    or clicked the link “Create a Python Environment with the required packages” to create a new environment but all of them failed to work

    (base) huahuademac@MacBook-Air python % /Users/huahuademac/Desktop/python/.venv/bin/python -m pip install ipython ipykernel
    Collecting ipython
    Downloading ipython-8.12.3-py3-none-any.whl.metadata (5.7 kB)
    Collecting ipykernel
    Using cached ipykernel-6.29.5-py3-none-any.whl.metadata (6.3 kB)
    Collecting backcall (from ipython)
    Downloading backcall-0.2.0-py2.py3-none-any.whl.metadata (2.0 kB)
    Collecting decorator (from ipython)
    Using cached decorator-5.2.1-py3-none-any.whl.metadata (3.9 kB)
    Collecting jedi>=0.16 (from ipython)
    Using cached jedi-0.19.2-py2.py3-none-any.whl.metadata (22 kB)
    Collecting matplotlib-inline (from ipython)
    Using cached matplotlib_inline-0.1.7-py3-none-any.whl.metadata (3.9 kB)
    Collecting pickleshare (from ipython)
    Downloading pickleshare-0.7.5-py2.py3-none-any.whl.metadata (1.5 kB)
    Collecting prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 (from ipython)
    Using cached prompt_toolkit-3.0.51-py3-none-any.whl.metadata (6.4 kB)
    Collecting pygments>=2.4.0 (from ipython)
    Using cached pygments-2.19.1-py3-none-any.whl.metadata (2.5 kB)
    Collecting stack-data (from ipython)
    Using cached stack_data-0.6.3-py3-none-any.whl.metadata (18 kB)
    Collecting traitlets>=5 (from ipython)
    Using cached traitlets-5.14.3-py3-none-any.whl.metadata (10 kB)
    Collecting typing-extensions (from ipython)
    Downloading typing_extensions-4.13.2-py3-none-any.whl.metadata (3.0 kB)
    Collecting pexpect>4.3 (from ipython)
    Using cached pexpect-4.9.0-py2.py3-none-any.whl.metadata (2.5 kB)
    Collecting appnope (from ipython)
    Using cached appnope-0.1.4-py2.py3-none-any.whl.metadata (908 bytes)
    Collecting comm>=0.1.1 (from ipykernel)
    Using cached comm-0.2.2-py3-none-any.whl.metadata (3.7 kB)
    Collecting debugpy>=1.6.5 (from ipykernel)
    Downloading debugpy-1.8.14-py2.py3-none-any.whl.metadata (1.4 kB)
    Collecting jupyter-client>=6.1.12 (from ipykernel)
    Using cached jupyter_client-8.6.3-py3-none-any.whl.metadata (8.3 kB)
    Collecting jupyter-core!=5.0.*,>=4.12 (from ipykernel)
    Using cached jupyter_core-5.8.1-py3-none-any.whl.metadata (1.6 kB)
    Collecting nest-asyncio (from ipykernel)
    Using cached nest_asyncio-1.6.0-py3-none-any.whl.metadata (2.8 kB)
    Collecting packaging (from ipykernel)
    Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
    Collecting psutil (from ipykernel)
    Using cached psutil-7.0.0-cp36-abi3-macosx_11_0_arm64.whl.metadata (22 kB)
    Collecting pyzmq>=24 (from ipykernel)
    Downloading pyzmq-26.4.0-cp38-cp38-macosx_10_15_universal2.whl.metadata (6.0 kB)
    Collecting tornado>=6.1 (from ipykernel)
    Downloading tornado-6.4.2-cp38-abi3-macosx_10_9_universal2.whl.metadata (2.5 kB)
    Collecting parso<0.9.0,>=0.8.4 (from jedi>=0.16->ipython)
    Using cached parso-0.8.4-py2.py3-none-any.whl.metadata (7.7 kB)
    Collecting importlib-metadata>=4.8.3 (from jupyter-client>=6.1.12->ipykernel)
    Downloading importlib_metadata-8.5.0-py3-none-any.whl.metadata (4.8 kB)
    Collecting python-dateutil>=2.8.2 (from jupyter-client>=6.1.12->ipykernel)
    Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
    Collecting platformdirs>=2.5 (from jupyter-core!=5.0.*,>=4.12->ipykernel)
    Downloading platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB)
    Collecting ptyprocess>=0.5 (from pexpect>4.3->ipython)
    Using cached ptyprocess-0.7.0-py2.py3-none-any.whl.metadata (1.3 kB)
    Collecting wcwidth (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython)
    Using cached wcwidth-0.2.13-py2.py3-none-any.whl.metadata (14 kB)
    Collecting executing>=1.2.0 (from stack-data->ipython)
    Using cached executing-2.2.0-py2.py3-none-any.whl.metadata (8.9 kB)
    Collecting asttokens>=2.1.0 (from stack-data->ipython)
    Using cached asttokens-3.0.0-py3-none-any.whl.metadata (4.7 kB)


    enter image description here

    I tried to run interactive window again but still failed

    Running cells with 'Python 3.13.3' requires the ipykernel package.
    Install 'ipykernel' into the Python environment.
    Command: '/usr/local/bin/python3 -m pip install ipykernel -U --user --force-reinstall'


    I know it is a little bit weird and sorry for the verbose code shown above but this issue has been troubling me quite a bit. I’d greatly appreciate any advice—tons pf thank in advance!

    Continue reading...

Compartilhe esta Página