Error when importing examples datapackages
Closed this issue · 2 comments
Hi everybody,
this ist the first time I take a look at oemof.tabular. Thanks for everything, such a great project!
I tried to follow the steps in the tutorial part of the documentation on how to use the datapackage reader (https://oemof-tabular.readthedocs.io/en/latest/tutorials/datapackage-reader.html).
Doing so produces the following error:
Traceback (most recent call last):
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\oemof\tabular\datapackage\reading.py", line 294, in deserialize_energy_system
facade_data = r.read(keyed=True, relations=True)
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\datapackage\resource.py", line 377, in read
foreign_keys_values=foreign_keys_values, **options)
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\tableschema\table.py", line 364, in read
for count, row in enumerate(rows, start=1):
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\tableschema\table.py", line 290, in iter
error_data=local_keyed_values)
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\tableschema\table.py", line 202, in exc_handler
raise exc
tableschema.exceptions.UnresolvedFKError: Foreign key "['profile']" violation in row "5": ('wind-profile',) not found in source_profile
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\IPython\core\interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-b2a34a931d93>", line 1, in <module>
runfile('C:/Users/m.haller/Documents/11 Eigene Projekte/OpenSourceModeling/OpenSourceModeling/oemof/oemof_tabular_test.py', wdir='C:/Users/m.haller/Documents/11 Eigene Projekte/OpenSourceModeling/OpenSourceModeling/oemof')
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.2\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/m.haller/Documents/11 Eigene Projekte/OpenSourceModeling/OpenSourceModeling/oemof/oemof_tabular_test.py", line 43, in <module>
typemap=typemap,
File "C:\Users\m.haller\AppData\Local\Continuum\miniconda3\envs\env_oemof_tabular\lib\site-packages\oemof\tabular\datapackage\reading.py", line 301, in deserialize_energy_system
"Exception was: {}").format(r.name, e))
datapackage.exceptions.LoadError: Could not read data for resource with name `source`. Maybe wrong foreign keys?
Exception was: Foreign key "['profile']" violation in row "5": ('wind-profile',) not found in source_profile
I am using miniconda and Python 3.7.5 on Windows 10. But the same error message also appears on https://oemof-tabular.readthedocs.io/en/latest/tutorials/datapackage-reader.html, so I think it is independent of the environment I am using. Similar errors occur with the other two example packages provided (dispatch
and foreignkeys
).
This might be due to new datapackage / tableschema version.
Can you try to install
"datapackage==1.5.1"
"tableschema==1.3.0"
Or you download and install dev from source, however, examples may not be updated to new code. Therefore, I recommend the trying the other option first.
If this does not help, we have to look deeper..
That worked, great!
pip install oemof.tabular datapackage==1.5.1 tableschema==1.3.0
Thanks for your help - and a happy new year as well.