Problème avec pip install sur python

Bonjour,

Jesuis débutant et je viens d'installer python 3.11.0. Quand je marque la commande :

pip install chatterbot

... ça m'affiche un message d'erreur de syntaxe en me mettant des flèches sous "install".

Quelqu'un aurait une solution à me proposer ? 

3 réponses

  1. Où tapes-tu cette commande? Si tu as l'incitation
    >>> pip ...
    Tu es dans l'invite de Python. Il faut exécuter dans l'invite de Android.

    Si tu tiens absolument à le faire à cet endroit:
    import os
    os.system("pip install chatterbot")

    1
    1. C'est où l'invite d'Android (désolée si je te pose des questions qui te paraissent bêtes, mais c'est car je suis débutant)

      0
    2. Et j'ai essayé de faire
       

      import os
      
      os.system("pip install chatterbot")

      ... et ça marque :

      This error originates front a subprocess, and is likely not a problem with pip

      Merci d'avance pour la réponse

      0
    3. Modérateur
      @elemented

      Quel est le message d'erreur complet ?

      0
    4. @mamiemando

      Ça marque tous ça :

      Defaulting to user installation because normal site-packages is not writeable
      Collecting chatterbot
        Using cached ChatterBot-1.0.5-py2.py3-none-any.whl (67 kB)
      Collecting mathparse<0.2,>=0.1
        Using cached mathparse-0.1.2-py3-none-any.whl (7.2 kB)
      Collecting nltk<4.0,>=3.2
        Using cached nltk-3.8.1-py3-none-any.whl (1.5 MB)
      Collecting pint>=0.8.1
        Using cached Pint-0.20.1-py3-none-any.whl (269 kB)
      Collecting pymongo<4.0,>=3.3
        Using cached pymongo-3.13.0-cp311-cp311-win_amd64.whl (394 kB)
      Collecting python-dateutil<2.8,>=2.7
        Using cached python_dateutil-2.7.5-py2.py3-none-any.whl (225 kB)
      Collecting pyyaml<5.2,>=5.1
        Using cached PyYAML-5.1.2.tar.gz (265 kB)
        Preparing metadata (setup.py) ... done
      Collecting spacy<2.2,>=2.1
        Using cached spacy-2.1.9.tar.gz (30.7 MB)
        Installing build dependencies ... error
        error: subprocess-exited-with-error
        × pip subprocess to install build dependencies did not run successfully.
        │ exit code: 1
        ╰─> [87 lines of output]
            Collecting setuptools
              Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
            Collecting wheel<0.33.0,>0.32.0
              Using cached wheel-0.32.3-py2.py3-none-any.whl (21 kB)
            Collecting Cython
              Using cached Cython-0.29.33-py2.py3-none-any.whl (987 kB)
            Collecting cymem<2.1.0,>=2.0.2
              Using cached cymem-2.0.7-cp311-cp311-win_amd64.whl (28 kB)
            Collecting preshed<2.1.0,>=2.0.1
              Using cached preshed-2.0.1.tar.gz (113 kB)
              Preparing metadata (setup.py): started
              Preparing metadata (setup.py): finished with status 'done'
            Collecting murmurhash<1.1.0,>=0.28.0
              Using cached murmurhash-1.0.9-cp311-cp311-win_amd64.whl (18 kB)
            Collecting thinc<7.1.0,>=7.0.8
              Using cached thinc-7.0.8.tar.gz (1.9 MB)
              Preparing metadata (setup.py): started
              Preparing metadata (setup.py): finished with status 'done'
            Collecting blis<0.3.0,>=0.2.1
              Using cached blis-0.2.4.tar.gz (1.5 MB)
              Preparing metadata (setup.py): started
              Preparing metadata (setup.py): finished with status 'done'
            Collecting wasabi<1.1.0,>=0.0.9
              Using cached wasabi-0.10.1-py3-none-any.whl (26 kB)
            Collecting srsly<1.1.0,>=0.0.6
              Using cached srsly-1.0.6-cp311-cp311-win_amd64.whl (194 kB)
            Collecting numpy>=1.7.0
              Using cached numpy-1.24.1-cp311-cp311-win_amd64.whl (14.8 MB)
            Collecting plac<1.0.0,>=0.9.6
              Using cached plac-0.9.6-py2.py3-none-any.whl (20 kB)
            Collecting tqdm<5.0.0,>=4.10.0
              Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
            Collecting colorama
              Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
            Installing collected packages: wasabi, plac, cymem, wheel, srsly, setuptools, preshed, numpy, murmurhash, Cython, colorama, tqdm, blis, thinc
              DEPRECATION: preshed is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
              Running setup.py install for preshed: started
              Running setup.py install for preshed: finished with status 'error'
              error: subprocess-exited-with-error
              Running setup.py install for preshed did not run successfully.
              exit code: 1
              [32 lines of output]
              C:\Program Files\Python311\Lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
                warnings.warn(
              WARNING: The wheel package is not available.
              running install
              C:\Program Files\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
                warnings.warn(
              running build
              running build_py
              creating build
              creating build\lib.win-amd64-cpython-311
              creating build\lib.win-amd64-cpython-311\preshed
              copying preshed\about.py -> build\lib.win-amd64-cpython-311\preshed
              copying preshed\__init__.py -> build\lib.win-amd64-cpython-311\preshed
              creating build\lib.win-amd64-cpython-311\preshed\tests
              copying preshed\tests\test_counter.py -> build\lib.win-amd64-cpython-311\preshed\tests
              copying preshed\tests\test_hashing.py -> build\lib.win-amd64-cpython-311\preshed\tests
              copying preshed\tests\test_pop.py -> build\lib.win-amd64-cpython-311\preshed\tests
              copying preshed\tests\__init__.py -> build\lib.win-amd64-cpython-311\preshed\tests
              copying preshed\counter.pyx -> build\lib.win-amd64-cpython-311\preshed
              copying preshed\maps.pyx -> build\lib.win-amd64-cpython-311\preshed
              copying preshed\counter.pxd -> build\lib.win-amd64-cpython-311\preshed
              copying preshed\maps.pxd -> build\lib.win-amd64-cpython-311\preshed
              copying preshed\__init__.pxd -> build\lib.win-amd64-cpython-311\preshed
              running build_ext
              building 'preshed.maps' extension
              creating build\temp.win-amd64-cpython-311
              creating build\temp.win-amd64-cpython-311\Release
              creating build\temp.win-amd64-cpython-311\Release\preshed
              "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Python311\include" "-IC:\Program Files\Python311\include" "-IC:\Program Files\Python311\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /EHsc /Tppreshed/maps.cpp /Fobuild\temp.win-amd64-cpython-311\Release\preshed/maps.obj /Ox /EHsc
              maps.cpp
              preshed/maps.cpp(181): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'longintrepr.h'ÿ: No such file or directory
              error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
              [end of output]
              note: This error originates from a subprocess, and is likely not a problem with pip.
            error: legacy-install-failure
            Encountered error while trying to install package.
            preshed
            note: This is an issue with the package mentioned above, not pip.
            hint: See above for output from the failure.
            [end of output]
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error
      × pip subprocess to install build dependencies did not run successfully.
      │ exit code: 1
      ╰─> See above for output.
      note: This error originates from a subprocess, and is likely not a problem with pip.
      1
      
      0
    5. Modérateur
      @elemented

      Bonjour,

      Merci de soigner l'orthographe "sa" -> "ça"

      Ton erreur se déclenche au moment de compiler le module preshed qui est manifestement une dépendance de chatterbot et donc du code source de preshed.

      Plus précisément le header longintrepr.h n'est pas trouvé. Cela semble lié à un changement de cpython (voir ce lien). Selon ce lien cette inclusion n'est pas nécessaire et surtout ne correspond plus au bon chemin. Il suffirait donc que tu corriges le fichier preshed/maps.cpp et ligne 181 que tu supprimes cette ligne qui doit contenir grosso modo:

      #include "longintrepr.h"

      Bonne chance

      0
  2. Essaye peut-être de mettre une version antérieur a la 3.11.0 j'avais le même problème que toi, j'ai juste mis une version antérieur et ça a marché.

    Et si tu es sur pycharm je peux te conseiller d'aller dans ses paramètres :

    File > settings > project... > project interpreter

    Tu appuies sur le + et tu choisis la version que tu veux.

    0
    1. pour ceux qui cherche une réponse il y a une version v2 de chatterbot l'ancienne a ce type de problème

      0