Skip to content

Library does not work at all with python 3.11 #127

Description

@mkaut

I wanted to try the library, but nothing seems to work with python 3.11 on Windows.
Is the library still maintained?

Already the first code snippet fails:

from windpowerlib.data import store_turbine_data_from_oedb
store_turbine_data_from_oedb()

gives

Traceback (most recent call last):
  File ".py311\Lib\site-packages\windpowerlib\data.py", line 252, in check_turbine_data
    data = check_data_integrity(filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\windpowerlib\data.py", line 269, in check_data_integrity
    wt = WindTurbine(**turbine_data_set)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\windpowerlib\wind_turbine.py", line 142, in __init__
    self.power_curve = get_turbine_data_from_file(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\windpowerlib\wind_turbine.py", line 407, in get_turbine_data_from_file
    wpp_df["wind_speed"] = wpp_df["wind_speed"].apply(lambda x: float(x))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\pandas\core\series.py", line 4771, in apply
    return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\pandas\core\apply.py", line 1123, in apply
    return self.apply_standard()
           ^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\pandas\core\apply.py", line 1174, in apply_standard
    mapped = lib.map_infer(
             ^^^^^^^^^^^^^^
  File "pandas\_libs\lib.pyx", line 2924, in pandas._libs.lib.map_infer
  File ".py311\Lib\site-packages\windpowerlib\wind_turbine.py", line 407, in <lambda>
    wpp_df["wind_speed"] = wpp_df["wind_speed"].apply(lambda x: float(x))
                                                                ^^^^^^^^
ValueError: could not convert string to float: '7.0.1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".py311\Lib\site-packages\windpowerlib\data.py", line 246, in store_turbine_data_from_oedb
    check_turbine_data(filename)
  File ".py311\Lib\site-packages\windpowerlib\data.py", line 254, in check_turbine_data
    restore_default_turbine_data()
  File ".py311\Lib\site-packages\windpowerlib\data.py", line 309, in restore_default_turbine_data
    for file in os.listdir(src_path):
                ^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified: '.py311\\Lib\\site-packages\\windpowerlib\\data\\default_turbine_data'

The second code snippet:

from windpowerlib import WindTurbine
enercon_e126 = {
    "turbine_type": "E-126/4200",  # turbine type as in register
    "hub_height": 135,  # in m
}
e126 = WindTurbine(**enercon_e126)

fails as well, and possibly for the same reason:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".py311\Lib\site-packages\windpowerlib\wind_turbine.py", line 142, in __init__
    self.power_curve = get_turbine_data_from_file(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\windpowerlib\wind_turbine.py", line 407, in get_turbine_data_from_file
    wpp_df["wind_speed"] = wpp_df["wind_speed"].apply(lambda x: float(x))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\pandas\core\series.py", line 4771, in apply
    return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\pandas\core\apply.py", line 1123, in apply
    return self.apply_standard()
           ^^^^^^^^^^^^^^^^^^^^^
  File ".py311\Lib\site-packages\pandas\core\apply.py", line 1174, in apply_standard
    mapped = lib.map_infer(
             ^^^^^^^^^^^^^^
  File "pandas\_libs\lib.pyx", line 2924, in pandas._libs.lib.map_infer
  File ".py311\Lib\site-packages\windpowerlib\wind_turbine.py", line 407, in <lambda>
    wpp_df["wind_speed"] = wpp_df["wind_speed"].apply(lambda x: float(x))
                                                                ^^^^^^^^
ValueError: could not convert string to float: '7.0.1'

Windows 10, python 3.11 x64, windpowerlib installed with pip.

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions