Recent intermittent problems using PVLIB and scipy python libraries in cloud9 CS50 IDE

python

#1

Hi there.

I’m hoping someone can help me. About 10 days ago I suddenly started getting warnings and errors in code that has been working fine up until now - written for my final CS50 project. I’ve described the problem in some detail on reddit, so I won’t waste your time going over it all again now (see here: https://www.reddit.com/r/cs50/comments/7i1vlg/problem_using_pvlib_library_and_scipy_in_final/ )

As far as I understand it, my code is unable to find the scipy library…but when I check, the library is definitely installed.

I wondered if there was a problem you know about within cloud9 in using the scipy or pvlib libraries - it seems to be a really recent change, so perhaps something’s changed as a result of your acquisition by AWS?
Anyway, as you can tell I’m a newbie, and I’m really close to finishing the CS50 course - so I’d really appreciate any help I can get in solving this problem.

Many thanks in advance for your help.


#2

UPDATE to this question. I’ve now had responses on other forums (Stack Overflow and GitHub) saying that people are strongly of the view that the problem is in the scipy/IDE part of my stack and not the pvilb library (including some useful input from one of the people maintaining the pvlib library).
So it seems that the problem is to do with the way I’ve got scipy configured inside the Cloud9 IDE.
I posted this question almost a month ago so I’m really hoping that someone from the community, or from Cloud9, is able to take a look and give me some pointers soon!
I thought it would be useful to show the errors I am getting in full here:

Exception ignored in: <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34904), raddr=(‘128.117.149.119’, 80)>
ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34904), raddr=(‘128.117.149.119’, 80)>
Exception ignored in: <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34916), raddr=(‘128.117.149.119’, 80)>
ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34916), raddr=(‘128.117.149.119’, 80)>
Exception ignored in: <socket.socket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34930), raddr=(‘128.117.149.119’, 80)>
ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34930), raddr=(‘128.117.149.119’, 80)>
Exception ignored in: <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34924), raddr=(‘128.117.149.119’, 80)>
ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘172.17.0.30’, 34924), raddr=(‘128.117.149.119’, 80)>
[2018-01-07 16:22:49,786] ERROR in app: Exception on /pv_forecast [GET]
Traceback (most recent call last):
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/location.py”, line 206, in get_clearsky
linke_turbidity = kwargs.pop(‘linke_turbidity’)
KeyError: ‘linke_turbidity’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/app.py”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/app.py”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/app.py”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/_compat.py”, line 33, in reraise
raise value
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/app.py”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/app.py”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/home/ubuntu/workspace/final_project/application.py”, line 201, in pv_forecast
pv_forecast = pv_calc(latitude, longitude)
File “/home/ubuntu/workspace/final_project/pv_forecast.py”, line 52, in pv_calc
fx_data = fx_model.get_processed_data(latitude, longitude, start, end)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/forecast.py”, line 303, in get_processed_data
return self.process_data(self.get_data(*args, **kwargs), **kwargs)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/forecast.py”, line 714, in process_data
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/forecast.py”, line 538, in cloud_cover_to_irradiance
cloud_cover, **kwargs)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/forecast.py”, line 437, in cloud_cover_to_irradiance_clearsky_scaling
solar_position=solpos)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/location.py”, line 211, in get_clearsky
interp_turbidity=interp_turbidity)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/clearsky.py”, line 197, in lookup_linke_turbidity
import scipy.io
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/io/init.py”, line 97, in
from .matlab import loadmat, savemat, whosmat, byteordercodes
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/io/matlab/init.py”, line 13, in
from .mio import loadmat, savemat, whosmat
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/io/matlab/mio.py”, line 12, in
from .miobase import get_matfile_version, docfiller
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/io/matlab/miobase.py”, line 22, in
from scipy.misc import doccer
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/misc/init.py”, line 67, in
from scipy.interpolate._pade import pade as _pade
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/interpolate/init.py”, line 175, in
from .interpolate import *
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/interpolate/interpolate.py”, line 21, in
import scipy.special as spec
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/special/init.py”, line 648, in
from ._ellip_harm import ellip_harm, ellip_harm_2, ellip_normal
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/special/_ellip_harm.py”, line 7, in
from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm
File “_ellip_harm_2.pyx”, line 7, in init scipy.special._ellip_harm_2
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/integrate/init.py”, line 93, in
from ._bvp import solve_bvp
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/integrate/_bvp.py”, line 11, in
from scipy.optimize import OptimizeResult
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/optimize/init.py”, line 241, in
from ._minimize import *
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/optimize/_minimize.py”, line 28, in
from ._trustregion_krylov import _minimize_trust_krylov
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/optimize/_trustregion_krylov.py”, line 2, in
from ._trlib import (get_trlib_quadratic_subproblem)
File “/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/scipy/optimize/_trlib/init.py”, line 1, in
from ._trlib import TRLIBQuadraticSubproblem
File “messagestream.pxd”, line 5, in init scipy.optimize._trlib._trlib
File “messagestream.pyx”, line 5, in init scipy._lib.messagestream
ImportWarning: can’t resolve package from spec or package, falling back on name and path

Thanks in advance for your help.
Best regards,
Matt