pyhoneybot / honeybot

🛩 A python IRC bot with simple plugins dev. Ignited in mauritius, first-timers friendly!
https://pyhoneybot.github.io/honeybot-store/
MIT License
77 stars 87 forks source link

[Bug]: Unable to pip install on `python 3.10` #152

Open MrTanoshii opened 2 years ago

MrTanoshii commented 2 years ago

What happened?

Version: 5.0.9 Operating System: Windows

Steps:

  1. Setup venv
  2. pip install honeybot

Expected behavior:

Installation completes without error.

Additional information:

I tried the recommendation from https://stackoverflow.com/questions/54338270/syntax-error-after-installing-futures-package-in-my-virtualenv and downgraded my setuptools to 45.2.0 and it worked.

Screenshot:

WindowsTerminal_pM1mWBff3f

Relevant log output

Collecting colorama
  Using cached colorama-0.4.5-py2.py3-none-any.whl (16 kB)
Collecting futures
  Using cached futures-3.0.5.tar.gz (25 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\__init__.py", line 247, in <module>
          monkey.patch_all()
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
          patch_for_msvc_specialized_compiler()
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\monkey.py", line 159, in patch_for_msvc_specialized_compiler
          patch_func(*msvc14('_get_vc_env'))
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\monkey.py", line 149, in patch_params
          mod = import_module(mod_name)
        File "C:\Python310\lib\importlib\__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
          import unittest.mock as mock
        File "C:\Python310\lib\unittest\mock.py", line 26, in <module>
          import asyncio
        File "C:\Python310\lib\asyncio\__init__.py", line 8, in <module>
          from .base_events import *
        File "C:\Python310\lib\asyncio\base_events.py", line 18, in <module>
          import concurrent.futures
        File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-8l60h8r4\futures_c2a719274b2049b68e4ac623293c0808\concurrent\futures\__init__.py", line 8, in <module>
          from concurrent.futures._base import (FIRST_COMPLETED,
        File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-8l60h8r4\futures_c2a719274b2049b68e4ac623293c0808\concurrent\futures\_base.py", line 357
          raise type(self._exception), self._exception, self._traceback
                                     ^
      SyntaxError: invalid syntax
      [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.

Code of Conduct

ogabrielluiz commented 2 years ago

Hi! I think I can take this one.

Is pip install 'futures<3.0.0' required in the build.yml file?

It seems this might be the cause of the problem. From what I've read futures shouldn't be installed with Python 3.

MrTanoshii commented 2 years ago

To be completely honest, I'm not sure where the requirements are being kept for the honeybot core The only reference to futures I have found so far is in https://github.com/pyhoneybot/honeybot/blob/00a75fcf7e9230c1fb4fd7aba1138428770653ea/.github/workflows/build.yml#L42

Yes that is correct, I too understand that futures is now part of the standard library in python3+ I wonder if there is a way to retain backwards compatibility whilst not forcing "hacks" such as the setuptools downgrade mentioned above

ogabrielluiz commented 2 years ago

From what I could see locally and in your log output, the problem lies in that futures is installed by some other dependency and gets the first version that works: 3.0.5.

I ran the GitHub workflow locally too and it works. It probably does so because of the pip install futures<3.0.0 command.

One thing to mention is that in spite of the errors, the installation completes.

ogabrielluiz commented 2 years ago

it is python dependency error, downgrade the version of python to 3.8 or 3.7 and check again

If I understood it correctly, the objective is to be able to install in 3.10 without errors.

paulosgf commented 2 years ago

I guess so too