IndEcol / pymrio

Multi-Regional Input-Output Analysis in Python.
http://pymrio.readthedocs.io/en/latest/
Other
158 stars 71 forks source link

population.txt file not found #42

Closed ruairidhcumming closed 3 years ago

ruairidhcumming commented 4 years ago

I am trying to follow the Quickstart guide to exploring Exiobase2. when i call pymrio.parse_exiobase2 i get an error which i believe relates to the pymiro package itself missing a file. the path requested is in the pymiro package in my anaconda environment C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pymrio\mrio_models\exio20\./misc/population.txt however the path only exists as far as C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pymrio\mrio_models where the folder contains a pycache folder, the test_miro folder and an init.py file. Is there a different file which needs to be installed manually? I have included the full error trace below.

exio2 = pymrio.parse_exiobase2(path=ExioFile,charact=True, popvector='exio2') Traceback (most recent call last):

File "", line 1, in exio2 = pymrio.parse_exiobase2(path=ExioFile,charact=True, popvector='exio2')

File "C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pymrio\tools\ioparser.py", line 658, in parse_exiobase2 index_col=0, sep='\t').astype(float)

File "C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pandas\io\parsers.py", line 685, in parser_f return _read(filepath_or_buffer, kwds)

File "C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pandas\io\parsers.py", line 457, in _read parser = TextFileReader(fp_or_buf, **kwds)

File "C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pandas\io\parsers.py", line 895, in init self._make_engine(self.engine)

File "C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pandas\io\parsers.py", line 1135, in _make_engine self._engine = CParserWrapper(self.f, **self.options)

File "C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pandas\io\parsers.py", line 1917, in init self._reader = parsers.TextReader(src, **kwds)

File "pandas_libs\parsers.pyx", line 382, in pandas._libs.parsers.TextReader.cinit

File "pandas_libs\parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source

FileNotFoundError: [Errno 2] File b'C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pymrio\mrio_models\exio20\./misc/population.txt' does not exist: b'C:\Users\CummingR\AppData\Local\Continuum\anaconda3\envs\RC37\lib\site-packages\pymrio\mrio_models\exio20\./misc/population.txt'

GeorgeNash commented 4 years ago

I am having the same issue.

pymrio/mrio_models/exio20/./misc/population.txt' does not exist

Any resolution?

GeorgeNash commented 4 years ago

I'm running on mac.

Reproducible as:

import pymrio
exio2 = pymrio.parse_exiobase2(path='exiobase', charact=True, popvector='exio2')

I also get this warning before the error:

WARNING:root:Could not determine system (pxp or ixi) set system parameter manually

I get the same error with the ixi and the pxp dataset

konstantinstadler commented 4 years ago

Hi,

I am currently on paternity leave - so there will be no new versions in the next couple of month. But I will fix that as soon as I am back.

Anyway, looking into the code, there might be a problem with the path joining for the population vector (line 656 in ioparser.py) - perhaps something that is OS specific. I have to check that when I am back (or fill free to send a merge request if you can fix it).

As a workaround: you can also pass a pandas dataframe to the "popvector" argument. So, you could download the population.txt file from

https://github.com/konstantinstadler/pymrio/tree/master/pymrio/mrio_models/exio20/misc

and save it somewhere convenient (/foo/bar/population.txt)

You can then do

import pandas as pd

import pymrio

pop_vec = pd.read_csv("/foo/bar/population.txt", sep="\t", index_col=0).as_type(float)

exio2 = pymrio.parse_exiobase2(path='exiobase', charact=True, popvector=pop_vec)

Might be that the read_csv is somehow different in the new pandas version (check the docs there).

Good luck

Konstantin


From: George Nash notifications@github.com Sent: 24 February 2020 19:23 To: konstantinstadler/pymrio Cc: Subscribed Subject: Re: [konstantinstadler/pymrio] population.txt file not found (#42)

I'm running on mac.

Reproducible as:

import pymrio exio2 = pymrio.parse_exiobase2(path='exiobase', charact=True, popvector='exio2')

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/konstantinstadler/pymrio/issues/42?email_source=notifications&email_token=ABTX7SZP4JG477LC77EU7KDREQGDHA5CNFSM4JLTOSZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMY7SHY#issuecomment-590477599, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABTX7SZYRQW4F62WST77NQ3REQGDHANCNFSM4JLTOSZQ.

GeorgeNash commented 4 years ago

Thanks Konstantin, downloading the population.txt file separately worked.

Enjoy your paternity leave.

konstantinstadler commented 3 years ago

This was solved in commit 6cadc3d (version 0.4.2d) and will be included in the next release