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

Import Error: cannot import name 'GenericStorage' #74

Open
s77411 opened this issue Jun 24, 2021 · 6 comments
Open

Import Error: cannot import name 'GenericStorage' #74

s77411 opened this issue Jun 24, 2021 · 6 comments

Comments

@s77411
Copy link

s77411 commented Jun 24, 2021

Tried to use one of the both plotting example. Installed Oemof Version is 0.3.2 and oemof visio version is 0.0.1 on a windwos 10 computer. When executing both examples (oemof-examples/oemof_examples/oemof.solph/v0.3.x/plotting_examples/) storage_investment_plot.py and variable_chp_plot.py the error code: Import Error: cannot import name 'GenericStorage' gets returned. Fixed the bug by adding in the ...\oemof_visio\energy_system_graph.py in line 28 .components.
Old:
from oemof.solph import GenericStorage
New (Fixed):
from oemof.solph.components import GenericStorage

@sharief091
Copy link

I tried the same for the plots and got the same error.
but as you mentioned: Fixed the bug by adding in the ...\oemof_visio\energy_system_graph.py in line 28 .components.
The lib is still old and not fixed.
Could you help me out, please

@s77411
Copy link
Author

s77411 commented Nov 9, 2021

Hey,
you just have to add in the code ...\oemof_visio\energy_system_graph.py in line 28: from oemof.solph import GenericStorage
to: from oemof.solph.components import GenericStorage and then it should work.

@sharief091
Copy link

Hi,
I have tried but I could not able to edit site-packages.
is there a way to add in the code ?

@s77411
Copy link
Author

s77411 commented Nov 9, 2021

I did it in the anaconda environment and looked for the right path to edit the energy_system_graph.py and had no issues there. How are you using oemof? I don´t know if there is also a possibility to implement it in your code.

@sharief091
Copy link

I am using winpython environment. i have imported oemof_visio from github and am unable to do any changes.
i think, it has to be edited in github. which i pulled a request.

try:
from oemof.solph import GenericStorage
except ModuleNotFoundError:
GenericStorage = None

@p-snft
Copy link
Member

p-snft commented Nov 10, 2021

I guess, that's a problem with different versions of solph:

  • from oemof.solph import GenericStorage works in solph v0.4 but not in v0.3 and (upcoming) v0.5
  • from oemof.solph.components import GenericStorage works in all of these versions.

Thanks for oemof/oemof-visio#8: As visio does not require a specific version, it should work with all of them.

PS: Is there a reason to use oemof v0.3 instead of oemof.solph v0.4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants