DHNx icon indicating copy to clipboard operation
DHNx copied to clipboard

First feedback: Installation problems

Open jnnr opened this issue 5 years ago • 19 comments

In this issue on oemof/organisation and on the last dev meeting in Berlin we discussed and decided that we want to start developing a repo for district heating models as a joint effort within the oemof-community.

This repo should therefore move to oemof to provide a structure to start with. It provides a central class ThermalNetwork that allows to import data in a defined format. Available components and their required and default attributes are defined (in components.csv and component_attrs). The network data is stored as pandas DataFrames. The ThermalNetwork allows to do a self-consistency check. The whole setup draws some ideas from pypsa.

To get you onboard, have a look at the repo (and open issues if you find things that are worth discussing). To get started, do the following:

  • clone the repo to your computer
  • install dhnx with pip install -e .
  • run the tests
  • run the examples
    • importing, exporting, plotting
    • importing network data from osm
    • optimize a network (not implemented yet)
    • simulate a network (there is a branch for that 'features/tespy-simulation', and a draft PR #20)
  • have a look at the docs (build them with sphinx-build docs
  • have a look at the module and class structure. The modules optimization.py and simulation.py will hold the implementation of the different models.

@jakob-wo @joroeder @MaGering

jnnr avatar Feb 19 '20 13:02 jnnr

Hi,

This looks pretty impressiv already!

I looked into it and this is my feedback so far:

  1. The installation takes some time (and patience) with all the required packages.
  2. Tests and examples are working.
  3. I did not manage to install package Cartopy therefore the plots are missing the background maps:

ERROR: Could not build wheels for cartopy which use PEP 517 and cannot be installed directly

  1. Docu could be build with sphinx but still needs some content ;) I think it would be great to have "get started"-tutorial to demonstrate a typical workflow.

@jnnr is there some specific aspect we should have a look at or test?

jakob-wo avatar Mar 02 '20 16:03 jakob-wo

Thanks for the feedback!

Until now, the functionality is centered around reading data in the specified format, checking for required parameters, setting default parameters and finally getting a consistent ThermalNetwork object with components, component_attrs and sequences. There are some tests, but I am sure there are cases that are not tested yet. You could play around a bit yourself and try to break something? :) Issues and failing tests are welcome.

Also, you can have a look at the data format and the specifications of the components, which are contained in the dhnx/components.csv and dhnx/component_attrs (they are also shown in the docs). Maybe you find some attributes that are missing?

Beyond that, there will be actual models coming soon, and examples (optimization and simulation).

jnnr avatar Mar 02 '20 17:03 jnnr

1. The installation takes some time (and patience) with all the required packages.

How long does it take? More than a minute? Is that because of cartopy?

jnnr avatar Mar 02 '20 17:03 jnnr

How long does it take? More than a minute? Is that because of cartopy?

yes, I would say more than a minute. On one hand I spend some time on installing each required package one by one (using pip install). I was running the examples, waited for the "missing module message", and installed the correspoding package. A requiremnt.txt file will make this more convenient I guess. On the other hand I could not install geopanda via pip but got error massages. So I looked up alternatives on the geopandas docu page and found a way that worked for me*. And then cartopy that does not seem to be crucial but eats a lot of time if you keep trying to fix that problem. My resumee: we sould provide an explanation or a helpful link on how to install geopandas and cartopy (if it was not just me who struggled with both of them)

*This worked for me: conda install --channel conda-forge geopandas

@jnnr what version of Python and cartopy are you using

jakob-wo avatar Mar 03 '20 08:03 jakob-wo

You could [...] try to break something

With pleasure! ;)

jakob-wo avatar Mar 03 '20 09:03 jakob-wo

On one hand I spend some time on installing each required package one by one (using pip install). I was running the examples, waited for the "missing module message", and installed the correspoding package. A requiremnt.txt file will make this more convenient I guess.

The requirements are written in the setup.py. Did you install it with pip install -e <path-toDHNx>? This should install all necessary dependencies.

On the other hand I could not install geopanda via pip but got error massages. So I looked up alternatives on the geopandas docu page and found a way that worked for me*.

Good to know. What did the error messages say? I consider geopandas quite helpful and would count it to the requirements.

And then cartopy that does not seem to be crucial but eats a lot of time if you keep trying to fix that problem.

That's why cartopy is part of extras_require. Still we can find a way to replace it or to make installation easier.

@jnnr what version of Python and cartopy are you using

Atm python 3.66 and cartopy 0.17.0.

jnnr avatar Mar 03 '20 09:03 jnnr

It was more or less the same for me. It appears like the required packages could not be properly installed from -e flag even though only Rtree gave me an error message. I had to install Rtree manually in the interpreter. Afterwards it was possible to install DHNx. But so far I can say it seems osmnx, cartopy and geopandas were not installed properly, because I get errors or warnings running the examples.

