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

urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>88, in get_urlse_dateionon #501

Open
myrainbowandsky opened this issue Nov 13, 2023 · 9 comments
Labels

Comments

@myrainbowandsky
Copy link

Ubuntu 22.04

Is the port occupied? Is it possible to continue to run instead of restarting.

2023-11-12 21:09:41: Starting rank 30 (using batch size 20)
2023-11-12 21:09:41: Done 0/0 in 0 @ 0.000 per second - FINISHED rank 30

2023-11-12 21:09:41: Starting rank 0 (using batch size 1)
2023-11-12 21:09:41: Done 0/0 in 0 @ 0.000 per second - FINISHED rank 0

2023-11-12 21:09:41: Starting interpolation lines (location_property_osmline) (using batch size 20)
2023-11-12 21:09:41: Done 0/0 in 0 @ 0.000 per second - FINISHED interpolation lines (location_property_osmline)

+ sudo -E -u nominatim nominatim admin --check-database
2023-11-12 21:09:42: Using project directory: /nominatim
2023-11-12 21:09:42: Checking database
Checking database connection ... OK
Checking for placex table ... OK
Checking for placex content ... OK
Checking that tokenizer works ... OK
Checking for wikipedia/wikidata data ... WARNING

Wikipedia/Wikidata importance tables missing.
Quality of search results may be degraded. Reverse geocoding is unaffected.
See https://nominatim.org/release-docs/latest/admin/Import/#wikipediawikidata-rankings

