jbaiter / zotero-cli

Command-line interface for Zotero
MIT License
274 stars 41 forks source link

unable to run zotcli: ModuleNotFoundError: No module named 'ConfigParser' #52

Closed sebastianbock17 closed 2 years ago

sebastianbock17 commented 2 years ago
Traceback (most recent call last):
  File "/home/test/.local/bin//zotcli", line 5, in <module>
    from zotero_cli.main import cli
  File "/home/test/.local/lib/python3.10/site-packages/zotero_cli/main.py", line 8, in <module>
    import ConfigParser
ModuleNotFoundError: No module named 'ConfigParser'

However, I have ConfigParser Installed:

Requirement already satisfied: ConfigParser in ./.local/lib/python3.10/site-packages (5.2.0)

What could I do now?

Kind regards :)

tigerjack commented 2 years ago

@yetipowers Did you have any problems during installation? For me, there is a problem with pathlib installation in python 3.10 leading to this problem

Collecting pathlib>=1.0.1
  Downloading pathlib-1.0.1.tar.gz (49 kB)
     |████████████████████████████████| 49 kB 3.9 MB/s             
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ab9bu1go/pathlib_b726ca21851d47e291260824c74a796a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ab9bu1go/pathlib_b726ca21851d47e291260824c74a796a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-qkq_x2rg
         cwd: /tmp/pip-install-ab9bu1go/pathlib_b726ca21851d47e291260824c74a796a/
    Complete output (13 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 16, in <module>
        import setuptools.version
      File "/usr/lib/python3.10/site-packages/setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 23, in <module>
        import zipfile
      File "/usr/lib/python3.10/zipfile.py", line 19, in <module>
        import pathlib
      File "/tmp/pip-install-ab9bu1go/pathlib_b726ca21851d47e291260824c74a796a/pathlib.py", line 10, in <module>
        from collections import Sequence
    ImportError: cannot import name 'Sequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

From a quick read, I think the import should be from collections.abc and not from collections. Indeed, on python 3.9, you have

<ipython-input-1-8844d1891ca7>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

Not sure how to fix it though.

tigerjack commented 2 years ago

I hacked the problem by modifying the system file for collections, which in my ArchLinux is /usr/lib/python3.10/collections/__init__.py. Right after import _collections_abc I added from _collections_abc import Sequence.

To note that this is a dirty hack, a fix from the developers is needed.

sebastianbock17 commented 2 years ago

Dear @tigerjack, thank you a lot for the hint.

I realized there is an aur package: python-pathlib

After installing it (version python-pathlib-1.0.1-1), I installed zotero-cli from github following the instructions from the Readme.md, and now it finally works!!

So the solution is simply installing python-pathlib library :)

tigerjack commented 2 years ago

@yetipowers Glad it worked. For me, the pathlib package from AUR was not solving the problem.