You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by prith-gs July 26, 2024
Hello,
I'm trying to run example 01 with FLORIS 4.1.1 and I don't get this error in FLORIS 3.5 and I'm not sure why I get this error.
Here's the code I'm running where I am reading the input yaml file using FlorisModel function in line 9 and I'm using a function I found online in line 4 and 5.
Line 4 and 5 executes properly and has no issues in reading the yaml file and I can see the variable 'data' as well
Here's what's stored in the variable data
But line 9 gives me the following error and I'm not clear why I'm getting this error
Comment by @HDW7812:
Hi, I'm also experiencing this problem, although I don't know exactly what's causing it, but I have a feeling it's a conflict with a previously installed package, so the turbine_library_path is incorrect. I create a new envs (without pip install floris), then run the demo, it works. I hope it can help you!
If you are in a hurry to use it, you can try this method. Wish someone could answer you more professionally.
If you are using this within a conda environment, could you share the list of packages you have installed? As @HDW7812 pointed out, this could be something to do with package versions in your environment, especially if you are using the same environment you were running v3.5 with.
As also pointed out by @HDW7812 , starting with a fresh conda environment and a fresh pip install of FLORIS may solve your issue.
I'm going to convert this discussion to an issue in the meantime.
I tried creating a new environment and install floris again and I'm still getting the same error.
I'm using miniconda and here's the list of packages I have installed in the new environment I created.
@jfrederik-nrel , @Bartdoekemeijer 's comment above reminded me---was this the same issue I talked about with you a few months back? I recall an issue with loading turbines having to do with a piece of code not correctly building a path when running on Windows
I was indeed using python v3.8.1 and had this issue for FLORIS v4.x and not for v3.x.
Now, when I switched to python v3.11.9, I don't get that error anymore and the example files work properly.
Appreciate the help! :)
Will this be sorted for python v3.8 and 3.9 in further releases? or do I have to switch to python >= v3.10 for FLORIS v4.0 and above?
Glad that you got this working. Right, the issue here seems to be limited to older python versions (3.8 and 3.9, and likely earlier versions) running on Windows systems. We will likely not try to address this, and shift support to python 3.10 and above. I will discuss with other Floris developers and confirm.
At this stage, do you have a specific need to run Floris with an earlier version of python?
I'm working with some inhouse packages which are written for python 3.8 and hence I'm using FLORIS with an older version of python. If it can be modified to work with the previous version that'll be nice, if not it's still fine, we are probably due for an upgrade anyway. Appreciate the help!
Thanks for posting this issue! I run into the same issue using python 3.9.
I was first confused as I didn't expect any issue because setup.py specifies the required python version with >=3.8.0.
Maybe one could update setup.py to take the higher minimum python version for windows into account.
The following snippet could help:
import sys
if sys.platform == "win32":
REQUIRES_PYTHON = ">=3.10.0" # Minimum Python version for Windows
else:
REQUIRES_PYTHON = ">=3.8.0" # Minimum Python version for other platforms
Agreed that the versioning listed in setup.py is misleading, and thank you for the suggestion of having platform-depending versions. We've actually recently been discussing moving to relying solely on pyproject.toml, rather than setup.py, for package requirements. At that stage, we may shift to requiring python >= 3.10 across all operating systems, as 3.8 just recently reached end-of-life and 3.9 will be at end-of-life in a year's time.
We will try to post updates in this issue thread as we make decisions regarding package management updates and python version support.
I spent some time looking into this and here's what I've found. The issue in FLORIS is located in type_dec.convert_to_path. This function is meant to resolve a truncated path to either an absolute path (i.e. starting with /Users/... for macOS or C:\Users\... for Windows) or relative path from the Python interpreter's current working directory. The absolute path part works correctly, but the relative path search has a subtle issue (maybe a bug, maybe not, and maybe it's not our fault).
To find the relative path, the function uses the inspect.stack module to get the filename of the file that called the current function, and then it will build a relative path from there. The frames in the call stack have the following structure (the details are redacted so you can see the structure):
FrameInfo(
frame=<frame at ..., file 'file path...', line ..., code ...>,
filename='C:\\hostedtoolcache\\...',
lineno=103,
function='_multicall',
code_context=[' res = hook_impl.function(*args)\n'],
index=0
),
However, since FLORIS uses attrs, the "filename" for attrs-derived classes is instead a function: <attrs generated init floris.core.farm.Farm>. Since all classes in floris.core are attrs-derived, I think using inspect.stack()[1] to create a path will not work. There is a unit test for this, and it passes because it is not testing with an attrs-derived class. That is to say that the code works well, but it is not applicable to the structure of FLORIS classes.
#951 (comment) points out that this works for Python 3.10 and above, so why is that and how does this work at all? The different behavior across Python versions is due to a change in pathlib and os.path that introduced the concept of "strict" path resolutions and consolidated the path resolving. In Python 3.9, pathlib.Path has a Windows-specific Path class and a unique resolve() method. Despite accepting the "strict" argument, the implementation is incomplete because it still checks for valid characters in the path. In Python 3.10, the Path classes for all system types were consolidated and they ultimately use os.path.realpath for Path.resolve. Also in Python 3.10, os.path.realpath got the "strict" parameter and it was defaulted to False. Basically, in Python 3.10+, an invalid path in Path.resolve() is treated as if it might exist regardless of the content of the path string, whereas in lower Pythons the path string is checked for at least having valid characters.
For what it's worth, there have been multiple suggestions to change this behavior in pathlib for Python <3.10:
A similar backwards compatible change was made for pathlib.Path.exists in Python 3.8 and Python 3.9, but it did not include the change for .resolve. I plan to propose the change to the CPython maintainers, but I also assume that is a stretch and a very long path.
As for FLORIS, I think the fix is to avoid the relative path search from the file of the calling-function. Currently, this will always be an attrs function and it was only "working" due to a nuance in error handling from the Python pathlib library. I've shown this in https://github.com/NREL/floris/pull/953/files. @RHammond2@bayc your opinions here would be very valuable (plus @RHammond2 I thought you might enjoy the Python deep dive, as well 😺) since you are more aware of the consequences of how various files are loaded.
Thanks for sharing this comprehensive writeup, @paulf81 ! For what it's worth Python 3.9 is no longer actively supported, and is ending security updates as of October 31, 2025. Moreover, Python 3.8 is officially unsupported, so my thought would be to end support for Python 3.8/9 given it's a 3.8/9 issue. In a couple of other projects where we were upgrading infrastructure, we also made the decision to support 3.10+ in their latest releases.
As for how to handle the attrs derived relative paths correctly, I don't have any immediate resolutions, but I suspect HOPP/GreenHEART will also encounter this issue because they use a direct copy of this implementation, and so I can share back any solution we create.
Thanks all. Since this issue is not critical, but 3.9 is not yet at end-of-life, I propose that we:
Add a warning to the documentation that support for python 3.9 will be dropped within the next 6 months
Open a PR to drop 3.9 support, which removes 3.9 from the testing matrix but also removes the from __future__ import annotations line that @paulf81 mentioned and possibly moves to the match/case structure that @RHammond2 mentioned for model selections and other appropriate areas.
We have now merged #1079 into develop, which officially drops support for python 3.9 (as well as adding windows and mac OS testing and adding support for 3.10). This will appear on main in the next major FLORIS release (4.6). While this doesn't exactly "solve" the issue for earlier versions of FLORIS, it should mean that the issue does not appear if FLORIS is brought forward to the latest version and requirements are followed, so I'm going to close this issue. Please feel free to reopen if the problem persists after updating FLORIS and using python version 3.10 or greater.
Activity
misi9170 commentedon Jul 26, 2024
Tagging @prith-gs and @HDW7812
misi9170 commentedon Jul 26, 2024
Bringing over comments from discussion:
Comment by @HDW7812:
Hi, I'm also experiencing this problem, although I don't know exactly what's causing it, but I have a feeling it's a conflict with a previously installed package, so the turbine_library_path is incorrect. I create a new envs (without pip install floris), then run the demo, it works. I hope it can help you!
If you are in a hurry to use it, you can try this method. Wish someone could answer you more professionally.
Comment by @misi9170:
Hi @prith-gs ,
If you are using this within a conda environment, could you share the list of packages you have installed? As @HDW7812 pointed out, this could be something to do with package versions in your environment, especially if you are using the same environment you were running v3.5 with.
As also pointed out by @HDW7812 , starting with a fresh conda environment and a fresh pip install of FLORIS may solve your issue.
I'm going to convert this discussion to an issue in the meantime.
Cheers,
Misha
prith-gs commentedon Jul 29, 2024
Hi @misi9170,
I tried creating a new environment and install floris again and I'm still getting the same error.
I'm using miniconda and here's the list of packages I have installed in the new environment I created.
please do let me know if you need any other information. Thanks!
Bartdoekemeijer commentedon Jul 29, 2024
Hi @prith-gs,
What is your

turbine_library_path?misi9170 commentedon Jul 29, 2024
@jfrederik-nrel , @Bartdoekemeijer 's comment above reminded me---was this the same issue I talked about with you a few months back? I recall an issue with loading turbines having to do with a piece of code not correctly building a path when running on Windows
jfrederik-nrel commentedon Jul 29, 2024
I don't think it's the same thing to be honest, I think we resolved that issue. For reference, the issue you are referring to is #873.
misi9170 commentedon Jul 29, 2024
Ah ok, thanks @jfrederik-nrel !
paulf81 commentedon Jul 30, 2024
I added windows back to continuous-integration and there is an issue with Windows for python 3.8 and 3.9,
PR #953
misi9170 commentedon Jul 30, 2024
This does seem to be the issue encountered by @prith-gs , screenshot from one of the failed tests above:

That seems to confirm it's an error specific to Windows OS. We will look into a fix over on #953
prith-gs commentedon Jul 31, 2024
Hello @misi9170 @paulf81 @Bartdoekemeijer
I was indeed using python v3.8.1 and had this issue for FLORIS v4.x and not for v3.x.
Now, when I switched to python v3.11.9, I don't get that error anymore and the example files work properly.
Appreciate the help! :)
Will this be sorted for python v3.8 and 3.9 in further releases? or do I have to switch to python >= v3.10 for FLORIS v4.0 and above?
Thanks!
misi9170 commentedon Jul 31, 2024
@prith-gs ,
Glad that you got this working. Right, the issue here seems to be limited to older python versions (3.8 and 3.9, and likely earlier versions) running on Windows systems. We will likely not try to address this, and shift support to python 3.10 and above. I will discuss with other Floris developers and confirm.
At this stage, do you have a specific need to run Floris with an earlier version of python?
Cheers,
Misha
prith-gs commentedon Aug 1, 2024
@misi9170
I'm working with some inhouse packages which are written for python 3.8 and hence I'm using FLORIS with an older version of python. If it can be modified to work with the previous version that'll be nice, if not it's still fine, we are probably due for an upgrade anyway. Appreciate the help!
BR,
Pritheesh
Bartdoekemeijer commentedon Aug 1, 2024
Yet another reason to upgrade to Python 3.11 or higher: https://docs.python.org/3/whatsnew/3.11.html.
gogannes commentedon Oct 21, 2024
Hey, there.
Thanks for posting this issue! I run into the same issue using python 3.9.
I was first confused as I didn't expect any issue because
setup.pyspecifies the required python version with>=3.8.0.Maybe one could update
setup.pyto take the higher minimum python version for windows into account.The following snippet could help:
Best,
Johannes
misi9170 commentedon Oct 21, 2024
Thanks for the suggestion, Johannes!
Agreed that the versioning listed in setup.py is misleading, and thank you for the suggestion of having platform-depending versions. We've actually recently been discussing moving to relying solely on pyproject.toml, rather than setup.py, for package requirements. At that stage, we may shift to requiring
python >= 3.10across all operating systems, as 3.8 just recently reached end-of-life and 3.9 will be at end-of-life in a year's time.We will try to post updates in this issue thread as we make decisions regarding package management updates and python version support.
Cheers,
Misha
rafmudaf commentedon Nov 18, 2024
I spent some time looking into this and here's what I've found. The issue in FLORIS is located in type_dec.convert_to_path. This function is meant to resolve a truncated path to either an absolute path (i.e. starting with
/Users/...for macOS orC:\Users\...for Windows) or relative path from the Python interpreter's current working directory. The absolute path part works correctly, but the relative path search has a subtle issue (maybe a bug, maybe not, and maybe it's not our fault).To find the relative path, the function uses the
inspect.stackmodule to get the filename of the file that called the current function, and then it will build a relative path from there. The frames in the call stack have the following structure (the details are redacted so you can see the structure):However, since FLORIS uses
attrs, the "filename" for attrs-derived classes is instead a function:<attrs generated init floris.core.farm.Farm>. Since all classes infloris.coreare attrs-derived, I think usinginspect.stack()[1]to create a path will not work. There is a unit test for this, and it passes because it is not testing with an attrs-derived class. That is to say that the code works well, but it is not applicable to the structure of FLORIS classes.#951 (comment) points out that this works for Python 3.10 and above, so why is that and how does this work at all? The different behavior across Python versions is due to a change in
pathlibandos.paththat introduced the concept of "strict" path resolutions and consolidated the path resolving. In Python 3.9,pathlib.Pathhas a Windows-specific Path class and a unique resolve() method. Despite accepting the "strict" argument, the implementation is incomplete because it still checks for valid characters in the path. In Python 3.10, the Path classes for all system types were consolidated and they ultimately use os.path.realpath for Path.resolve. Also in Python 3.10,os.path.realpathgot the "strict" parameter and it was defaulted to False. Basically, in Python 3.10+, an invalid path inPath.resolve()is treated as if it might exist regardless of the content of the path string, whereas in lower Pythons the path string is checked for at least having valid characters.For what it's worth, there have been multiple suggestions to change this behavior in
pathlibfor Python <3.10:A similar backwards compatible change was made for
pathlib.Path.existsin Python 3.8 and Python 3.9, but it did not include the change for.resolve. I plan to propose the change to the CPython maintainers, but I also assume that is a stretch and a very long path.As for FLORIS, I think the fix is to avoid the relative path search from the file of the calling-function. Currently, this will always be an
attrsfunction and it was only "working" due to a nuance in error handling from the Pythonpathliblibrary. I've shown this in https://github.com/NREL/floris/pull/953/files. @RHammond2 @bayc your opinions here would be very valuable (plus @RHammond2 I thought you might enjoy the Python deep dive, as well 😺) since you are more aware of the consequences of how various files are loaded.For what it's worth, I also made a simple repository to show that this is indeed an issue across Python versions for Windows: https://github.com/rafmudaf/windows_path_error/actions/runs/11899793288.
RHammond2 commentedon Nov 18, 2024
Thanks for sharing this comprehensive writeup, @paulf81 ! For what it's worth Python 3.9 is no longer actively supported, and is ending security updates as of October 31, 2025. Moreover, Python 3.8 is officially unsupported, so my thought would be to end support for Python 3.8/9 given it's a 3.8/9 issue. In a couple of other projects where we were upgrading infrastructure, we also made the decision to support 3.10+ in their latest releases.
As for how to handle the
attrsderived relative paths correctly, I don't have any immediate resolutions, but I suspect HOPP/GreenHEART will also encounter this issue because they use a direct copy of this implementation, and so I can share back any solution we create.paulf81 commentedon Nov 19, 2024
Thanks @RHammond2 for your helpful comments!
misi9170 commentedon Mar 11, 2025
Thanks all. Since this issue is not critical, but 3.9 is not yet at end-of-life, I propose that we:
from __future__ import annotationsline that @paulf81 mentioned and possibly moves to thematch/casestructure that @RHammond2 mentioned for model selections and other appropriate areas.I've also added this comment to #953 .
misi9170 commentedon Oct 21, 2025
We have now merged #1079 into develop, which officially drops support for python 3.9 (as well as adding windows and mac OS testing and adding support for 3.10). This will appear on main in the next major FLORIS release (4.6). While this doesn't exactly "solve" the issue for earlier versions of FLORIS, it should mean that the issue does not appear if FLORIS is brought forward to the latest version and requirements are followed, so I'm going to close this issue. Please feel free to reopen if the problem persists after updating FLORIS and using python version 3.10 or greater.