NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Greetings.

I've installed nominatim as per instructions here:

https://nominatim.org/release-docs/latest/appendix/Install-on-Ubuntu-20/

I've got the following files in my directory

:/home/data/1941/nom$ ls -oh
total 1.7T
-rw-r--r-- 1 jp 9.3K Feb  8 13:05 .env
-rw-r--r-- 1 jp 9.2K Feb  7 21:10 env.defaults
-rw-r--r-- 1 jp  13M Nov 11 03:10 gb_postcodes.csv.gz
-rw-r--r-- 1 jp 1.7T Feb  7 22:16 planet-latest.osm
-rw-r--r-- 1 jp 1.9K Feb  8 15:59 setup.log
-rw-r--r-- 1 jp 394K Oct 24 04:20 us_postcodes.csv.gz
drwxr-xr-x 2 jp 4.0K Feb  8 15:59 website
-rw-r--r-- 1 jp 376M Nov 17  2019 wikimedia-importance.sql.gz

I've tried to import the plant file as so:

nominatim import --osm-file planet-latest.osm 2>&1 | tee setup.log

And I've received the following error message:

2023-02-08 17:28:32: Using project directory: /home/data/1941/nom
2023-02-08 17:28:34: Creating database
env.defaults
gb_postcodes.csv.gz
planet-latest.osm
setup.log
us_postcodes.csv.gz
website
wikimedia-importance.sql.gz
worldfile
2023-02-08 17:28:34: Setting up country tables
ERROR:  relation "country_osm_grid" already exists
Traceback (most recent call last):
  File "/usr/local/lib/nominatim/lib-python/nominatim/db/utils.py", line 28, in _pipe_to_proc
    proc.stdin.write(chunk)
BrokenPipeError: [Errno 32] Broken pipe

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

Traceback (most recent call last):
  File "/usr/local/lib/nominatim/lib-python/nominatim/db/utils.py", line 62, in execute_file
    remain = _pipe_to_proc(proc, fdesc)
  File "/usr/local/lib/nominatim/lib-python/nominatim/db/utils.py", line 30, in _pipe_to_proc
    raise UsageError("Failed to execute SQL file.") from exc
nominatim.errors.UsageError: Failed to execute SQL file.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/nominatim", line 14, in <module>
    exit(cli.nominatim(module_dir='/usr/local/lib/nominatim/module',
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 264, in nominatim
    return parser.run(**kwargs)
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 126, in run
    return args.command.run(args)
  File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/setup.py", line 89, in run
    country_info.setup_country_tables(args.config.get_libpq_dsn(),
  File "/usr/local/lib/nominatim/lib-python/nominatim/data/country_info.py", line 118, in setup_country_tables
    db_utils.execute_file(dsn, sql_dir / 'country_osm_grid.sql.gz')
  File "/usr/local/lib/nominatim/lib-python/nominatim/db/utils.py", line 70, in execute_file
    proc.stdin.close()
BrokenPipeError: [Errno 32] Broken pipe

asked 08 Feb '23, 23:35

james000222's gravatar image

james000222
11223
accept rate: 0%

edited 09 Feb '23, 08:39

scai's gravatar image

scai ♦
33.3k21309459

how long did your build take and what specs for your server ?

(05 Apr '23, 03:16) TrackTrace

Thank you for your reply!

I've tried that already - but tried again to be consistent. Just to be sure I've done this correctly:

$: sudo su - postgres

postgres@_:~$ psql

postgres=# dropdb nominatim

postgres=# \q

postgres@_:~$ exit

$: nominatim import --osm-file planet-latest.osm 2>&1 | tee setup.log

(error message directly as before with this as the prime cause): ERROR: relation "country_osm_grid" already exists

I'm fairly experience with linux, but afraid I'm very new to working with databases in general, and never with postgresql. Thank you for your assistance!

This is on an HPC platform with several nodes, and this does add a layer of complexity.

J

permanent link

answered 09 Feb '23, 21:29

james000222's gravatar image

james000222
11223
accept rate: 0%

edited 09 Feb '23, 21:33

I THINK I GOT IT WORKING!

First I logged in as nominatim, then, I had to do this:

nominatim=# DROP SCHEMA public CASCADE; NOTICE: drop cascades to 5 other objects DETAIL: drop cascades to extension hstore drop cascades to extension postgis drop cascades to extension postgis_raster drop cascades to table country_osm_grid drop cascades to table country_name DROP SCHEMA nominatim=# CREATE SCHEMA public; CREATE SCHEMA nominatim=# \dt Did not find any relations.

Then I ran the command: nominatim import --osm-file planet-latest.osm 2>&1 | tee setup.log

And it's working! Or at least no errror messages. I understand this may take days to unpack and import, correct?

(09 Feb '23, 22:11) james000222

I probably screwed things up, LOL.

No doubt I'll be back here, begging for help again!

Thanks for the tip though - it led me to the DROP command and that did it.

(09 Feb '23, 22:51) james000222

Can you try deleting the database before the import? dropdb nominatim (psql -l can show the list of database names).

permanent link

answered 09 Feb '23, 13:05

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×689

question asked: 08 Feb '23, 23:35

question was seen: 869 times

last updated: 05 Apr '23, 07:54

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum