[no bug] Pacman-mirrors throws Python error when using --geoip or --continent

On an Intel 1135G7 HP laptop, Manjaro Gnome:

sudo pacman-mirrors -g --continent                                                                                                                       ✔  1m 25s  
::INFO Downloading mirrors from Manjaro
::INFO => Mirror pool: https://repo.manjaro.org/mirrors.json
::INFO => Mirror status: http://repo.manjaro.org/status.json
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fc8c0a220d0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='get.geojs.io', port=443): Max retries exceeded with url: /v1/ip/country/full (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc8c0a220d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pacman-mirrors", line 28, in <module>
    pm.run()
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/pacman_mirrors.py", line 112, in run
    defaultFn.load_config_mirror_pool(self)
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/defaultFn.py", line 44, in load_config_mirror_pool
    self.selected_countries = pools.build_country_list(self)
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 78, in build_country_list
    continent_mirror_countries = get_continent_countries(get_geo_continent(), self.mirrors.mirror_pool)
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 119, in get_geo_continent
    return _get_ip_continent().replace(" ", "_")
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 148, in _get_ip_continent
    country = _get_ip_country()
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 140, in _get_ip_country
    return get_ip_country().strip()
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/httpFn.py", line 125, in get_ip_country
    resp = requests.get("https://get.geojs.io/v1/ip/country/full",
  File "/usr/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='get.geojs.io', port=443): Max retries exceeded with url: /v1/ip/country/full (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc8c0a220d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

I use this for now sudo pacman-mirrors -g -P https --api but I would like to limit the testing to my continent. FYI I am based in NL. Location Services is enabled in Settings (Weather via clock in notification bar works for example).

Did you sudo python ... or sudo pip ... ?

I just installed Manjaro Gnome on this laptop earlier this week, updated it afterwards and today ran this command. I did not install/customise anything yet.

Am I suppose to do something with Python before I can use pacman-mirrors?

No, just python error messages are usually related to wrongly using pip that way.

Some options are mutual exclusive and will throw an arguments error:

--geoip, --continent

Reference:

man pacman-mirrors

Could be temporary connection error.

What exactly is a “pything error”? Please edit your topic title to be more descriptive. Please see How to Post.

EDIT: I figured you mean Python. Thanks for editing it. :+1:

1 Like

Still, --continent without -g does give me the same error:

sudo pacman-mirrors --continent -P https --api                                                                                                                      ✔ 
[sudo] password for asterix: 
::INFO Protocols in config is changed
::INFO Downloading mirrors from Manjaro
::INFO => Mirror pool: https://repo.manjaro.org/mirrors.json
::INFO => Mirror status: http://repo.manjaro.org/status.json
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f75a9c6e1c0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='get.geojs.io', port=443): Max retries exceeded with url: /v1/ip/country/full (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f75a9c6e1c0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pacman-mirrors", line 28, in <module>
    pm.run()
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/pacman_mirrors.py", line 112, in run
    defaultFn.load_config_mirror_pool(self)
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/defaultFn.py", line 44, in load_config_mirror_pool
    self.selected_countries = pools.build_country_list(self)
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 78, in build_country_list
    continent_mirror_countries = get_continent_countries(get_geo_continent(), self.mirrors.mirror_pool)
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 119, in get_geo_continent
    return _get_ip_continent().replace(" ", "_")
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 148, in _get_ip_continent
    country = _get_ip_country()
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/pools.py", line 140, in _get_ip_country
    return get_ip_country().strip()
  File "/usr/lib/python3.9/site-packages/pacman_mirrors/functions/httpFn.py", line 125, in get_ip_country
    resp = requests.get("https://get.geojs.io/v1/ip/country/full",
  File "/usr/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='get.geojs.io', port=443): Max retries exceeded with url: /v1/ip/country/full (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f75a9c6e1c0>: Failed to establish a new connection: [Errno 111] Connection refused'))

The issue seems to be limited to options that you want to use to not test all mirrors but only of a specific region, by using the continent or geoip options.

@Yochanan my apologies, that was a nasty typo.

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘get.geojs.io’, port=443): Max retries exceeded with url: /v1/ip/country/full (Caused by NewConnectionError(’<urllib3.connection.HTTPSConnection object at 0x7f75a9c6e1c0>: Failed to establish a new connection: [Errno 111] Connection refused’))

–continent as --goip get your country, you have an error for this test and geojs.io no want your connexion (too much connexion?)…
Manual test:

curl https://get.geojs.io/v1/ip/country/full

You use a proxy for to have an error ???
if we use a proxy, result is not always good :wink:

I don’t use a proxy. But I do have AdGuard Home + Unbound running on my server, filtering out ads etc. Apparently, the most recommended filter list (https://abp.oisd.nl/) has ||geojs.io^ listed. That caused the issue.
By whitelisting that domain, it now works. No bug.

By whom? Just use AdGuard’s default filters.

On both PiHole and Adguard fora. The default list is nice but I still see ads on the sites I visit most often, unfortunately.

Well, if you want to use that list, submit an issue upstream to make the list maintainer aware of the issue.

Let get a more graceful exit on that one …

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.