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

"python3 -m pip install OL-GeoIP" fails #1694

Closed
3 of 6 tasks
cclauss opened this issue Dec 8, 2018 · 15 comments
Closed
3 of 6 tasks

"python3 -m pip install OL-GeoIP" fails #1694

cclauss opened this issue Dec 8, 2018 · 15 comments
Assignees
Labels
Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] Priority: 3 Issues that we can consider at our leisure. [managed] python Pull requests that update Python code Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed]

Comments

@cclauss
Copy link
Collaborator

cclauss commented Dec 8, 2018

https://pypi.org/project/OL-GeoIP/1.2.4 is not updated since 2011

Do we need GeoIP?
Do we know what mods were made from upstream for the OL project?
Should we try to use upstream instead?

https://github.com/internetarchive/openlibrary/blob/master/requirements_common.txt#L23

https://travis-ci.org/internetarchive/openlibrary/jobs/465261888#L881

  • py_GeoIP.c:25:1: error: unknown type name ‘staticforward’

Next steps

  • It exports GeoIP; does it export anything else?
  • Find uses of GeoIP
  • Diff our version with the upstream
  • See when it was introduced; maybe the commit message has some info
  • Is geoip_database defined in the config on prod?
  • Does /usr/local/maxmind-geoip/GeoLiteCity.dat exist on prod?

Stakeholders

@nibrahim

@hornc
Copy link
Collaborator

hornc commented Jan 4, 2019

I have suspected we don't need GeoIP for a while, it would be good to confirm we don't then remove it.

@cclauss
Copy link
Collaborator Author

cclauss commented Jan 4, 2019

I will try to do that. I also sense that a run of https://github.com/jendrikseipp/vulture on the codebase might highlight other deadcode.

@tfmorris
Copy link
Contributor

tfmorris commented Jan 4, 2019

@hornc What do you think has changed on that front (and when)? In the past year or so, when I was getting spurious "Your library can lend you this" messages, updating GeoIP was the solution. It is(was?) part of the "pretend we're lending library" thing. If the geolocation piece is handled differently or the "pretend" part is gone, it'd be a good dependency to get rid of because it requires constant updating to be current.

@cclauss
Copy link
Collaborator Author

cclauss commented Aug 13, 2019

@cdrini Maybe push a bit here?

@cdrini
Copy link
Collaborator

cdrini commented Aug 15, 2019

Added some next steps to issue.

@cclauss Is this a blocker for python3?

@tfmorris @hornc any clues as to where it might be used?

@cdrini
Copy link
Collaborator

cdrini commented Aug 15, 2019

Here's the diff of OL-GeoIP (downloaded src from pypi) and upstream at same version (jlopez/maxmind-geoip@4ec7259 ):

diff maxmind-geoip/setup.py OL-GeoIP-1.2.4/setup.py
1c1,6
< from distutils.core import setup, Extension
---
> from setuptools import setup, Extension
>
> description = """
> This is a fork of the Maxmind GeoIP Python wrapper library originally from GitHub at
> https://github.com/jlopez/maxmind-geoip with some minor changes for the openlibrary.org project
> """
4,7c9,12
<       libraries = ['GeoIP'],
<       sources = ['py_GeoIP.c'],
<       library_dirs = ['/usr/local/lib'],
<       include_dirs = ['/usr/local/include'])
---
>                     libraries = ['GeoIP'],
>                     sources = ['py_GeoIP.c'],
>                     library_dirs = ['/opt/local/lib', '/usr/local/lib'],
>                     include_dirs = ['/opt/local/include', '/usr/local/include'])
9,12c14,21
< setup (name = 'GeoIP-Python',
<       version = '1.2.4',
<       description = 'This is a python wrapper to GeoIP',
<       ext_modules = [module1])
---
> setup (name = 'OL-GeoIP',
>        version = '1.2.4',
>        description = description,
>        ext_modules = [module1],
>        maintainer = "Noufal Ibrahim",
>        # url = "https://github.com/nibrahim/maxmind-geoip/tarball/master",
>        # # url = "https://github.com/nibrahim/maxmind-geoip",
>        maintainer_email = "[email protected]")

Only notable change was adding /opt/local/lib to library_dirs and /opt/local/include to include_dirs. My python-package-fu is not very strong; what does this mean?

@cclauss
Copy link
Collaborator Author

cclauss commented Aug 15, 2019

I am unsure if this is a blocker but Latest commit 7206da2 on Dec 7, 2011 should be a cause for concern.

@cdrini
Copy link
Collaborator

cdrini commented Aug 15, 2019

  • It was added in this commit to requirements: 3948c39 (14 Dec 2011)
  • Before that it was added to setup.py by @nibrahim e5ef75c on 11 Oct 2011 (same day as release on pypi)

Commit message was "Added an update to get GeoIP", so no useful data there.

@cdrini
Copy link
Collaborator

cdrini commented Aug 15, 2019

It exports at least GeoIP; this is used in https://github.com/internetarchive/openlibrary/blob/2b2895fb849aea8344d5aab77e883faae547dc00/openlibrary/core/geo_ip.py .

Note this line:

geoip_db = config.get("geoip_database", '/usr/local/maxmind-geoip/GeoLiteCity.dat')

Every method in this file requires this database. geoip_database does not exist locally; does it exist on prod? Does /usr/local/maxmind-geoip/GeoLiteCity.dat exist locally (no) or on prod? If not, then this file (and likely GeoIP) are unused, and we need to find more dead code by tracing uses of this file.

@tfmorris
Copy link
Contributor

If not, then this file (and likely GeoIP) are unused,

As I mentioned Jan. 4, #1694 (comment) unless this has changed recently, I believe it is used to identify the lending library.

region = geo_ip.get_region(web.ctx.ip)

I don't see any reason to support an obsolete private fork though. We should just switch to the current Maxmind supported bindings.

@cdrini
Copy link
Collaborator

cdrini commented Aug 17, 2019

Can you expand on your previous comment, @tfmorris ? I don't think I know the feature you're referring to. What was it? Why might've it used GeoIP? When was it killed?

@jdlrobson Do you have any context on this? Asking cause I noticed you made this change a while back:
2c9274d#diff-bee60bee0cf02815ad9385b15edc8c97R25

@xayhewalo xayhewalo added Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] Priority: 3 Issues that we can consider at our leisure. [managed] State: Backlogged Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed] labels Nov 20, 2019
@xayhewalo
Copy link
Collaborator

@cclauss did #1693 resolve this. It looks like we're not requiring OL-GeoIP for Python3 versions

@cclauss
Copy link
Collaborator Author

cclauss commented Nov 21, 2019

I am not sure yet if this "solved" the problem or merely "masked" the symptom.

@tfmorris
Copy link
Contributor

@cdrini The addition of /opt/local actually happened in a commit from the main repo to support MacPorts jlopez/maxmind-geoip@2fd74fb

The only OL specific changes are supposedly to allow it to be uploaded to PyPI internetarchive/maxmind-geoip@1e32375, but the official MaxMind package is now available from PyPI, so I think we can just switch.

There are two official MaxMind libraries:

Note that the GeoIP Lite databases that they depend on are no longer freely available without registering for an account, but that's a separate problem.

@hornc
Copy link
Collaborator

hornc commented Feb 1, 2020

closing as we have decided to remove, see #2896

@hornc hornc closed this as completed Feb 1, 2020
@mekarpeles mekarpeles added python Pull requests that update Python code and removed Module: Python labels Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] Priority: 3 Issues that we can consider at our leisure. [managed] python Pull requests that update Python code Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants