Error in base_network

491 views
Skip to first unread message

Felix Delgado Elizundia

unread,
Jan 30, 2022, 11:16:59 AM1/30/22
to pypsa
Hello everyone

I am trying to learn to use Pypsa, but i am getting an error in the base_network rule
It happens with the tutorial.
Conda is updated and the pypsa environment to.

Ant help is much appreciated.
Regards
Felix Delgado

Here is the log:
(pypsa-eur) C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur>snakemake -j 1 results/networks/elec_s_6_ec_lcopt_Co2L-24H.nc
Set parameter Username
Academic license - for non-commercial use only - expires 2022-03-27
No parameters matching '_test' found
Building DAG of jobs...
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job                         count    min threads    max threads
------------------------  -------  -------------  -------------
add_electricity                 1              1              1
add_extra_components            1              1              1
base_network                    1              1              1
build_bus_regions               1              1              1
build_powerplants               1              1              1
build_renewable_profiles        4              1              1
cluster_network                 1              1              1
prepare_network                 1              1              1
simplify_network                1              1              1
solve_network                   1              1              1
total                          13              1              1

Select jobs to execute...

[Sun Jan 30 17:13:10 2022]
rule base_network:
    input: data/entsoegridkit/buses.csv, data/entsoegridkit/lines.csv, data/entsoegridkit/links.csv, data/entsoegridkit/converters.csv, data/entsoegridkit/transformers.csv, data/parameter_corrections.yaml, data/links_p_nom.csv, data/links_tyndp.csv, resources/country_shapes.geojson, resources/offshore_shapes.geojson, resources/europe_shape.geojson
    output: networks/base.nc
    log: logs/base_network.log
    jobid: 6
    benchmark: benchmarks/base_network
    resources: tmpdir=C:\Users\felix\AppData\Local\Temp, mem_mb=500

C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\pyproj\__init__.py:89: UserWarning: pyproj unable to set database path.
  _pyproj_global_context_initialize()
Traceback (most recent call last):
  File "C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur\.snakemake\scripts\tmpzoipiwry.base_network.py", line 596, in <module>
    n = base_network(snakemake.input.eg_buses, snakemake.input.eg_converters, snakemake.input.eg_transformers, snakemake.input.eg_lines, snakemake.input.eg_links,
  File "C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur\.snakemake\scripts\tmpzoipiwry.base_network.py", line 547, in base_network
    buses = _load_buses_from_eg(eg_buses, europe_shape, config['electricity'])
  File "C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur\.snakemake\scripts\tmpzoipiwry.base_network.py", line 131, in _load_buses_from_eg
    europe_shape = gpd.read_file(europe_shape).loc[0, 'geometry']
  File "C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\geopandas\io\file.py", line 244, in _read_file
    return GeoDataFrame.from_features(
  File "C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\geopandas\geodataframe.py", line 610, in from_features
    return GeoDataFrame(rows, columns=columns, crs=crs)
  File "C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\geopandas\geodataframe.py", line 126, in __init__
    self._crs = CRS.from_user_input(crs) if crs else None
  File "C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\pyproj\crs\crs.py", line 479, in from_user_input
    return cls(value, **kwargs)
  File "C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\pyproj\crs\crs.py", line 326, in __init__
    self._local.crs = _CRS(self.srs)
  File "pyproj\_crs.pyx", line 2352, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: epsg:4326: (Internal Proj Error: proj_create: no database context specified)
[Sun Jan 30 17:13:14 2022]
Error in rule base_network:
    jobid: 6
    output: networks/base.nc
    log: logs/base_network.log (check log file(s) for error message)

RuleException:
CalledProcessError in line 112 of C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur\Snakefile:
Command 'C:/Users/felix/.conda/envs/pypsa-eur/python.exe "C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur\.snakemake\scripts\tmpzoipiwry.base_network.py"' returned non-zero exit status 1.
  File "C:\Users\felix\Documents\PythonScripts\PyPSA\pypsa-eur\Snakefile", line 112, in __rule_base_network
  File "C:\Users\felix\.conda\envs\pypsa-eur\lib\concurrent\futures\thread.py", line 58, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message

Johannes Hampp

unread,
Jan 31, 2022, 2:04:10 AM1/31/22
to Felix Delgado Elizundia, pypsa
Dear Felix,

> C:\Users\felix\.conda\envs\pypsa-eur\lib\site-packages\pyproj\__init__.py:89: UserWarning: pyproj unable to set database path.
> _pyproj_global_context_initialize()


This seems like an issue with your Python package installation. See the
pyproj [1] website for more information.

Have you tried creating a fresh pypsa-eur conda environment?
(You might have some dependencies falsely installed; upgrading the
environment alone using conda or mamba update would in this case not help.)

I.e. try:

$ conda activate base
$ conda remove --name pypsa-eur --all
$ conda env create -f envs/environment.yaml

or if you have mamba installed:
$ mamba env create -f envs/environment.yaml


Best,
Johannes

[1]
https://pyproj4.github.io/pyproj/stable/gotchas.html#internal-proj-error-sqlite-error-on-select
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/ad318742-672f-4482-8fa1-409e2d0288abn%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/ad318742-672f-4482-8fa1-409e2d0288abn%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages