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

Installation fails #1

Open
ThGaskin opened this issue Nov 8, 2023 · 0 comments
Open

Installation fails #1

ThGaskin opened this issue Nov 8, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ThGaskin
Copy link

ThGaskin commented Nov 8, 2023

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 ThGaskin added the bug Something isn't working label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant