VoxelCubes / PanelCleaner

An AI-powered tool to clean manga panels.
GNU General Public License v3.0
208 stars 16 forks source link

Issue with Docopt #26

Closed VoxelCubes closed 10 months ago

VoxelCubes commented 10 months ago

Discussed in https://github.com/VoxelCubes/PanelCleaner/discussions/25

Originally posted by **R3ck1e** November 7, 2023 Can't run on Mac. Full trace: Last login: Tue Nov 7 18:57:25 on ttys001 /Users/romangoncarov/Library/Python/3.9/bin/pcleaner ; exit; romangoncarov@mbp-roman ~ % /Users/romangoncarov/Library/Python/3.9/bin/pcleaner ; exit; /Users/romangoncarov/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:34: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020 warnings.warn( Traceback (most recent call last): File "/Users/romangoncarov/Library/Python/3.9/bin/pcleaner", line 5, in from pcleaner.main import main File "/Users/romangoncarov/Library/Python/3.9/lib/python/site-packages/pcleaner/main.py", line 107, in from docopt import magic_docopt ImportError: cannot import name 'magic_docopt' from 'docopt' (/Users/romangoncarov/Library/Python/3.9/lib/python/site-packages/docopt/__init__.py) Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. // Can't figure out what's wrong. The same error on Python 3.12. pip version is 23.2.1
VoxelCubes commented 10 months ago

Since this is an issue, I'll answer it over here. There are a few problems here, primarily that you attempted to use Python 3.9, which unfortunately won't work. With 3.12 it really should, since it's 3.10 and newer.

That aside, the issue is an older one that should have been fixed, I removed all mentions of magic_docopt since version 2.0, so please try to run pip install --upgrade pcleaner in your terminal.

The issue itself stemms from docopt actually being unmaintained, however, a new fork with a package called docopt-ng exists, which is also imported under the name docopt, but provides more features (namely magic_docopt). So if you had the old docopt previously installed, then upon installing pcleaner, pip will not install docopt-ng if the old docopt is already present, causing the issue above. I have since limited my use of docoptng to make it compatible with old docopt, but if you wish to be on the safe side, do pip uninstall docopt followed by pip install docopt-ng to fix the underlying problem. I would still highly recommend upgrading pcleaner, regardless.