pypsa-meets-earth / pypsa-earth

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.
https://pypsa-earth.readthedocs.io/en/latest/
230 stars 184 forks source link

Error when running snakemake cluster_network rule. #299

Closed Tomkourou closed 2 years ago

Tomkourou commented 2 years ago

Checklist

Describe the Bug

Running the cluster_network snakemake workflow using snakemake -c1 networks/elec_s_10.nc for "NG" and "BJ" returns a CalledProcessError, looks like something to do with running multiple threads although I really don't have experience here.

Solver: HiGHS.

IDE: Visual Studio Code.

OS: Ubuntu 20.04.4 LTS on Windows 10 x86_64

Error Message

INFO:snakemake.logging:
This is the repository path:  /home/thomas/Personal_projects/pypsa-africa
Had to go 0 folder(s) up.
INFO:pypsa.io:Imported network elec_s.nc has buses, carriers, generators, lines, loads
ERROR:pyomo.opt:Solver (asl) returned non-zero return code (255)
ERROR:pyomo.opt:Solver log:
ERROR:   Error parsing options: Option ‘A’ does not exist

Traceback (most recent call last):
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppng8yl1o.cluster_network.py", line 552, in <module>
    clustering = clustering_for_n_clusters(
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppng8yl1o.cluster_network.py", line 426, in clustering_for_n_clusters
    busmap = busmap_for_n_clusters(n, n_clusters, solver_name,
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppng8yl1o.cluster_network.py", line 344, in busmap_for_n_clusters
    n_clusters = distribute_clusters(n,
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppng8yl1o.cluster_network.py", line 293, in distribute_clusters
    results = opt.solve(m)
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/site-packages/pyomo/opt/base/solvers.py", line 595, in solve
    raise ApplicationError(
pyomo.common.errors.ApplicationError: Solver (asl) did not exit normally
[Tue Mar 22 10:46:10 2022]
INFO:snakemake.logging:[Tue Mar 22 10:46:10 2022]
Error in rule cluster_network:
    jobid: 2
    output: networks/elec_s_10_pre_augmentation.nc, resources/regions_onshore_elec_s_10.geojson, resources/regions_offshore_elec_s_10.geojson, resources/busmap_elec_s_10.csv, resources/linemap_elec_s_10.csv
    log: logs/cluster_network/elec_s_10.log (check log file(s) for error message)

ERROR:snakemake.logging:Error in rule cluster_network:
    jobid: 2
    output: networks/elec_s_10_pre_augmentation.nc, resources/regions_onshore_elec_s_10.geojson, resources/regions_offshore_elec_s_10.geojson, resources/busmap_elec_s_10.csv, resources/linemap_elec_s_10.csv
    log: logs/cluster_network/elec_s_10.log (check log file(s) for error message)

RuleException:
CalledProcessError in line 302 of /home/thomas/Personal_projects/pypsa-africa/Snakefile:
Command 'set -euo pipefail;  /home/thomas/anaconda3/envs/pypsa-africa/bin/python3.9 /home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppng8yl1o.cluster_network.py' returned non-zero exit status 1.
  File "/home/thomas/Personal_projects/pypsa-africa/Snakefile", line 302, in __rule_cluster_network
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/concurrent/futures/thread.py", line 58, in run
ERROR:snakemake.logging:RuleException:
CalledProcessError in line 302 of /home/thomas/Personal_projects/pypsa-africa/Snakefile:
Command 'set -euo pipefail;  /home/thomas/anaconda3/envs/pypsa-africa/bin/python3.9 /home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppng8yl1o.cluster_network.py' returned non-zero exit status 1.
  File "/home/thomas/Personal_projects/pypsa-africa/Snakefile", line 302, in __rule_cluster_network
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/concurrent/futures/thread.py", line 58, in run
Shutting down, this might take some time.
WARNING:snakemake.logging:Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
ERROR:snakemake.logging:Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2022-03-22T104026.604517.snakemake.log
WARNING:snakemake.logging:Complete log: .snakemake/log/2022-03-22T104026.604517.snakemake.log

And here is my environment:

# packages in environment at /home/thomas/anaconda3/envs/pypsa-africa:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
affine                    2.3.0                      py_0    conda-forge
alsa-lib                  1.2.3                h516909a_0    conda-forge
amply                     0.1.4                      py_0    conda-forge
anyio                     3.5.0            py39hf3d152e_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0           py39h3811e60_1    conda-forge
asttokens                 2.0.5              pyhd8ed1ab_0    conda-forge
atlite                    0.2.5              pyhd8ed1ab_0    conda-forge
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.10.0                   pypi_0    pypi
black                     21.12b0            pyhd8ed1ab_0    conda-forge
bleach                    4.1.0              pyhd8ed1ab_0    conda-forge
blosc                     1.21.0               h9c3ff4c_0    conda-forge
bokeh                     2.4.2            py39hf3d152e_0    conda-forge
boost-cpp                 1.74.0               h312852a_4    conda-forge
bottleneck                1.3.4            py39hd257fcd_0    conda-forge
branca                    0.4.2              pyhd8ed1ab_0    conda-forge
brotli                    1.0.9                h7f98852_6    conda-forge
brotli-bin                1.0.9                h7f98852_6    conda-forge
brotlipy                  0.7.0           py39h3811e60_1003    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
cairo                     1.16.0            h6cf1ce9_1008    conda-forge
cartopy                   0.20.1           py39ha48bd0d_1    conda-forge
cdsapi                    0.5.1              pyhd8ed1ab_0    conda-forge
certifi                   2021.10.8        py39hf3d152e_1    conda-forge
cffi                      1.15.0           py39h4bc2ebd_0    conda-forge
cfgv                      3.3.1              pyhd8ed1ab_0    conda-forge
cfitsio                   3.470                hb418390_7    conda-forge
cftime                    1.5.2            py39hce5d2b2_0    conda-forge
charset-normalizer        2.0.12             pyhd8ed1ab_0    conda-forge
click                     7.1.2              pyh9f0ad1d_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
cloudpickle               2.0.0              pyhd8ed1ab_0    conda-forge
coincbc                   2.10.5               hcee13e7_1    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
colorcet                  3.0.0              pyhd8ed1ab_0    conda-forge
conda                     4.11.0           py39hf3d152e_0    conda-forge
conda-package-handling    1.7.3            py39h3811e60_1    conda-forge
configargparse            1.5.3              pyhd8ed1ab_0    conda-forge
connection_pool           0.0.3              pyhd3deb0d_0    conda-forge
country_converter         0.7.4              pyhd8ed1ab_0    conda-forge
countrycode               0.2                      pypi_0    pypi
cryptography              36.0.1           py39h95dcef6_0    conda-forge
curl                      7.81.0               h2574ce0_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cytoolz                   0.11.2           py39h3811e60_1    conda-forge
dask                      2021.3.1           pyhd8ed1ab_0    conda-forge
dask-core                 2021.3.1           pyhd8ed1ab_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
datashader                0.13.0             pyh6c4a22f_0    conda-forge
datashape                 0.5.4                      py_1    conda-forge
datrie                    0.8.2            py39h3811e60_3    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
debugpy                   1.5.1            py39he80948d_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
deprecation               2.1.0              pyh9f0ad1d_0    conda-forge
descartes                 1.1.0                      py_4    conda-forge
distlib                   0.3.4              pyhd8ed1ab_0    conda-forge
distributed               2021.4.1         py39hf3d152e_1    conda-forge
docutils                  0.18.1           py39hf3d152e_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
entsoe-py                 0.4.3                    pypi_0    pypi
esy-osm-pbf               0.0.1                    pypi_0    pypi
esy-osmfilter             1.0.11                   pypi_0    pypi
et_xmlfile                1.0.1                   py_1001    conda-forge
executing                 0.8.2              pyhd8ed1ab_0    conda-forge
expat                     2.4.6                h27087fc_0    conda-forge
filelock                  3.6.0              pyhd8ed1ab_0    conda-forge
fiona                     1.8.20           py39h427c1bf_2    conda-forge
flit-core                 3.7.1              pyhd8ed1ab_0    conda-forge
folium                    0.12.1.post1       pyhd8ed1ab_1    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.13.96              ha180cfb_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.29.1           py39h3811e60_0    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
freexl                    1.0.6                h7f98852_0    conda-forge
fsspec                    2022.2.0           pyhd8ed1ab_0    conda-forge
gdal                      3.3.3            py39h0494519_0    conda-forge
geographiclib             1.52               pyhd8ed1ab_0    conda-forge
geopandas                 0.10.2             pyhd8ed1ab_1    conda-forge
geopandas-base            0.10.2             pyha770c72_1    conda-forge
geopy                     2.2.0              pyhd8ed1ab_0    conda-forge
geos                      3.9.1                h9c3ff4c_2    conda-forge
geotiff                   1.7.0                hcfb7246_3    conda-forge
geoviews                  1.9.4              pyhd8ed1ab_0    conda-forge
geoviews-core             1.9.4              pyha770c72_0    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
giflib                    5.2.1                h36c2ea0_2    conda-forge
gitdb                     4.0.9              pyhd8ed1ab_0    conda-forge
gitpython                 3.1.27             pyhd8ed1ab_0    conda-forge
glpk                      5.0                  h445213a_0    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
googledrivedownloader     0.4                pyhd3deb0d_1    conda-forge
graphite2                 1.3.13            h58526e2_1001    conda-forge
gst-plugins-base          1.18.5               hf529b03_3    conda-forge
gstreamer                 1.18.5               h9f60fe5_3    conda-forge
harfbuzz                  2.9.1                h83ec7ef_1    conda-forge
hdf4                      4.2.15               h10796ff_3    conda-forge
hdf5                      1.12.1          nompi_h2750804_103    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
holoviews                 1.14.8             pyhd8ed1ab_0    conda-forge
hvplot                    0.7.3              pyh6c4a22f_0    conda-forge
icu                       68.2                 h9c3ff4c_0    conda-forge
identify                  2.4.11             pyhd8ed1ab_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.1           py39hf3d152e_0    conda-forge
importlib_metadata        4.11.1               hd8ed1ab_0    conda-forge
importlib_resources       5.4.0              pyhd8ed1ab_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipykernel                 6.9.2            py39hef51801_0    conda-forge
ipython                   8.1.1            py39hf3d152e_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jbig                      2.1               h7f98852_2003    conda-forge
jedi                      0.18.1           py39hf3d152e_0    conda-forge
jinja2                    3.0.3              pyhd8ed1ab_0    conda-forge
joblib                    1.1.0              pyhd8ed1ab_0    conda-forge
jpeg                      9e                   h7f98852_0    conda-forge
json-c                    0.15                 h98cffda_0    conda-forge
json5                     0.9.5              pyh9f0ad1d_0    conda-forge
jsonschema                4.4.0              pyhd8ed1ab_0    conda-forge
jupyter_client            7.1.2              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.2            py39hf3d152e_0    conda-forge
jupyter_server            1.13.5             pyhd8ed1ab_1    conda-forge
jupyterlab                3.3.2              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_server         2.10.3             pyhd8ed1ab_0    conda-forge
kealib                    1.4.14               h87e4c3c_3    conda-forge
kiwisolver                1.3.2            py39h1a9c180_1    conda-forge
krb5                      1.19.2               hcc1bbae_3    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lerc                      3.0                  h9c3ff4c_0    conda-forge
libarchive                3.5.2                hccf745f_1    conda-forge
libblas                   3.9.0           13_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h7f98852_6    conda-forge
libbrotlidec              1.0.9                h7f98852_6    conda-forge
libbrotlienc              1.0.9                h7f98852_6    conda-forge
libcblas                  3.9.0           13_linux64_openblas    conda-forge
libclang                  11.1.0          default_ha53f305_1    conda-forge
libcurl                   7.81.0               h2574ce0_0    conda-forge
libdap4                   3.20.6               hd7c4107_2    conda-forge
libdeflate                1.10                 h7f98852_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 11.2.0              h1d223b6_12    conda-forge
libgdal                   3.3.3                h356f897_0    conda-forge
libgfortran-ng            11.2.0              h69a702a_12    conda-forge
libgfortran5              11.2.0              h5c6108e_12    conda-forge
libglib                   2.70.2               h174f98d_4    conda-forge
libgomp                   11.2.0              h1d223b6_12    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libkml                    1.3.0             h238a007_1014    conda-forge
liblapack                 3.9.0           13_linux64_openblas    conda-forge
libllvm10                 10.0.1               he513fc3_3    conda-forge
libllvm11                 11.1.0               hf817b99_3    conda-forge
libmamba                  0.21.2               h3985d26_0    conda-forge
libmambapy                0.21.2           py39h8bfa403_0    conda-forge
libnetcdf                 4.8.1           nompi_hb3fd0d9_101    conda-forge
libnghttp2                1.47.0               h727a467_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.18          pthreads_h8fe5266_0    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     13.5                 hd57d9b9_1    conda-forge
librttopo                 1.1.0                h1185371_6    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsolv                   0.7.19               h780b84a_5    conda-forge
libspatialindex           1.9.3                h9c3ff4c_4    conda-forge
libspatialite             5.0.1                h8796b1e_9    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_12    conda-forge
libtiff                   4.3.0                h542a066_3    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp                   1.2.2                h3452ae3_0    conda-forge
libwebp-base              1.2.2                h7f98852_1    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.12               h72842e0_0    conda-forge
libxslt                   1.1.33               h15afd5d_2    conda-forge
libzip                    1.8.0                h4de3113_1    conda-forge
libzlib                   1.2.11            h36c2ea0_1013    conda-forge
llvmlite                  0.36.0           py39h1bbdace_0    conda-forge
locket                    0.2.0                      py_2    conda-forge
lxml                      4.8.0            py39h107f48f_0    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mamba                     0.21.2           py39hfa8f2c8_0    conda-forge
mapclassify               2.4.3              pyhd8ed1ab_0    conda-forge
markdown                  3.3.6              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.0            py39hb9d737c_0    conda-forge
matplotlib                3.5.1            py39hf3d152e_0    conda-forge
matplotlib-base           3.5.1            py39h2fa2bec_0    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
memory_profiler           0.60.0             pyhd8ed1ab_0    conda-forge
mistune                   0.8.4           py39h3811e60_1005    conda-forge
msgpack-python            1.0.3            py39h1a9c180_0    conda-forge
multipledispatch          0.6.0                      py_0    conda-forge
munch                     2.5.0                      py_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mypy_extensions           0.4.3            py39hf3d152e_4    conda-forge
mysql-common              8.0.28               ha770c72_0    conda-forge
mysql-libs                8.0.28               hfa10184_0    conda-forge
nbclassic                 0.3.5              pyhd8ed1ab_0    conda-forge
nbclient                  0.5.11             pyhd8ed1ab_0    conda-forge
nbconvert                 6.4.2            py39hf3d152e_0    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h9c3ff4c_0    conda-forge
nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
netcdf4                   1.5.8           nompi_py39h64b754b_101    conda-forge
networkx                  2.7.1              pyhd8ed1ab_0    conda-forge
nodeenv                   1.6.0              pyhd8ed1ab_0    conda-forge
nomkl                     1.0                  h5ca1d4c_0    conda-forge
notebook                  6.4.8              pyha770c72_0    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.74                 hb5efdd6_0    conda-forge
numba                     0.53.1           py39h56b8d98_1    conda-forge
numexpr                   2.8.0           py39hbd72853_101    conda-forge
numpy                     1.22.3           py39h18676bf_0    conda-forge
openjdk                   11.0.9.1             h5cc2fde_1    conda-forge
openjpeg                  2.4.0                hb52868f_1    conda-forge
openpyxl                  3.0.9              pyhd8ed1ab_0    conda-forge
openssl                   1.1.1l               h7f98852_0    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandas                    1.3.4            py39hde0f152_1    conda-forge
pandoc                    2.17.1.1             ha770c72_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
panel                     0.12.6             pyhd8ed1ab_0    conda-forge
param                     1.12.0             pyh6c4a22f_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
partd                     1.2.0              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
patsy                     0.5.2              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.0.1            py39hae2aec6_2    conda-forge
pip                       22.0.4             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
plac                      1.3.4              pyhd8ed1ab_0    conda-forge
platformdirs              2.5.1              pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0            py39hf3d152e_2    conda-forge
ply                       3.11                       py_1    conda-forge
poppler                   21.09.0              ha39eefc_3    conda-forge
poppler-data              0.4.11               hd8ed1ab_0    conda-forge
postgresql                13.5                 h2510834_1    conda-forge
powerplantmatching        0.4.8                    pypi_0    pypi
pre-commit                2.17.0           py39hf3d152e_0    conda-forge
progressbar2              4.0.0              pyhd8ed1ab_0    conda-forge
proj                      8.1.1                h277dcde_2    conda-forge
prometheus_client         0.13.1             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.27             pyha770c72_0    conda-forge
protobuf                  3.19.4                   pypi_0    pypi
psutil                    5.9.0            py39h3811e60_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pulp                      2.6.0            py39hf3d152e_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
py                        1.11.0             pyh6c4a22f_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.3           py39h3811e60_1009    conda-forge
pycountry                 20.7.3             pyh9f0ad1d_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyct                      0.4.6                      py_0    conda-forge
pyct-core                 0.4.6                      py_0    conda-forge
pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
pyomo                     6.4.0            py39h5a03fae_0    conda-forge
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.7              pyhd8ed1ab_0    conda-forge
pyproj                    3.2.1            py39ha81a305_2    conda-forge
pypsa                     0.19.2             pyhd8ed1ab_0    conda-forge
pyqt                      5.12.3           py39hf3d152e_8    conda-forge
pyqt-impl                 5.12.3           py39hde8b62d_8    conda-forge
pyqt5-sip                 4.19.18          py39he80948d_8    conda-forge
pyqtchart                 5.12             py39h0fcd23e_8    conda-forge
pyqtwebengine             5.12.1           py39h0fcd23e_8    conda-forge
pyrsistent                0.18.1           py39h3811e60_0    conda-forge
pyshp                     2.2.0              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1            py39hf3d152e_4    conda-forge
pytables                  3.7.0            py39h2669a42_0    conda-forge
pytest                    7.0.1            py39hf3d152e_0    conda-forge
python                    3.9.10          h85951f9_2_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-graphviz           0.19.1                   pypi_0    pypi
python-utils              3.1.0              pyhd8ed1ab_0    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pytz                      2021.3             pyhd8ed1ab_0    conda-forge
pyviz_comms               2.1.0              pyhd8ed1ab_0    conda-forge
pyyaml                    6.0              py39h3811e60_3    conda-forge
pyzmq                     22.3.0           py39h37b5a0c_1    conda-forge
qt                        5.12.9               hda022c4_4    conda-forge
rasterio                  1.2.10           py39hb37810a_0    conda-forge
ratelimiter               1.2.0                   py_1002    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
reproc                    14.2.3               h7f98852_0    conda-forge
reproc-cpp                14.2.3               h9c3ff4c_0    conda-forge
requests                  2.27.1             pyhd8ed1ab_0    conda-forge
retry                     0.9.2                      py_0    conda-forge
rioxarray                 0.10.2             pyhd8ed1ab_0    conda-forge
rtree                     0.9.7            py39hb102c33_3    conda-forge
ruamel_yaml               0.15.80         py39h3811e60_1006    conda-forge
scikit-learn              1.0.2            py39h4dfa638_0    conda-forge
scipy                     1.8.0            py39hee8e79c_1    conda-forge
seaborn                   0.11.2               hd8ed1ab_0    conda-forge
seaborn-base              0.11.2             pyhd8ed1ab_0    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                59.8.0           py39hf3d152e_0    conda-forge
shapely                   1.8rc1           py39h2226dc9_0    conda-forge/label/shapely_dev
six                       1.16.0             pyh6c4a22f_0    conda-forge
sklearn                   0.0                      pypi_0    pypi
smart_open                5.2.1              pyhd8ed1ab_0    conda-forge
smmap                     3.0.5              pyh44b312d_0    conda-forge
snakemake-minimal         7.3.0              pyhdfd78af_0    bioconda
sniffio                   1.2.0            py39hf3d152e_2    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.1                    pypi_0    pypi
sqlite                    3.37.0               h9cd32fc_0    conda-forge
stack_data                0.2.0              pyhd8ed1ab_0    conda-forge
statsmodels               0.13.2           py39hce5d2b2_0    conda-forge
stopit                    1.1.2                      py_0    conda-forge
tabulate                  0.8.9              pyhd8ed1ab_0    conda-forge
tblib                     1.7.0              pyhd8ed1ab_0    conda-forge
terminado                 0.13.1           py39hf3d152e_0    conda-forge
testpath                  0.6.0              pyhd8ed1ab_0    conda-forge
threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
tiledb                    2.3.4                he87e0bf_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.2              pyhd8ed1ab_0    conda-forge
toolz                     0.11.2             pyhd8ed1ab_0    conda-forge
toposort                  1.7                pyhd8ed1ab_0    conda-forge
tornado                   6.1              py39h3811e60_2    conda-forge
tqdm                      4.63.0             pyhd8ed1ab_0    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
tsam                      2.0.0                    pypi_0    pypi
typed-ast                 1.5.2            py39h3811e60_0    conda-forge
typing_extensions         4.1.1              pyha770c72_0    conda-forge
tzcode                    2021e                h7f98852_0    conda-forge
tzdata                    2021e                he74cb21_0    conda-forge
ukkonen                   1.0.1            py39h1a9c180_1    conda-forge
unicodedata2              14.0.0           py39h3811e60_0    conda-forge
urllib3                   1.26.8             pyhd8ed1ab_1    conda-forge
virtualenv                20.13.2          py39hf3d152e_0    conda-forge
vresutils                 0.3.1                    pypi_0    pypi
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
websocket-client          1.2.3              pyhd8ed1ab_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
wrapt                     1.13.3           py39h3811e60_1    conda-forge
xarray                    2022.3.1.dev25+gf8bae597          pypi_0    pypi
xerces-c                  3.2.3                h9d8b166_3    conda-forge
xlrd                      2.0.1              pyhd8ed1ab_3    conda-forge
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-inputproto           2.3.2             h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxi                1.7.10               h7f98852_0    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-libxtst              1.2.3             h7f98852_1002    conda-forge
xorg-recordproto          1.14.2            h7f98852_1002    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xyzservices               2022.2.0           pyhd8ed1ab_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yaml-cpp                  0.6.3                he1b5a44_4    conda-forge
yte                       1.0.0            py39hf3d152e_0    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zict                      2.0.0                      py_0    conda-forge
zipp                      3.7.0              pyhd8ed1ab_1    conda-forge
zlib                      1.2.11            h36c2ea0_1013    conda-forge
zstd                      1.5.2                ha95c52a_0    conda-forge

Let me know if I can add any further information.

pz-max commented 2 years ago

Could you try to run the same thing with CBC or glpk? The clustering requires some special solving approach (I believe the code pivots to CBC for that part) Maybe for highs this is not perfectly integrated by default...

Tomkourou commented 2 years ago

When using glpk or CBC it defaults back to ipopt which I so far haven't been able to install on Ubuntu . I could explore this in more detail. Here is the error code for glpk but its exactly the same whne using CBC


INFO:pypsa.io:Imported network elec_s.nc has buses, carriers, generators, lines, loads
WARNING:__main__:The configured solver `glpk` does not support quadratic objectives. Falling back to `ipopt`.
WARNING:pyomo.solvers:Could not locate the 'ipopt' executable, which is required for solver ipopt
Traceback (most recent call last):
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppq5unxd0.cluster_network.py", line 552, in <module>
    clustering = clustering_for_n_clusters(
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppq5unxd0.cluster_network.py", line 426, in clustering_for_n_clusters
    busmap = busmap_for_n_clusters(n, n_clusters, solver_name,
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppq5unxd0.cluster_network.py", line 344, in busmap_for_n_clusters
    n_clusters = distribute_clusters(n,
  File "/home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppq5unxd0.cluster_network.py", line 293, in distribute_clusters
    results = opt.solve(m)
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/site-packages/pyomo/opt/base/solvers.py", line 512, in solve
    self.available(exception_flag=True)
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/site-packages/pyomo/opt/solver/shellcmd.py", line 128, in available
    raise ApplicationError(msg % self.name)
pyomo.common.errors.ApplicationError: No executable found for solver 'ipopt'
[Tue Mar 22 13:13:01 2022]
INFO:snakemake.logging:[Tue Mar 22 13:13:01 2022]
Error in rule cluster_network:
    jobid: 2
    output: networks/elec_s_10_pre_augmentation.nc, resources/regions_onshore_elec_s_10.geojson, resources/regions_offshore_elec_s_10.geojson, resources/busmap_elec_s_10.csv, resources/linemap_elec_s_10.csv
    log: logs/cluster_network/elec_s_10.log (check log file(s) for error message)

ERROR:snakemake.logging:Error in rule cluster_network:
    jobid: 2
    output: networks/elec_s_10_pre_augmentation.nc, resources/regions_onshore_elec_s_10.geojson, resources/regions_offshore_elec_s_10.geojson, resources/busmap_elec_s_10.csv, resources/linemap_elec_s_10.csv
    log: logs/cluster_network/elec_s_10.log (check log file(s) for error message)

RuleException:
CalledProcessError in line 302 of /home/thomas/Personal_projects/pypsa-africa/Snakefile:
Command 'set -euo pipefail;  /home/thomas/anaconda3/envs/pypsa-africa/bin/python3.9 /home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppq5unxd0.cluster_network.py' returned non-zero exit status 1.
  File "/home/thomas/Personal_projects/pypsa-africa/Snakefile", line 302, in __rule_cluster_network
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/concurrent/futures/thread.py", line 58, in run
ERROR:snakemake.logging:RuleException:
CalledProcessError in line 302 of /home/thomas/Personal_projects/pypsa-africa/Snakefile:
Command 'set -euo pipefail;  /home/thomas/anaconda3/envs/pypsa-africa/bin/python3.9 /home/thomas/Personal_projects/pypsa-africa/.snakemake/scripts/tmppq5unxd0.cluster_network.py' returned non-zero exit status 1.
  File "/home/thomas/Personal_projects/pypsa-africa/Snakefile", line 302, in __rule_cluster_network
  File "/home/thomas/anaconda3/envs/pypsa-africa/lib/python3.9/concurrent/futures/thread.py", line 58, in run
Shutting down, this might take some time.
WARNING:snakemake.logging:Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
ERROR:snakemake.logging:Exiting because a job execution failed. Look above for error message
pz-max commented 2 years ago

Oh yes, Ipopt is the right thing! You see in the CI that we are adding it to the env.yaml when running with glpk https://github.com/pypsa-meets-africa/pypsa-africa/blob/c994217e2c5fff891e39dde5fe6da6d27757c498/.github/workflows/ci.yaml#L48-L50

So running highs with ipopt will work as well. You can try two things: First install ipopt with pip like pip install ipopt (if that does not work google for ipopt pip installation). As alternative, when setting up the conda environment you should uncomment out ipopt from here https://github.com/pypsa-meets-africa/pypsa-africa/blob/c994217e2c5fff891e39dde5fe6da6d27757c498/envs/environment.yaml#L65-L67

Tomkourou commented 2 years ago

Thanks for the tip @pz-max. Somehow I tried pip install ipopt before but on the ubuntu at least it did not install an executable in my environment. However conda install -c conda-forge cyipopt did the job. Running snakemake cluster rule now works as expected. Thanks!