FZJ-IEK3-VSA / FINE

The FINE python package provides a framework for modeling, optimizing and assessing energy systems
https://vsa-fine.readthedocs.io
Other
68 stars 39 forks source link

Import of FINE fails after pip install #40

Closed V3lop5 closed 2 years ago

V3lop5 commented 2 years ago

Hi there,

I created a new python project in PyCharm with Virtualenv + Python 3.7 and installed FINE with pip install fine. That ran successfully:

...\pythonTestProject> pip install fine
[...]
Installing collected packages: numpy, urllib3, threadpoolctl, six, scipy, pytz, pyparsing, MarkupSafe, joblib, idna, decorator, charset-normalizer, certifi, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, snowball
stemmer, scikit-learn, requests, python-dateutil, Pygments, ply, paramz, packaging, Jinja2, imagesize, docutils, cython, colorama, babel, alabaster, sphinx, sklearn, pyomo, pyDOE, pillow, pandas, networkx, kiwisolver, GPy, et-xmlfile, cycler, xlrd, tsam, sphinx-rtd-theme, shapely, pwlf, openpyxl, matplotlib, GP
yOpt, fine
Successfully installed GPy-1.10.0 GPyOpt-1.2.6 Jinja2-3.0.2 MarkupSafe-2.0.1 Pygments-2.10.0 alabaster-0.7.12 babel-2.9.1 certifi-2021.10.8 charset-normalizer-2.0.7 colorama-0.4.4 cycler-0.10.0 cython-0.29.24 decorator-5.1.0 docutils-0.17.1 et-xmlfile-1.1.0 fine-2.2.1 idna-3.3 imagesize-1.2.0 joblib-1.1.0 kiwis
olver-1.3.2 matplotlib-3.4.3 networkx-2.6.3 numpy-1.21.3 openpyxl-3.0.9 packaging-21.0 pandas-1.3.4 paramz-0.9.5 pillow-8.4.0 ply-3.11 pwlf-2.0.4 pyDOE-0.3.8 pyomo-6.1.2 pyparsing-3.0.1 python-dateutil-2.8.2 pytz-2021.3 requests-2.26.0 scikit-learn-1.0 scipy-1.7.1 shapely-1.7.1 six-1.16.0 sklearn-0.0 snowballst
emmer-2.1.0 sphinx-4.2.0 sphinx-rtd-theme-1.0.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-2.0.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.5 threadpoolctl-3.0.0 tsam-1.1.2 urllib3-1.26.7 xlrd-2.0.1

I created a simple main.py script:

import FINE

if __name__ == '__main__':
    print("Hello World!")

Outputs:

...\pythonTestProject\venv\Scripts\python.exe .../pythonTestProject/main.py
Traceback (most recent call last):
  File "C:/Users/Paul/Git/EWI/pythonTestProject/main.py", line 3, in <module>
    import FINE
  File "...\pythonTestProject\venv\lib\site-packages\FINE\__init__.py", line 6, in <module>
    from .energySystemModel import EnergySystemModel
  File "...\pythonTestProject\venv\lib\site-packages\FINE\energySystemModel.py", line 6, in <module>
    from FINE.component import Component, ComponentModel
  File "...\pythonTestProject\venv\lib\site-packages\FINE\component.py", line 2, in <module>
    from FINE import utils
  File "...\pythonTestProject\venv\lib\site-packages\FINE\utils.py", line 9, in <module>
    import pwlf
  File "...\pythonTestProject\venv\lib\site-packages\pwlf\__init__.py", line 1, in <module>
    from .pwlf import PiecewiseLinFit  # noqa F401
  File "...\pythonTestProject\venv\lib\site-packages\pwlf\pwlf.py", line 27, in <module>
    from scipy.optimize import differential_evolution
  File "...\pythonTestProject\venv\lib\site-packages\scipy\__init__.py", line 136, in <module>
    from . import _distributor_init
  File "...\pythonTestProject\venv\lib\site-packages\scipy\_distributor_init.py", line 61, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Das angegebene Modul wurde nicht gefunden

Process finished with exit code 1

I tried multiple combinations of different versions of scipy and pwlf. Also including the minimum of scipy==1.4.1 and pwlf==1.1.5 mentioned in requirements.txt. But this still raises an error.

t-gross commented 2 years ago

With the coming update, the installation guide will be adapted s.t. the installation throws hopefully less errors.