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
{{ message }}
Repository navigation
spa_c_files don't build with VC14 (Python 3.5) #168
It's been a long time since I used spa_c, and I don't have any experience with Visual Studio, so I don't have any hints for you there. However, I'll point out that the benchmarks in #48 show that spa_python+numpy and spa_c are essentially the same speed, and spa_python+numba is significantly faster than spa_c. As with many benchmarks, your mileage may vary.
No I'm still looking into it, I just ran it again in a fresh Python-3.7 environment, and I still get the exact same error, so no I don't think we should close it just yet, b/c we need to consider if we want to include spa-c-files at all, if we close this issue, then we should remove the folder, and be done. Maybe this can become a standalone project, perhaps I can add it to SolarUtils and try using ctypes instead of cython?
One thing, we can definitely delete the spa_py.c file from the repository, as this is a cython generated file, and was probably committed by accident.
Thanks for checking Mark. I'd be happy to see it move to another repository. We could still keep the wrapper option in pvlib.solarposition.py just like we do for pyephem.
I believe we include spa_py.c because it allows people to compile the package with only a c compiler and not cython.
I don't think that works, that file spa_py.c is generated by cython and requires cython to compile. Anyway, it doesn't work.
I just compiled spa.c, spa.h, and spa_tester.c to spa_tester.exe using visual studio 2015 (which AFAIK is used on Windows for Python >3.5) and it really does work,
Details
>cl /Fobuild\ /Febuild\spa_tester.exe spa.c spa_tester.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726for x64
Copyright (C) Microsoft Corporation. All rights reserved.
spa.c
spa_tester.c
Generating Code...
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:build\spa_tester.exe
build\spa.obj
build\spa_tester.obj
>build\spa_tester.exe
Julian Day: 2452930.312847
L: 2.401826e+01 degrees
B: -1.011219e-04 degrees
R: 0.996542 AU
H: 11.105902 degrees
Delta Psi: -3.998404e-03 degrees
Delta Epsilon: 1.666568e-03 degrees
Epsilon: 23.440465 degrees
Zenith: 50.111622 degrees
Azimuth: 194.340241 degrees
Incidence: 25.187000 degrees
Sunrise: 06:12:43 Local Time
Sunset: 17:20:19 Local Time
so I think the issue is in the supporting Cython code: cspa_py.pxd and spa_py.pyx, maybe I can figure out (haven't yet), but It might just be easier to drop cython and just use ctypes or cffi, if cython is the issue. Anyway, that would be a concern for what ever project then picked this up, if you decided to boot it, which I'm in favor of to expedite closure of this issue. 😉
OK, I figured it out, but I'll never understand why. For some reason, Cython does not like the keyword timezone which is okay with VisualStudio but not Python.
Replacing timezone with time_zone everywhere solves the problem
I have exactly the same problem, but I don't think that Cython is to blame. I am using cffi in combination with the original spa.h and spa.c, so without Cython.
Activity
wholmgren commentedon May 13, 2016
It's been a long time since I used spa_c, and I don't have any experience with Visual Studio, so I don't have any hints for you there. However, I'll point out that the benchmarks in #48 show that spa_python+numpy and spa_c are essentially the same speed, and spa_python+numba is significantly faster than spa_c. As with many benchmarks, your mileage may vary.
wholmgren commentedon Sep 12, 2018
@mikofski ok to close this? while it may still be a bug with pvlib it may now be irrelevant after 2 years of default tooling changes
mikofski commentedon Sep 12, 2018
No I'm still looking into it, I just ran it again in a fresh Python-3.7 environment, and I still get the exact same error, so no I don't think we should close it just yet, b/c we need to consider if we want to include
spa-c-filesat all, if we close this issue, then we should remove the folder, and be done. Maybe this can become a standalone project, perhaps I can add it to SolarUtils and try using ctypes instead of cython?One thing, we can definitely delete the
spa_py.cfile from the repository, as this is a cython generated file, and was probably committed by accident.wholmgren commentedon Sep 12, 2018
Thanks for checking Mark. I'd be happy to see it move to another repository. We could still keep the wrapper option in
pvlib.solarposition.pyjust like we do for pyephem.I believe we include
spa_py.cbecause it allows people to compile the package with only a c compiler and not cython.mikofski commentedon Sep 12, 2018
I don't think that works, that file
spa_py.cis generated by cython and requires cython to compile. Anyway, it doesn't work.I just compiled
spa.c,spa.h, andspa_tester.ctospa_tester.exeusing visual studio 2015 (which AFAIK is used on Windows for Python >3.5) and it really does work,Details
so I think the issue is in the supporting Cython code:
cspa_py.pxdandspa_py.pyx, maybe I can figure out (haven't yet), but It might just be easier to drop cython and just use ctypes or cffi, if cython is the issue. Anyway, that would be a concern for what ever project then picked this up, if you decided to boot it, which I'm in favor of to expedite closure of this issue. 😉wholmgren commentedon Sep 12, 2018
It was supposed to work like this from the cython docs.
Maybe the upcoming SSC release will make this wrapper pointless.
I say we continue to ignore it for now.
mikofski commentedon Sep 12, 2018
OK, I figured it out, but I'll never understand why. For some reason, Cython does not like the keyword
timezonewhich is okay with VisualStudio but not Python.Replacing
timezonewithtime_zoneeverywhere solves the problemwholmgren commentedon Sep 12, 2018
How did you find that???
Do you want to sneak this into 0.6.0? I'm going to let #575 sit until tomorrow.
BUG: ENH: update spa_files to patch timezone bug
mikofski commentedon Sep 12, 2018
wholmgren commentedon Sep 12, 2018
take your word on it
ok with me, but update the readme in that subpackage accordingly.
mikofski commentedon Sep 12, 2018
here's the test output, LGTM:
ENH: ignore cython generated spa_py.c file
BUG: ENH: update spa_files to patch timezone bug (#576)
solarjoe commentedon Nov 26, 2018
@mikofski
I have exactly the same problem, but I don't think that Cython is to blame. I am using cffi in combination with the original
spa.hand spa.c, so without Cython.Any idea what might be the reason then?
solarjoe commentedon Nov 27, 2018
Nevermind, found it :)
https://bugs.python.org/issue24643