oemof/oemof-tabular

Program does not import 'Edge' form oemof.tabular.facades

Closed this issue · 4 comments

OHO53 commented

When I try to run Maruf's energy system model (version 'base-NDE-SDE.py) based on oemof.tabular the import of oemof.tabular.facades stops when the program tries to import 'Edge' from oemof.network. Looks like there is some problem in oemof.network???

This is the code of the program (base-NDE-SDE.py), where the import gets stuck:

#Base Scenario Source Code

Package Import

import os
import pandas as pd
import oemof.tabular.facades as fc

This is the output concerning the error message (cannot import name 'Edge'):

(test-project) olavhohmeyer@Olavs-MacBookPro-15-Zoll-16014 scenarios % python3 base-NDE-SDE.py
Traceback (most recent call last):
File "base-NDE-SDE.py", line 6, in
import oemof.tabular.facades as fc
File "/Users/olavhohmeyer/energy_models/oemof_tabular/test_tabular/test-project/lib/python3.6/site-packages/oemof/tabular/facades.py", line 23, in
from oemof.energy_system import EnergySystem
File "/Users/olavhohmeyer/energy_models/oemof_tabular/test_tabular/test-project/lib/python3.6/site-packages/oemof/energy_system.py", line 20, in
from oemof.groupings import DEFAULT as BY_UID, Grouping, Nodes
File "/Users/olavhohmeyer/energy_models/oemof_tabular/test_tabular/test-project/lib/python3.6/site-packages/oemof/groupings.py", line 16, in
from oemof.network import Edge
ImportError: cannot import name 'Edge'
(test-project) olavhohmeyer@Olavs-MacBookPro-15-Zoll-16014 scenarios %

How do I get around this problem?

Olav

jnnr commented

Hi Olav, can you provide the version of oemof, oemof.solph, oemof.network and oemof.tabular in your environment?

I suspect that you are using an old version of oemof. oemof has turned into a meta-package a while ago. Before, oemof had the function that now oemof.solph has. A week ago, oemof 1.0 was released to avoid confusion.

OHO53 commented

Hi jnnr, thank you for the fast response. Actually, it seems to be an internal compatibility problem inside the oemof world. A similar error occurs with totally different setups (see below).

The configuration I worked with in the instance of the problem discussed above is the following:

MacBook Pro (Mid 2015)
2.8 GHz Quad-Core Intel Core i7
macOS Monterey, version 12.4

Python 3.6.15

oemof-0.3.2
oemof.solp-0.4.3
oemof.tabular-0.0.2
oemof.network-0.4.0
oemof.tools-0.4.1

This is producing the above documented error, when oemof.tabular is using oemof.tabular.facades to import 'Edge' from 'oemof.network' (line 24 in oemof.tabular.facades)

Tried a totally different configuration today, which lead to a very similar problem.

The second configuration was:

MacBook Pro M1 Max (End 2021)
Apple M1 Max
macOS Ventura, version 13.0

Python 3.9.15

oemof-1.0
oemof.solp-0.4.4
oemof.tabular-0.0.2
oemof.network-0.4.0
oemof.tools-0.4.2

In the same program written by Maruf (base_NDE-SDSE.py) a similar error occurs on the same line importing oemof.tabular.facades.

'import oemof.tabular.facades'
in line 23 oemof.tabular.facades tries to import 'oemof.energy_system' from 'EnergySystem'

this leads to the error:
ModuleNotFoundError: No module named 'oemof.energy_systems'

In the case of today's configuration oemof.tabular.facades does not even import 'oemof.energy_system' from 'EnergySystem', a step, which the older configuration still achieved. Unfortunately, just to fall into the next trap, while trying to import 'Node' from oemof.network in the next line of oemof.tabular.facades.

I would greatly appreciate help on this issue, as it keeps me from starting to use oemof.tabular.

Best regards

Olav

p.s.: For some reason 'tox' is not working.
Error: tox config file (..)not found.

jnnr commented

Hi Olav, the first configuration is what I expected: It includes both the old oemof 0.3.2 and the new oemof.solph 0.4.4, which are conflicting.

The second configuration looks better, but you have a very old oemof.tabular 0.0.2. Very soon, we will have a release 0.0.3 which will be installable via pypi. But before that, you will have to install oemof.tabular from your local repo. I.e. you have to clone oemof.tabular locally and then install it in your environment via pip install -e <path-to-repo>.

We are aware of the tox problem #45. Thanks for reporting!

OHO53 commented

Hi jnnr,
thank you for your advise. It actually worked with the repository for the branch for oemof.tabular 0.0.3 After installing that clone locally oemof.tabular installed and all imports could be made into Maruf's program.

Thank you for the great help.

Olav