[Python] Cannot install ipykernel in venv

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

  1. Stack

    Stack Membro Participativo

    My goal is to set up Jupyter in VSCode on Windows. What I have tried method are

    1. Follow the GUI prompt, click install, but it alwasys stuck at some place for hours. [​IMG]
    2. Run the command hinted by the error message of cell output, which is "c:/Users/J Doe/Documents/Workspace/Mathematics note/A First Course in Probability/.venv/Scripts/python.exe" -m pip install ipykernel -U --force-reinstall which is install ipykernel in virtual environment. After a long time, it finally throw out error like below:

    Collecting comm>=0.1.1 (from ipykernel==6.29.5)
    Downloading comm-0.2.1-py3-none-any.whl.metadata (3.7 kB)
    ERROR: Cannot install ipykernel because these package versions have conflicting dependencies.

    The conflict is caused by:
    jupyter-core 5.8.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.8.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.7.2 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.7.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.7.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.6.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.5.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.5.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.4.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.3.2 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.3.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.3.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.2.0 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.1.5 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.1.4 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.1.3 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.1.2 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.1.1 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 5.1.0 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
    jupyter-core 4.12.0 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"

    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip to attempt to solve the dependency conflict

    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
    PS C:\Users\J Doe\Documents\Workspace\Mathematics note\A First Course in Probability> pip install pywin32
    ERROR: Could not find a version that satisfies the requirement pywin32 (from versions: none)
    ERROR: No matching distribution found for pywin32


    I installed Python not long ago, so it should be the newest version. I also run an up to date VSCode Searched on internet and AI, which suggested incompatible version of pywin32 and python 3.13, however when I open the pypi and search, the 3.13 is supported. Also some mentioned may be due to network issue, but it's not a problem for me, as I can pip install ipykernel successfully and quickly outside virtual environment.

    Also I am using a Windows computer, so it should not related to the OS platform.

    What I have tried


    I tried to install pywin32 manually in virtual environment, as the previous error mentioned pywin32. But it fails

    (.venv) PS C:\Users\J Doe> pip install pywin32
    ERROR: Could not find a version that satisfies the requirement pywin32 (from versions: none)
    ERROR: No matching distribution found for pywin32
    (.venv) PS C:\Users\J Doe> pip list
    Package Version
    ------- -------
    pip 25.1.1


    What is weird is that if I am outside the virtual environment, running pip install ipykernel and pip install pywin32 will successfully install the packages.

    Continue reading...

Compartilhe esta Página