Checking indexing status ... OK
Checking that database indexes are complete ... OK
Checking that all database indexes are valid ... OK
Checking TIGER external data table. ... not applicable
+ '[' https://download.geofabrik.de/north-america/us-updates/ '!=' '' ']'
+ sudo -E -u nominatim nominatim replication --init
2023-11-12 21:09:45: Using project directory: /nominatim
2023-11-12 21:09:46: Initialising replication updates
2023-11-12 21:10:47: Failed to load URL: https://www.openstreetmap.org/api/0.6/node/11339517769/1
Traceback (most recent call last):
  File "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.10/http/client.py", line 1283, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 976, in send
    self.connect()
  File "/usr/lib/python3.10/http/client.py", line 1448, in connect
    super().connect()
  File "/usr/lib/python3.10/http/client.py", line 942, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.10/socket.py", line 845, in create_connection
    raise err
  File "/usr/lib/python3.10/socket.py", line 833, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/nominatim", line 12, in <module>
    exit(cli.nominatim(module_dir='/usr/local/lib/nominatim/module',
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 225, in nominatim
    return get_set_parser().run(**kwargs)
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 121, in run
    return args.command.run(args)
  File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/replication.py", line 194, in run
    return self._init_replication(args)
  File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/replication.py", line 79, in _init_replication
    replication.init_replication(conn, base_url=args.config.REPLICATION_URL,
  File "/usr/local/lib/nominatim/lib-python/nominatim/tools/replication.py", line 41, in init_replication
    date = status.compute_database_date(conn)
  File "/usr/local/lib/nominatim/lib-python/nominatim/db/status.py", line 50, in compute_database_date
    data = get_url(node_url)
  File "/usr/local/lib/nominatim/lib-python/nominatim/tools/exec_utils.py", line 88, in get_url
    with urlrequest.urlopen(request) as response: # type: IO[bytes]
  File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/usr/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.10/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>
(Nominatim) lawrencexu@PowerStation:/mnt/data/Nominatim/project_wenlu$ Wikipedia/Wikidata importance tables missing.
Quality of search results may be degraded. Reverse geocoding is unaffected.
See https://nominatim.org/release-docs/latest/admin/Import/#wikipediawikidata-rankings

Checking indexing status ... OK
Checking that database indexes are complete ... OK
Checking that all database indexes are valid ... OK
Checking TIGER external data table. ... not applicable
+ '[' https://download.geofabrik.de/north-america/us-updates/ '!=' '' ']'
+ sudo -E -u nominatim nominatim replication --init
2023-11-12 21:09:45: Using project directory: /nominatim
2023-11-12 21:09:46: Initialising replication updates
2023-11-12 21:10:47: Failed to load URL: https://www.openstreetmap.org/api/0.6/node/11339517769/1
Traceback (most recent call last):
  File "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.10/http/client.py", line 1283, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 976, in send
    self.connect()
  File "/usr/lib/python3.10/http/client.py", line 1448, in connect
    super().connect()
  File "/usr/lib/python3.10/http/client.py", line 942, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.10/socket.py", line 845, in create_connection
    raise err
  File "/usr/lib/python3.10/socket.py", line 833, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/nominatim", line 12, in <module>
    exit(cli.nominatim(module_dir='/usr/local/lib/nominatim/module',
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 225, in nominatim
    return get_set_parser().run(**kwargs)
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 121, in run
    return args.command.run(args)
urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>88, in get_urlse_dateionon
@mtmail
Copy link
Contributor

mtmail commented Nov 13, 2023

+ sudo -E -u nominatim nominatim admin --check-database

This is one of the very last commands in the setup. The database is filled and ready to use.

+ sudo -E -u nominatim nominatim replication --init

You chose to setup (daily) data updates, that initialization failed. You can retry running the command. Maks ure you're in the project directory (/nominatim inside the docker container).

Checking TIGER external data table. ... not applicable

TIGER data is from the US census and relevant for US addresses. It's not part of OpenStreetMap but since you're importing North America region it might be useful for you. It's possible to install the TIGER data later (https://nominatim.org/release-docs/latest/customize/Tiger/)

@myrainbowandsky
Copy link
Author

Thx @mtmail . I did

docker container run -it --name b981927970a0 mediagis/nominatim:4.3
+ tailpid=0
+ replicationpid=0
+ trap stopServices SIGTERM TERM INT
+ /app/config.sh
You need to specify either the PBF_URL or PBF_PATH environment variable
docker run -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf ...
docker run -e PBF_PATH=/nominatim/data/monaco-latest.osm.pbf ...

How to go inside the docker again?

@mtmail
Copy link
Contributor

mtmail commented Nov 14, 2023

The command is usually docker container exec -it name-of-container command

You can find the name of your container with docker ps but I see you already found it.

As command try /bin/bash, the standard shell program on Ubuntu Linux. If not available try /bin/sh.

@myrainbowandsky
Copy link
Author

myrainbowandsky commented Nov 14, 2023

Thx @mtmail.
I tried:

docker container exec -it nominatim /bin/bash
Error response from daemon: Container b981927970a0b63a93afb1c953f27e3585a1ea8141d7831b0b053fe3758f6309 is not running

Then I tried :

docker run -it mediagis/nominatim:4.3
+ tailpid=0
+ replicationpid=0
+ trap stopServices SIGTERM TERM INT
+ /app/config.sh
You need to specify either the PBF_URL or PBF_PATH environment variable
docker run -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf ...
docker run -e PBF_PATH=/nominatim/data/monaco-latest.osm.pbf ...

I then tried docker run -it mediagis/nominatim:4.3 sh


# sudo -E -u nominatim nominatim admin --check-database

sudo: unknown user nominatim
sudo: error initializing audit plugin sudoers_audit
# #
# sudo -E -u nominatim nominatim admin --check-database

sudo: unknown user nominatim
sudo: error initializing audit plugin sudoers_audit`

kinda of dead cycle.

@mtmail
Copy link
Contributor

mtmail commented Nov 14, 2023

Does docker ps show the container running in its list?

docker run -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf ...

What happens after you run this command? Are there error messages? Are you stopping the container?

@myrainbowandsky
Copy link
Author

myrainbowandsky commented Nov 15, 2023

docker ps does not show the the nomitatim container, but docker ps -a shows that.

I tried:
docker run -it -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf -e REPLICATION_URL=https://download.geofabrik.de/europe/monaco-updates/ -p 8080:8080 --name nominatim_test mediagis/nominatim:4.3

I got:

docker: Error response from daemon: driver failed programming external connectivity on endpoint nominatim_test (c8fb06dbb6fa6be28b687f412144e4bdf99dc5a3f6c663c75b2bedf7f9ee1586): Error starting userland proxy: listen tcp4 0.0.0.0:8080: bind: address already in use.
ERRO[0000] error waiting for container:

I changed 8080 to 8081:

docker run -it -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf -e REPLICATION_URL=https://download.geofabrik.de/europe/monaco-updates/ -p 8081:8081 --name nominatim mediagis/nominatim:4.3

I got:

docker: Error response from daemon: Conflict. The container name "/nominatim" is already in use by container "b981927970a0b63a93afb1c953f27e3585a1ea8141d7831b0b053fe3758f6309". You have to remove (or rename) that container to be able to reuse that name.

I tried:
docker run -it -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf -e REPLICATION_URL=https://download.geofabrik.de/europe/monaco-updates/ -p 8081:8081 --name monacotest mediagis/nominatim:4.3

I got:

+ tailpid=0
+ replicationpid=0
+ trap stopServices SIGTERM TERM INT
+ /app/config.sh
+ id nominatim
+ useradd -m -p qaIACxO6wMR3 nominatim
+ IMPORT_FINISHED=/var/lib/postgresql/14/main/import-finished
+ '[' '!' -f /var/lib/postgresql/14/main/import-finished ']'
+ /app/init.sh
+ OSMFILE=/nominatim/data.osm.pbf
+ CURL=("curl" "-L" "-A" "${USER_AGENT}" "--fail-with-body")
+ SCP='sshpass -p DMg5bmLPY7npHL2Q scp -o StrictHostKeyChecking=no [email protected]'
+ '[' -z '' ']'
++ nproc
+ THREADS=56
+ '[' '' = true ']'
+ '[' -f '' ']'
+ echo 'Skipping optional Wikipedia importance import'
Skipping optional Wikipedia importance import
+ '[' '' = true ']'
+ '[' -f '' ']'
+ echo 'Skipping optional GB postcode import'
Skipping optional GB postcode import
+ '[' '' = true ']'
+ '[' -f '' ']'
+ echo 'Skipping optional US postcode import'
Skipping optional US postcode import
+ '[' '' = true ']'
+ '[' -f '' ']'
+ echo 'Skipping optional Tiger addresses import'
Skipping optional Tiger addresses import
+ '[' https://download.geofabrik.de/europe/monaco-latest.osm.pbf '!=' '' ']'
+ echo Downloading OSM extract from https://download.geofabrik.de/europe/monaco-latest.osm.pbf
Downloading OSM extract from https://download.geofabrik.de/europe/monaco-latest.osm.pbf
+ curl -L -A mediagis/nominatim-docker:4.3.1 --fail-with-body https://download.geofabrik.de/europe/monaco-latest.osm.pbf -C - --create-dirs -o /nominatim/data.osm.pbf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 27  521k   27  143k    0     0  24996      0  0:00:21  0:00:05  0:00:16 28261

@mtmail
Copy link
Contributor

mtmail commented Nov 15, 2023

-p 8081:8081 will map the port 8081 inside the docker container to 8081 on the host machine. But Nominatim inside the docker container doesn't run on port 8081. Consult the Docker documentation how the parameter works.

tcp4 0.0.0.0:8080: bind: address already in use

Find out what program uses the port. Maybe it's an existing Docker container. Or another webserver you ran for testing. Then you can stop that program. (Rebooting your computer also works but might be too drastic).

You have to remove (or rename) that container to be able to reuse that name..

Consult the Docker documentation how to remove or rename a container

@myrainbowandsky
Copy link
Author

Now I am doing:

docker run -it -e PBF_URL=192.168.50.183/us-latest.osm.pbf    -p 8081:8081   --name nominatim  -e IMPORT_US_POSTCODES=false -e IMPORT_GB_POSTCODES=false mediagis/nominatim:4.3

waiting for installation...

@mtmail
Copy link
Contributor

mtmail commented Nov 15, 2023

Good luck. Like I wrote Nominatim inside the container listens on port 8080, not 8081 (near the end of https://github.com/mediagis/nominatim-docker/blob/master/4.3/Dockerfile). You won't be able to access results from your host computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants