[Python] Why can't I install Numpy on Python 3.14?

Discussão em 'Python' iniciado por Stack, Fevereiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I am attempting to install Numpy on Python 3.140a5 to train a NLP deep learning AI. I am using Windows 11. I am attempting to install it through Command Prompt, using pip3.14 install numpy. This gives the following error

    Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Scripts\pip3.14.exe\__main__.py", line 4, in <module>
    from pip._internal.cli.main import main
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_internal\cli\main.py", line 11, in <module>
    from pip._internal.cli.autocompletion import autocomplete
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_internal\cli\main_parser.py", line 9, in <module>
    from pip._internal.build_env import get_runnable_pip
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_internal\build_env.py", line 20, in <module>
    from pip._internal.metadata import get_default_environment, get_environment
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_internal\metadata\__init__.py", line 9, in <module>
    from .base import BaseDistribution, BaseEnvironment, FilesystemWheel, MemoryWheel, Wheel
    File "C:\Users\Example\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_internal\metadata\base.py", line 1, in <module>
    import csv
    ModuleNotFoundError: No module named 'csv'


    Numpy installed correctly on Python 3.13 (that's also why I am using pip3.14 install numpy rather than just pip install numpy, as pip install numpy defaults to trying to install on Python 3.13). I am getting the same error on other, earlier versions of Python 3.14 as well. Specifying a specific Numpy version, like running pip3.14 install numpy==2.2.3 gives the following error instead (this error occurs even trying older Numpy versions):

    Collecting numpy==2.2.3
    Using cached numpy-2.2.3.tar.gz (20.3 MB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Installing backend dependencies ... done
    Preparing metadata (pyproject.toml) ... error
    error: subprocess-exited-with-error

    × Preparing metadata (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [21 lines of output]
    + C:\Users\Example\AppData\Local\Programs\Python\Python314\python.exe C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda\vendored-meson\meson\meson.py setup C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda\.mesonpy-6d9eu6ll -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda\.mesonpy-6d9eu6ll\meson-python-native-file.ini
    The Meson build system
    Version: 1.5.2
    Source dir: C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda
    Build dir: C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda\.mesonpy-6d9eu6ll
    Build type: native build
    Project name: NumPy
    Project version: 2.2.3
    WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe

    ..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
    The following exception(s) were encountered:
    Running `icl ""` gave "[WinError 2] The system cannot find the file specified"
    Running `cl /?` gave "[WinError 2] The system cannot find the file specified"
    Running `cc --version` gave "[WinError 2] The system cannot find the file specified"
    Running `gcc --version` gave "[WinError 2] The system cannot find the file specified"
    Running `clang --version` gave "[WinError 2] The system cannot find the file specified"
    Running `clang-cl /?` gave "[WinError 2] The system cannot find the file specified"
    Running `pgcc --version` gave "[WinError 2] The system cannot find the file specified"

    A full log can be found at C:\Users\Example\AppData\Local\Temp\pip-install-jdrrny83\numpy_1a0097bbfaa6480097c75ed93192bbda\.mesonpy-6d9eu6ll\meson-logs\meson-log.txt
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.


    I attempted to find the "full log" but the file does not appear to actually exist, or if it does it is hidden from me. I also tried running pip3.14 install csv to see what would happen, and got

    ERROR: Could not find a version that satisfies the requirement csv (from versions: none)
    ERROR: No matching distribution found for csv


    When googling, I found suggestions to use pip3.14 -m pip install numpy and python3.14 -m pip install numpy, none of which worked. The first returned

    Usage:
    pip3.14 <command> [options]

    no such option: -m


    while the second gave me 'python3.14' is not recognized as an internal or external command, operable program or batch file.

    The Python 3.14 documentation for the csv module makes no mention of issues with Python 3.14, and Numpy's documenation says that it is compatible with Python 3.10 or later.

    So, what is going on here? Why can't I install Numpy on Python 3.14?

    Continue reading...

Compartilhe esta Página