Unmanic / unmanic

Unmanic - Library Optimiser
GNU General Public License v3.0
1.43k stars 84 forks source link

ImportError: cannot import name 'Hashable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py) #325

Open KyleRConway opened 2 years ago

KyleRConway commented 2 years ago

Description

Installing via instructions with pip on Fedora 36 beta.

python -VV Python 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]

Steps to Reproduce

  1. Run Fedora Workstation 36 Beta (or possibly just use python 3.10)
  2. Follow pip install instructions: https://docs.unmanic.app/docs/installation/pip
  3. python3 -m pip install unmanic
  4. unmanic fails
  5. See error "ImportError: cannot import name 'Hashable' from 'collections' (/usr/lib64/python3.10/collections/init.py)"

Expected behavior: Program runs successfully

Actual behaviour: It fails:

Reproduces how often: 100%

Versions

When I got web portal running it showed the following: Version: 0.2.1~4ad7b90

NAME="Fedora Linux" VERSION="36 (Workstation Edition)" ID=fedora VERSION_ID=36 VERSION_CODENAME="" PLATFORM_ID="platform:f36" PRETTY_NAME="Fedora Linux 36 (Workstation Edition)" ANSI_COLOR="0;38;2;60;110;180" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:36" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/" SUPPORT_URL="https://ask.fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=36 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=36 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" VARIANT="Workstation Edition" VARIANT_ID=workstation

Installation Method Used

Pip (as above)

Additional Information

Changing the file $HOME/.local/lib/python3.10/site-packages/peewee_migrate/auto.py import seems to resolve (though I'm a 1st time user, so just getting it running).

I commented out the broken line and added two individual imports (main being Hashable from collections.abc instead of from collections).

from collections import Hashable, OrderedDict

from collections.abc import Hashable
from collections import OrderedDict

The program then ran successfully. Though I'm uncertain if there are other issues with this fix as I'm a new user.

KyleRConway commented 2 years ago

Just noticed this is an upstream issue, but it looks fixed here so maybe a versioning thing?

Thanks.

KyleRConway commented 2 years ago

May want to upgrade the version in the requirements file, though I'm not sure what downsides may exist. Looks like peewee_migrate is up to version 1.4.8 now and requirements.txt calls for peewee_migrate==1.1.6

Josh5 commented 2 years ago

If you upgrade it and it works for a clean install (so all migrations were able to run), then I'll happily take a PR.

cshyjak commented 1 year ago

@Josh5 I think this should be resolved now with my latest batch of PRs. Mainly https://github.com/Unmanic/unmanic/pull/369

tazboyz16 commented 1 year ago

This issue is still impacting. Ubuntu 22 with pip install. Directions provided for the auto.py resolved the issue

UniverseXXX commented 1 year ago

The issue is still not resolved in Ubuntu 22.04.01

hsingh314 commented 1 year ago

Just had this issue also - trying the fix in the OP. But I don't think its resolved in 22.04.

t3dc commented 1 year ago

This also just worked for me on a Mac M1 running MacOS 12.2. :)

djismgaming commented 1 year ago

python3 -m pip install peewee-migrate==1.4.8 made this work as a workaround on Ubuntu 22.04.1 LTS on Windows 10 x86_64

CamoMano commented 1 year ago

python3 -m pip install peewee-migrate==1.4.8 made this work as a workaround on Ubuntu 22.04.1 LTS on Windows 10 x86_64

Curiously that did not work for me and I'm also using Ubuntu 22.04.1.

I just end up with a different error. Traceback (most recent call last): File "/home/snowsquall/.local/bin/unmanic", line 8, in <module> sys.exit(main()) File "/home/snowsquall/.local/lib/python3.10/site-packages/unmanic/service.py", line 308, in main service.run() File "/home/snowsquall/.local/lib/python3.10/site-packages/unmanic/service.py", line 242, in run self.db_connection = init_db(settings.get_config_path()) File "/home/snowsquall/.local/lib/python3.10/site-packages/unmanic/service.py", line 74, in init_db migrations.update_schema() File "/home/snowsquall/.local/lib/python3.10/site-packages/unmanic/libs/db_migrate.py", line 119, in update_schema self.router.migrator.create_table(model) File "/usr/lib/python3.10/functools.py", line 981, in __get__ val = self.func(instance) File "/home/snowsquall/.local/lib/python3.10/site-packages/peewee_migrate/router.py", line 83, in migrator self.run_one(name, migrator) File "/home/snowsquall/.local/lib/python3.10/site-packages/peewee_migrate/router.py", line 166, in run_one migrate(migrator, self.database, fake=fake) File "<string>", line 49, in migrate File "/home/snowsquall/.local/lib/python3.10/site-packages/peewee.py", line 3808, in get_columns return [ColumnMetadata(r[1], r[2], not r[3], bool(r[5]), table, r[4]) TypeError: 'Mock' object is not iterable