solar-power-mapping-data icon indicating copy to clipboard operation
solar-power-mapping-data copied to clipboard

Installation fails

Open ThGaskin opened this issue 2 years ago • 0 comments

Problems with installation

I encountered several issues when installing:

  1. When running make in data/raw I get the following error:
Traceback (most recent call last):
  File "/Users/thomasgaskin/solar-power-mapping-data/data/raw/compile_osm_solar.py", line 471, in <module>
    parser.parse(infp)
  File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "/private/tmp/pythonA3.11-20231002-5215-1appux8/Python-3.11.6/Modules/pyexpat.c", line 470, in EndElement
  File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/xml/sax/expatreader.py", line 336, in end_element
    self._cont_handler.endElement(name)
  File "/Users/thomasgaskin/solar-power-mapping-data/data/raw/compile_osm_solar.py", line 256, in endElement
    v = str(reduce(lambda a, b: a+b, map(int, v.split(';')))) # entries could be e.g. "7;5;2" and here we reduce them to a single integer sum
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
make: *** [osm.csv] Error 1

The line responsible is l. 256,

v = str(reduce(lambda a, b: a+b, map(int, v.split(';')))) # entries could be e.g. "7;5;2" and here we reduce them to a single integer sum

which fails for strings of the kind '52;'.

A simple fix would be to add something like

v = v[:-1] if v[-1] == ';' else v

above that line.

This is using all the most recent data given by the links in the README.

  1. data/processed/pre-process-repd throws a ModuleNotFound error:
    ModuleNotFoundError: No module named 'bng_to_latlon'
    
    The correct import statement should be import bng_latlon

ThGaskin avatar Nov 08 '23 21:11 ThGaskin