IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Calcul scientifique Python Discussion :

Problème d'installation de la bibliothèque Scipy


Sujet :

Calcul scientifique Python

  1. #1
    Membre régulier
    Femme Profil pro
    Étudiant
    Inscrit en
    Février 2012
    Messages
    275
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2012
    Messages : 275
    Points : 70
    Points
    70
    Par défaut Problème d'installation de la bibliothèque Scipy
    Bonjour je suis en train de créer ce code python qui permet de filtrer des images à l'aide de filtre moyen. mais j'ai obtenu cet erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Traceback (most recent call last):
      File "D:\mes doc\python\MeanFilter2\main.py", line 2, in <module>
        import scipy.io
    ModuleNotFoundError: No module named 'scipy'
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    import numpy as np
    import scipy.io
     
    # Charger l'image radar depuis le fichier .mat
    image_data = scipy.io.loadmat('image.mat')['image']
     
    # Définir la taille du noyau de filtre de moyenne
    taille_noyau = 3  # Vous pouvez ajuster cette taille selon vos besoins
     
     
    # Fonction pour appliquer le filtre de moyenne
    def filtre_moyenne(image, taille_noyau):
        hauteur, largeur = image.shape
        image_filtree = np.zeros_like(image)
     
        # Parcourir chaque pixel de l'image
        for i in range(hauteur):
            for j in range(largeur):
                # Extraire le voisinage du pixel
                voisinage = image[max(0, i - taille_noyau // 2):min(hauteur, i + taille_noyau // 2 + 1),
                            max(0, j - taille_noyau // 2):min(largeur, j + taille_noyau // 2 + 1)]
                # Appliquer le filtre de moyenne
                image_filtree[i, j] = np.mean(voisinage)
     
        return image_filtree
     
     
    # Appliquer le filtre de moyenne sur l'image radar
    image_filtree = filtre_moyenne(image_data, taille_noyau)
     
    # Afficher l'image originale et l'image filtrée (vous pouvez utiliser matplotlib ou une autre bibliothèque pour afficher les images)
    # Par exemple avec matplotlib :
    import matplotlib.pyplot as plt
     
    plt.subplot(1, 2, 1)
    plt.imshow(image_data, cmap='gray')
    plt.title('Image originale')
    plt.axis('off')
     
    plt.subplot(1, 2, 2)
    plt.imshow(image_filtree, cmap='gray')
    plt.title('Image filtrée')
    plt.axis('off')
     
    plt.show()
    Mais en essayant d'installer la bibliothèque scipy à l'aide de "pip install scipy" j'ai obtenu cet erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    (venv) PS D:\mes doc\python\MeanFilter2> pip install scipy
    Collecting scipy
      Using cached scipy-1.12.0.tar.gz (56.8 MB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Installing backend dependencies ... done
      Preparing metadata (pyproject.toml) ... error
      ERROR: Command errored out with exit status 1:
       command: 'D:\mes doc\python\MeanFilter2\venv\Scripts\python.exe' 'D:\mes doc\python\MeanFilter2\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\SMPS\AppData\Local\Temp\tmptrxdu8ol'
           cwd: C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381
      Complete output (23 lines):
      + meson setup C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381 C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381\.mesonpy-olh53hf3 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381\.mesonpy-olh53hf3\meson-python-native-file.ini
      The Meson build system
      Version: 1.3.2
      Source dir: C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381
      Build dir: C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381\.mesonpy-olh53hf3
      Build type: native build
      Project name: scipy
      Project version: 1.12.0
      C compiler for the host machine: gcc (gcc 6.3.0 "gcc (MinGW.org GCC-6.3.0-1) 6.3.0")
      C linker for the host machine: gcc ld.bfd 2.28
      C++ compiler for the host machine: c++ (gcc 6.3.0 "c++ (MinGW.org GCC-6.3.0-1) 6.3.0")
      C++ linker for the host machine: c++ ld.bfd 2.28
      Cython compiler for the host machine: cython (cython 3.0.8)
      Host machine cpu family: x86
      Host machine cpu: x86
      Program python found: YES (D:\mes doc\python\MeanFilter2\venv\Scripts\python.exe)
      Run-time dependency python found: YES 3.10
      ..\meson.build:32: WARNING: You are building from source on a 32-bit Python install. SciPy does not provide 32-bit wheels; install 64-bit Python if you are having issues!
      Program cython found: YES (C:\Users\SMPS\AppData\Local\Temp\pip-build-env-fpyelsy9\overlay\Scripts\cython.EXE)
     
      ..\meson.build:45:4: ERROR: Problem encountered: SciPy requires GCC >= 8.0
     
      A full log can be found at C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_882e7764672c437487e57fcee27ba381\.mesonpy-olh53hf3\meson-logs\meson-log.txt
      ----------------------------------------
    WARNING: Discarding https://files.pythonhosted.org/packages/30/85/cdbf2c3c460fe5aae812917866392068a88d02f07de0fe31ce738734c477/scipy-1.12.0.tar.gz#sha256=4bf5abab8a36d20193c698b0f1fc282c1d083c94723902c447e5d2f1780936a3 (from https://pypi.org/simple/scipy/) (requires-python:>=3.9). Command errored out with exit status 1: 'D:\mes doc\doc\THESE\python\MeanFilter2\venv\Scripts\python.exe' 'D:\mes doc\python\MeanFilter2\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\SMPS\AppData\Local\Temp\tmptrxdu8ol' Check the logs for full command output.
      Using cached scipy-1.11.4.tar.gz (56.3 MB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Installing backend dependencies ... done
      Preparing metadata (pyproject.toml) ... error
      ERROR: Command errored out with exit status 1:
       command: 'D:\mes doc\python\MeanFilter2\venv\Scripts\python.exe' 'D:\mes doc\python\MeanFilter2\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\SMPS\AppData\Local\Temp\tmpe2bxjmhd'
           cwd: C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911
      Complete output (23 lines):
      + meson setup C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911 C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911\.mesonpy-0mnr1_xe -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911\.mesonpy-0mnr1_xe\meson-python-native-file.ini
      The Meson build system
      Version: 1.3.2
      Source dir: C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911
      Build dir: C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911\.mesonpy-0mnr1_xe
      Build type: native build
      Project name: SciPy
      Project version: 1.11.4
      C compiler for the host machine: gcc (gcc 6.3.0 "gcc (MinGW.org GCC-6.3.0-1) 6.3.0")
      C linker for the host machine: gcc ld.bfd 2.28
      C++ compiler for the host machine: c++ (gcc 6.3.0 "c++ (MinGW.org GCC-6.3.0-1) 6.3.0")
      C++ linker for the host machine: c++ ld.bfd 2.28
      Cython compiler for the host machine: cython (cython 0.29.37)
      Host machine cpu family: x86
      Host machine cpu: x86
      Program python found: YES (D:\mes doc\python\MeanFilter2\venv\Scripts\python.exe)
      Run-time dependency python found: YES 3.10
      ..\meson.build:32: WARNING: You are building from source on a 32-bit Python install. SciPy does not provide 32-bit wheels; install 64-bit Python if you are having issues!
      Program cython found: YES (C:\Users\SMPS\AppData\Local\Temp\pip-build-env-o76bxoea\overlay\Scripts\cython.EXE)
     
      ..\meson.build:45:4: ERROR: Problem encountered: SciPy requires GCC >= 8.0
     
      A full log can be found at C:\Users\SMPS\AppData\Local\Temp\pip-install-pif7xn5s\scipy_49974063178848ce9f7be08084cca911\.mesonpy-0mnr1_xe\meson-logs\meson-log.txt
      ----------------------------------------
    WARNING: Discarding https://files.pythonhosted.org/packages/6e/1f/91144ba78dccea567a6466262922786ffc97be1e9b06ed9574ef0edc11e1/scipy-1.11.4.tar.gz#sha256=90a2b78e7f5733b9de748f589f09225013685f9b218275257f8a8168ededaeaa (from https://pypi.org/simple/scipy/) (requires-python:>=3.9). Command errored out with exit status 1: 'D:\mes doc\doc\MeanFilter2\venv\Scripts\python.exe' 'D:\mes doc\python\MeanFilter2\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\SMPS\AppData\Local\Temp\tmpe2bxjmhd' Check the logs for full command output.
      Using cached scipy-1.11.3.tar.gz (56.3 MB)
    ...................
    Y'a t'il une solution pour installer scipy ou de la remplacer par une autre méthode pour lire les fichiers .mat sachant que j'ai essayé avec la bibliothèque open cv mais il parait qu'il est impossible de lire les fichiers .mat en utilisant la bibliothèque opencv
    merci d'avance

  2. #2
    Membre chevronné
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2003
    Messages
    1 572
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2003
    Messages : 1 572
    Points : 2 014
    Points
    2 014
    Par défaut
    Il semble que votre version de Python 3.10 soit en 32 bits et SciPy attend une version en 64 bits.

  3. #3
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 287
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 287
    Points : 36 776
    Points
    36 776
    Par défaut
    Citation Envoyé par Arioch Voir le message
    Il semble que votre version de Python 3.10 soit en 32 bits et SciPy attend une version en 64 bits.
    Le message d'erreur semble dire que ça veut recompiler parce qu'il n'y a pas de binaires 32bis.
    Ce qui suggère installer un Python 64 ou apprendre à compiler.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Comment installé Scipy
    Par pierrot10 dans le forum Général Python
    Réponses: 1
    Dernier message: 06/09/2017, 11h02
  2. Installations bibliothèques (numpy, scipy, sckit learn)
    Par tibb180 dans le forum Déploiement/Installation
    Réponses: 3
    Dernier message: 15/02/2017, 15h17
  3. [Python 3.X] installer SciPy sous mac os X
    Par elodouwen dans le forum Déploiement/Installation
    Réponses: 1
    Dernier message: 26/06/2015, 08h04
  4. installation de scipy
    Par elodouwen dans le forum Déploiement/Installation
    Réponses: 2
    Dernier message: 23/03/2014, 11h14
  5. [Scipy] Installing Scipy
    Par billyrose dans le forum Calcul scientifique
    Réponses: 28
    Dernier message: 29/08/2008, 00h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo