OfflineIMAP / offlineimap3

Read/sync your IMAP mailboxes (python3)
Other
428 stars 63 forks source link

KeyError: 'cygwin' when installing #192

Closed sainttttt closed 2 weeks ago

sainttttt commented 5 months ago

When trying to install from git on macOS 13.6.1 (intel mac, not m1) I keep getting this error. Same issue if I try to install from pip.

Installed /Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/offlineimap-8.0.0-py3.11.egg
Processing dependencies for offlineimap==8.0.0
Traceback (most recent call last):
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2760, in requires
    deps.extend(dm[safe_extra(ext)])
                ~~^^^^^^^^^^^^^^^^^
KeyError: 'cygwin'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/saint/code/offlineimap3/setup.py", line 52, in <module>
    setup(name="offlineimap",
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
    self.run_command(cmd)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/command/install.py", line 74, in run
    self.do_egg_install()
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/command/install.py", line 131, in do_egg_install
    cmd.run(show_deprecation=False)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/command/easy_install.py", line 420, in run
    self.easy_install(spec, not self.no_deps)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/command/easy_install.py", line 662, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/command/easy_install.py", line 709, in install_item
    self.process_distribution(spec, dist, deps)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/setuptools/command/easy_install.py", line 754, in process_distribution
    distros = WorkingSet([]).resolve(
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 803, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2762, in requires
    raise UnknownExtra(
pkg_resources.UnknownExtra: portalocker 2.8.2 has no such extra feature 'cygwin'
✝ ~/code/offlineimap3 ✝  offlineimap -v
Traceback (most recent call last):
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2760, in requires
    deps.extend(dm[safe_extra(ext)])
                ~~^^^^^^^^^^^^^^^^^
KeyError: 'cygwin'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/saint/.asdf/installs/python/3.11.5/bin/offlineimap", line 4, in <module>
    __import__('pkg_resources').run_script('offlineimap==8.0.0', 'offlineimap')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 3259, in <module>
    @_call_aside
     ^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 803, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/saint/.asdf/installs/python/3.11.5/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2762, in requires
    raise UnknownExtra(
pkg_resources.UnknownExtra: portalocker 2.8.2 has no such extra feature 'cygwin'
thekix commented 4 weeks ago

Hi,

perhaps, we should change the setup.py file and include cygwin as optional.

We can change this code:

setup(name="offlineimap",
      version=offlineimap.__version__,
      description=offlineimap.__description__,
      long_description=offlineimap.__description__,
      author=offlineimap.__author__,
      author_email=offlineimap.__author_email__,
      url=offlineimap.__homepage__,
      packages=['offlineimap', 'offlineimap.folder',
                'offlineimap.repository', 'offlineimap.ui',
                'offlineimap.utils'],
      scripts=['bin/offlineimap'],
      license=offlineimap.__copyright__ + ", Licensed under the GPL version 2",
      cmdclass={'test': TestCommand},
      install_requires=['distro', 'imaplib2>=3.5', 'rfc6555', 'gssapi[kerberos]', 'portalocker[cygwin]', 'urllib3~=1.25.9'],
      extras_require={'keyring': ['keyring']},
      )

To:

setup(name="offlineimap",
      version=offlineimap.__version__,
      description=offlineimap.__description__,
      long_description=offlineimap.__description__,
      author=offlineimap.__author__,
      author_email=offlineimap.__author_email__,
      url=offlineimap.__homepage__,
      packages=['offlineimap', 'offlineimap.folder',
                'offlineimap.repository', 'offlineimap.ui',
                'offlineimap.utils'],
      scripts=['bin/offlineimap'],
      license=offlineimap.__copyright__ + ", Licensed under the GPL version 2",
      cmdclass={'test': TestCommand},
      install_requires=['distro', 'imaplib2>=3.5', 'rfc6555', 'gssapi[kerberos]', 'urllib3~=1.25.9'],
      extras_require={
          'keyring': ['keyring'],
          'portalocker[cygwin]'
      },
      )

@sainttttt This change solves this issue?

thekix commented 2 weeks ago

@sainttttt

the setup process is fully rewritten, please, try now (from github, I will upload a new version to PyPi soon).

Regards, kix