openclimatefix/open-source-quartz-solar-forecast

bug: ___kmpc_for_static_fini

peterdudfield opened this issue · 10 comments


ImportError Traceback (most recent call last)
Cell In[1], line 8
5 site = PVSite(latitude=51.75, longitude=-1.25, capacity_kwp=1.25)
7 # run model, uses ICON NWP data by default
----> 8 predictions_df = run_forecast(site=site, ts='2023-11-01')

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/quartz_solar_forecast/forecast.py:31, in run_forecast(site, ts, nwp_source)
28 pv_xr = make_pv_data(site=site, ts=ts)
30 # load and run models
---> 31 pred_df = forecast_v1(nwp_source, nwp_xr, pv_xr, ts)
33 return pred_df

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/quartz_solar_forecast/forecasts/v1.py:20, in forecast_v1(nwp_source, nwp_xr, pv_xr, ts, model)
13 """
14 Run the forecast
15
16 This runs the pv-site-prediction model from the psp library.
17 """
19 if model is None:
---> 20 model = load_model(f"{dir_path}/../models/model-0.3.0.pkl")
22 # format pv and nwp data
23 pv_data_source = NetcdfPvDataSource(
24 pv_xr,
25 id_dim_name="pv_id",
(...)
28 ignore_pv_ids=[],
29 )

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/psp/serialization.py:25, in load_model(filepath)
22 def load_model(filepath: pathlib.Path | str) -> PvSiteModel:
23 # Use fsspec to support loading models from the cloud, using paths like "s3://..".
24 with fsspec.open(str(filepath), "rb") as f:
---> 25 (cls, attrs) = pickle.load(f)
27 model = cls.new(cls)
28 model.set_state(attrs)

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/psp/models/recent_history.py:13
11 from psp.data_sources.nwp import NwpDataSource
12 from psp.data_sources.pv import PvDataSource
---> 13 from psp.data_sources.satellite import SatelliteDataSource
14 from psp.models.base import PvSiteModel, PvSiteModelConfig
15 from psp.models.regressors.base import Regressor

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/psp/data_sources/satellite.py:1
----> 1 import pyresample
2 import xarray as xr
4 from psp.data_sources.nwp import NwpDataSource

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pyresample/init.py:27
25 from pyresample import geometry # noqa
26 from pyresample import grid # noqa
---> 27 from pyresample import image # noqa
28 from pyresample import kd_tree # noqa
29 from pyresample import plot # noqa

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pyresample/image.py:26
22 import warnings
24 import numpy as np
---> 26 from pyresample import geometry, grid, kd_tree
29 class ImageContainer(object):
30 """Holds image with geometry definition. Allows indexing with linesample arrays.
31
32 Parameters
(...)
54 Number of processor cores to be used for geometry operations
55 """

File ~/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pyresample/kd_tree.py:31
28 from logging import getLogger
30 import numpy as np
---> 31 from pykdtree.kdtree import KDTree
33 from pyresample import CHUNK_SIZE, _spatial_mp, data_reduce, geometry
35 from .future.resamplers._transform_utils import lonlat2xyz

ImportError: dlopen(/Users/xxx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pykdtree/kdtree.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '___kmpc_for_static_fini'

This could be a M1 issue.
@Rabscuttler I've created this for you

Apparently it works by installing it with poetry, so that might be the way forward. #25

@devsjc also got this

What python version where you using @devsjc ?

Python 3.10.12.
Installing pyresample from conda-forge resolved the issue for me. I'd imagine you could also just install pykdtree from conda-forge as well.

So would adding pyresample to the requirements help the pip instalation?
Are these the correct installation for conda-forge
conda install -c conda-forge pyresample quart-solar-forecast

Unless you've explicity made a conda-forge feedstock I don't think quartz-solar-forecast will be available there? But otherwise yes,

$ conda install -c conda-forge pyresample`

did the trick for me.

Ive added it to #37

Ill come this for now