[Python] pip install pyspectra does not find existing numpy installation

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I get the error message Getting requirements to build wheel did not run successfully when trying to install the pyspectra module with pip on a Windows machine. The last line of the traceback tells me ModuleNotFoundError: No module named 'numpy'. The strange thing is: numpy is installed and running perfectly fine when I launch python and import it with import numpy as np.

    This is the output on the Windows command line:

    # Create and activate virtual environment
    C:\user\...\Desktop>python -m venv venv
    C:\user\...\Desktop>venv\scripts\activate

    # Import numpy (to make sure it is installed)
    (venv) C:\user\...\Desktop>py -m pip install numpy

    # Import pyspectra
    (venv) C:\user\...\Desktop>py -m pip install pyspectra
    Collecting pyspectra
    Using cached pyspectra-0.0.1.2-py3-none-any.whl.metadata (12 kB)
    Requirement already satisfied: numpy in c:\users\...\venv\lib\site-packages (from pyspectra) (2.1.2)
    Collecting pandas (from pyspectra)
    Using cached pandas-2.2.3-cp312-cp312-win_amd64.whl.metadata (19 kB)
    Collecting spc-spectra (from pyspectra)
    Using cached spc_spectra-0.4.0.tar.gz (8.6 kB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... error
    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [24 lines of output]
    Traceback (most recent call last):
    [...]
    File "C:\Users\...\AppData\Local\Temp\pip-install-v_qa0rxl\spc-spectra_a351371d52ef45edbd585ef2843e5c1e\spc_spectra\spc.py", line 10, in <module>
    import numpy as np
    ModuleNotFoundError: No module named 'numpy'
    [end of output]


    Could this be a dependency issue between pyspectra 0.0.1.2 and numpy 2.1.2?
    Any input on how to solve it is very appreciated.

    Edit: I am running Python 3.12.5 and pip 24.2 in the virtual environment. This should be fine as PySpectra requires Python >= 3.6 according to its setup.py file (https://github.com/OEUM/PySpectra/blob/main/setup.py).

    Continue reading...

Compartilhe esta Página