filipporomani / whatsapp-python

Open source Python wrapper for the WhatsApp Cloud API.
https://pypi.org/project/whatsapp-python/
MIT License
82 stars 15 forks source link

[BUG]: pip install broken #26

Closed SebastianBehrens closed 5 months ago

SebastianBehrens commented 6 months ago

Describe the bug Running pip-install whatsapp-python does not work as intended. If fails with various errors.

For one, fast api module is missing (screenshot below). For the other, after installing fast api, from . import ext in __init__.py causes an ImportError.

To Reproduce Steps to reproduce the behavior:

  1. Create .venv
  2. Run pip install whatsapp-python

Expected behavior Install module without errors, assuming no other conflicts, for example, conflicting module requirements.

Desktop (please complete the following information):

Additional context fast api missing:

Defaulting to user installation because normal site-packages is not writeable
Collecting whatsapp-python
  Using cached whatsapp-python-3.0.2.tar.gz (6.8 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-1xme71k0/whatsapp-python_0f9220bf20f9493b9c481d0784c5dbf3/setup.py", line 3, in <module>
          from whatsapp.constants import VERSION
        File "/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-1xme71k0/whatsapp-python_0f9220bf20f9493b9c481d0784c5dbf3/whatsapp/__init__.py", line 8, in <module>
          from fastapi import FastAPI, Request
      ModuleNotFoundError: No module named 'fastapi'
      [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.

internal sourcing

Defaulting to user installation because normal site-packages is not writeable
Collecting whatsapp-python
  Using cached whatsapp-python-3.0.2.tar.gz (6.8 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-5gd09oij/whatsapp-python_de272e575cda4740afbc417c555fac57/setup.py", line 3, in <module>
          from whatsapp.constants import VERSION
        File "/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-5gd09oij/whatsapp-python_de272e575cda4740afbc417c555fac57/whatsapp/__init__.py", line 10, in <module>
          from . import ext
      ImportError: cannot import name 'ext' from 'whatsapp' (/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-5gd09oij/whatsapp-python_de272e575cda4740afbc417c555fac57/whatsapp/__init__.py)
      [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.
filipporomani commented 6 months ago

Hello! Sorry for my late answer. Have you tried pip install whatsapp-python==3.0.6? Also, if you can, are you able to manually install FastAPI (pip install fastapi) manually before trying to install Whatsapp-python?

Thanks in advance for your collaboration!

SebastianBehrens commented 5 months ago

Hi, that did work! Thank you very much. The 3.0.6 version install without issues under 3.12. Tested it with 3.10 as well, install works fine. Tested with 3.7 as well, there it fails, but because requests cannot be found

❯ pip install whatsapp-python
Collecting whatsapp-python
  Using cached https://files.pythonhosted.org/packages/58/f7/18a4db2b475962f8e1138926114a31670467b3578f22c6c5a78369afc0c2/whatsapp-python-3.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-_4yosuou/whatsapp-python/setup.py", line 3, in <module>
        from whatsapp.constants import VERSION
      File "/private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-_4yosuou/whatsapp-python/whatsapp/__init__.py", line 6, in <module>
        import requests
    ModuleNotFoundError: No module named 'requests'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/1f/c30n_2q14556_p9sxtzwyx7h0000gn/T/pip-install-_4yosuou/whatsapp-python/
You are using pip version 19.0.3, however version 24.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.