Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix/upgrade geoip2 requirements where possible #1909

Merged
merged 3 commits into from
Jul 25, 2020
Merged

Conversation

dgw
Copy link
Member

@dgw dgw commented Jul 25, 2020

Split geoip2 requirement into ranges based on Python release.

Capped maxminddb version on old Pythons now that v2.0 dropped them.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

Notes

I'm planning to cut a 7.0.5 release with this unless any @sopel-irc/rockstars strenuously object. We're still too far off from finishing 7.1 to wait for that release. This is going to cause issues with new installs of 7.0.4.

Split `geoip2` requirement into ranges based on Python release.

Capped `maxminddb` version on old Pythons now that v2.0 dropped them.
@dgw dgw added Build Bugfix Generally, PRs that reference (and fix) one or more issue(s) labels Jul 25, 2020
@dgw dgw added this to the 7.0.5 milestone Jul 25, 2020
@dgw dgw requested a review from a team July 25, 2020 05:44
@dgw
Copy link
Member Author

dgw commented Jul 25, 2020

I'm aware that the build currently fails due to other test changes that need to be backported onto 7.0.x. I'll do those once people like @Exirel have a chance to weigh in on actually releasing this as a v7.0.5.

@Exirel
Copy link
Contributor

Exirel commented Jul 25, 2020

Yeah let's do this, it's great!

dgw added 2 commits July 25, 2020 12:22
The fields available in the GeoIP database are liable to change at any
time, without warning. As long as the hostname looks fine and it belongs
to the right AS, we don't really care about the extras, though.
We are not backporting the use of VCR to 7.0.x, so this example still
needs to work without it.
@dgw dgw merged commit 17a9d91 into 7.0.x Jul 25, 2020
@dgw dgw deleted the update-geoip2-reqs branch July 25, 2020 17:41
@mascalzone
Copy link

mascalzone commented Jul 25, 2020

Hello.
I don't know if this is the right place, but I didn't find anything on the net that could help me on geoip for sopel.
i installed sopel 7.0.4 on vps, ubuntu 18, everything works except the ip plugin.
I report the error here:

[2020-07-26 00:18:58,386] sopel.bot            ERROR    - Error loading ip: invalid
syntax (__init__.py, line 25)
Traceback (most recent call last):
  File "/home/server/.local/lib/python2.7/site-packages/sopel/bot.py", line 206,
  in setup_plugins
    plugin.load()
  File "/home/server/.local/lib/python2.7/site-packages/sopel/plugins/handlers.py",
  line 246, in load
    self._module = importlib.import_module(self.module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/server/.local/lib/python2.7/site-packages/sopel/modules/ip.py",
  line 18, in <module>
    import geoip2.database
  File "/home/server/.local/lib/python2.7/site-packages/geoip2/database.py",
  line 9, in <module>
    import maxminddb
  File "/home/server/.local/lib/python2.7/site-packages/maxminddb/__init__.py",
  line 25
    database: Union[AnyStr, int, os.PathLike, IO], mode: int = MODE_AUTO
            ^
SyntaxError: invalid syntax

hoping that I can get help, on how to solve the problem, perhaps with a steep to steep explanation, because I'm not a lunux expert. Thank you so much.

@dgw
Copy link
Member Author

dgw commented Jul 26, 2020

@mascalzone Temporary workaround: use pip to downgrade to maxminddb<2.0.

Or await Sopel 7.0.5, which will include this patch (intended to fix the issue you're seeing) and should be out yet this weekend.

@mascalzone
Copy link

sorry, please, I'm completely ignorant on linux.
How do I do what you say?
Can you write me the complete command and the various steeps?
And I have another question: why does everything work perfectly on an ubuntu16 with sopel 6.0.9?

@mascalzone
Copy link

mascalzone commented Jul 26, 2020

I gave pip install maxminddb

server@lubuntu:~/sopel-7.0.4$ pip install maxminddb
/home/server/.local/lib/python2.7/site-packages/cryptography/__init__.py:39:
CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core
team. Support for it is now deprecated in cryptography, and will be removed in a
future release.
  CryptographyDeprecationWarning,
Collecting maxminddb
Installing collected packages: maxminddb
Successfully installed maxminddb-2.0.0

but nothing has changed.

Sopel always starts with the ip module in error
[2020-07-26 01:14:34,135] sopel.bot INFO - Registered 41 plugins, 1 failed, 0 disabled


@dgw
Copy link
Member Author

dgw commented Jul 26, 2020

SO MANY things have changed in Sopel since 6.0.9, I couldn't even begin to list them here. The changes in library versions between Ubuntu 16 and 18 are even greater.

I must assume you've used pip to install sopel following the install instructions.

If so, run sudo pip install maxminddb<2.0 to get an older version that's still compatible with your release of Python.


Alternatively, Ubuntu 18 should have a new enough Python 3 release for you to use that instead and not get the error, with sudo pip3 install sopel. (Note that the next major version of Sopel, 8.0, will stop supporting Python 2 as well.)

@mascalzone
Copy link

I did: pip3 install -e.
and now everything works perfectly. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s) Build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants