Closed kandersolar closed 1 year ago
I tried both but still getting errors , also i am unable to figure out how to replace the pvfactor code with solarfactors.
Can you update this code which is given as example by pvlib, with exactly what lines to be changed ?
https://pvlib-python.readthedocs.io/en/stable/gallery/bifacial/plot_bifi_model_pvwatts.html#sphx-glr-gallery-bifacial-plot-bifi-model-pvwatts-py
[autoreload of pvlib.atmosphere failed: Traceback (most recent call last):
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 273, in check
superreload(m, reload, self.old_objects)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 496, in superreload
update_generic(old_obj, new_obj)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 393, in update_generic
update(a, b)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 305, in update_function
setattr(old, name, getattr(new, name))
ValueError: first_solar_spectral_correction() requires a code object with 0 free vars, not 3
]
[autoreload of pvlib.pvsystem failed: Traceback (most recent call last):
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 273, in check
superreload(m, reload, self.old_objects)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 496, in superreload
update_generic(old_obj, new_obj)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 393, in update_generic
update(a, b)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 305, in update_function
setattr(old, name, getattr(new, name))
ValueError: sapm_spectral_loss() requires a code object with 0 free vars, not 3
]
[autoreload of pvlib.modelchain failed: Traceback (most recent call last):
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 273, in check
superreload(m, reload, self.old_objects)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 496, in superreload
update_generic(old_obj, new_obj)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 393, in update_generic
update(a, b)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 345, in update_class
if update_generic(old_obj, new_obj):
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 393, in update_generic
update(a, b)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 305, in update_function
setattr(old, name, getattr(new, name))
ValueError: repr() requires a code object with 2 free vars, not 0
]
[autoreload of pvfactors failed: Traceback (most recent call last):
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 273, in check
superreload(m, reload, self.old_objects)
File "C:\Users\SaikatGhosh\anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 471, in superreload
module = reload(module)
File "C:\Users\SaikatGhosh\anaconda3\lib\importlib__init.py", line 169, in reload
_bootstrap._exec(spec, module)
File "
File ~\anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)
File c:\users\saikatghosh\clipping.py:256 irrad = pvfactors_timeseries(solar_position['azimuth'],
File ~\anaconda3\lib\site-packages\pvlib\bifacial\pvfactors.py:97 in pvfactors_timeseries from pvfactors.run import run_timeseries_engine
File ~\anaconda3\lib\site-packages\pvfactors\run.py:5 from pvfactors.geometry import OrderedPVArray
File ~\anaconda3\lib\site-packages\pvfactors\geometry__init__.py:3 from pvfactors.geometry.pvarray import OrderedPVArray
File ~\anaconda3\lib\site-packages\pvfactors\geometry\pvarray.py:6 from pvfactors.geometry.base import \
File ~\anaconda3\lib\site-packages\pvfactors\geometry\base.py:12 from shapely.geometry.collection import geos_geometrycollection_from_py
ImportError: cannot import name 'geos_geometrycollection_from_py' from 'shapely.geometry.collection' (C:\Users\SaikatGhosh\anaconda3\lib\site-packages\shapely\geometry\collection.py)
The last several versions of pvfactors require
pvlib<0.10
to preempt possible breaking changes. In fact this turned out to be unnecessary; to the best of my knowledge, there is no actual incompatibility between pvfactors==1.5.2 (the latest) and pvlib==0.10.0.However, that upper limit does prevent pip from installing
pvfactors==1.5.2
andpvlib==0.10.0
simultaneously. What it does instead is go back topvfactors==1.4.1
, the last version that doesn't requirepvlib<0.10
. The problem is that this version of pvfactors is old enough to not contain a compatibility fix with the latest shapely, resulting in a broken installation that errors when you try to actually use pvfactors. See for example this failed docs build: https://readthedocs.org/projects/pvlib-python/builds/21171307/Users have two options to work around this problem in the immediate term. Option 1: downgrade shapely to a version that works with
pvfactors==1.4.1
:Option 2: tell pip to ignore pvfactors when it says it isn't compatible with pvlib 0.10.0. This will allow you to keep using pvfactors 1.5.2:
For a more permanent fix, the best solution would be for pvfactors to release a new version that doesn't have this unnecessary
pvlib<0.10
requirement. But since that project is no longer maintained, we can't expect that to happen.In the absence of that, I see two options, both of which require going to 0.10.1:
shapely<2.0
to ouroptional
requirements, effectively making Option 1 above automatic. This has the downside of using an older version of pvfactors, which is missing a minor bugfix that a small minority of users might care about.An aside: although I did make a local
v0.10.0
tag and ensure that the tests passed before making the official 0.10.0 release, I neglected to installpvlib[optional]
in the fresh test environment, so the pvfactors tests were skipped and this problem did not arise. Had I been more thorough, this problem could have been found out before pvlib 0.10.0 was actually released.