MaGering avatar Mar 03 '20 09:03 MaGering

Did you install it with pip install -e <path-toDHNx>

yes, I did. I have a idea what might have caused this: To get the Repo I cloned it and by default it checked out the master branch. I think, I pip-installed DHNx as master branch (no requirements defined). Later (when the examples did not work) I realized that I was on the master and switched to the dev branch. Probably this is why the packages where not installed... I will check this later and report back.

jakob-wo avatar Mar 03 '20 09:03 jakob-wo

Good to know. What did the error messages say?

  • Rtree: "ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output."

  • Cartopy: "Warning in import_osmnx.py: INFO:root:Cartopy is not installed. Background maps will not be drawn."

  • Geopandas: "from pyproj import CRS, Transformer ImportError: cannot import name 'CRS'"

I hope that helps!

MaGering avatar Mar 03 '20 09:03 MaGering

I have a idea what might have caused this: To get the Repo I cloned it and by default it checked out the master branch. I think, I pip-installed DHNx as master branch (no requirements defined). Later (when the examples did not work) I realized that I was on the master and switched to the dev branch. Probably this is why the packages where not installed... I will check this later and report back.

I did the installation on dev branch but still had the above-mentioned problems.

MaGering avatar Mar 03 '20 09:03 MaGering

Right, the problem seems to be something else. When installing DHNx it does start to collect all required packages but fails with one package and stops the entire progress. Therefore we end up with no packages installed.

The Problem is caused by Fiona. Also when I reproduce my former installation process (one by one) geopandas fails because of Fiona:

Collecting fiona Using cached Fiona-1.8.13.post1.tar.gz (1.2 MB) ERROR: Command errored out with exit status 1: [...] Complete output (1 lines): A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable. ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

The geopandas docu mentions that potential problem, I just noticed:

When using pip to install GeoPandas, you need to make sure that all dependencies are installed correctly. Windows wheels for shapely, fiona, pyproj and rtree can be found at Christopher Gohlke’s website.

When I remove geopandas from the requirements-list the package-installation fails later with another package: Rtree. With the same error message as @MaGering wrote above.

@MaGering are you using Windows? I do and that might cause the problem with Fiona and Rtree as the geopandas docu also says:

So depending on your platform, you might need to compile and install their C dependencies manually. We refer to the individual packages for more details on installing those. Using conda (see above) avoids the need to compile the dependencies yourself.

This explains why conda install --channel conda-forge geopandas.

jakob-wo avatar Mar 03 '20 09:03 jakob-wo

@MaGering are you using Windows?

No, I'm using OSX.

The Problem is caused by Fiona.

Interesting. For me it was not Fiona but tcahumev.

MaGering avatar Mar 03 '20 10:03 MaGering

@MaGering are you using Anconda/Conda?

Would be interesting to know if conda install --channel conda-forge geopandas also works for OSX. If that's the case we could recommend using conda instead of pip.

jakob-wo avatar Mar 03 '20 10:03 jakob-wo

@MaGering are you using Anconda/Conda?

Yes I am.

Would be interesting to know if conda install --channel conda-forge geopandas also works for OSX.

The installation works, but there unfortunately are still errors. import_osmnx.py for example gives me an error related to geopandas.

Interesting. For me it was not Fiona but tcahumev.

Sorry, I mixed that up with Rtree. tcahumev was there the problem.

MaGering avatar Mar 03 '20 10:03 MaGering

btw: The installation problems of Cartopy are already discussed in one of their github issues.

jakob-wo avatar Mar 03 '20 10:03 jakob-wo

Can you tell me what tcahumev is? I searched it, but got no results at all.

jnnr avatar Mar 04 '20 08:03 jnnr

It appeared multiple times in the traceback. Here, for instance:

File "/private/var/folders/0x/6f9bvwdj0jv44yy2tpndnvj80000gn/T/pip-install-tcahumev/Rtree/setup.py", line 3, in

I just read that the "private/var" folder is a folder with temporary files on mac OS. So it seems to be a problem connected to installation on mac OS. I retried the installation under a new environment and received the same error but with another temporary file (not tcahumev).

MaGering avatar Mar 04 '20 09:03 MaGering

To sum up the installation problems. I checked the box if we found a solutions, which I describe shortly below the bullet point. Can you please update this list @jakob-wo, @MaGering?

  • [x] cartopy is now extras_require as a short term solution
  • [ ] geopandas
    • [ ] fiona
    • [ ] pyproj
  • [ ] rtree (has to be installed manually)
  • [ ] tcahumev (on OSX)

jnnr avatar Apr 08 '20 15:04 jnnr

All mentioned packages are extras_require now, or dependencies of extras_requires. Of course, this is a short term solution, but nothing, which should delay the first release.

joroeder avatar Oct 22 '20 14:10 joroeder