I FINALLY HAVE A GRAPH SHOWING!
So it’s no secret that I enjoy data collection and data analysis. In fact, it’s because of the two that I decided to leave the teaching field in pursuit of an alternate career. I’ve been reading a lot about data analysis but I have yet to get my feet wet with it. I did however attend a Data Science workshop earlier this month that gave me the courage to continue learning on my own.
I found a very basic, very easy tutorial to follow along using the Iris dataset, which is a great starting place for me. I had a lot of issues installing Jupyter because my computer runs Python 2.7 and I was trying to install Python 3.6 without overwriting anything. (I was deathly afraid that I’ll permanently break something and not know how to fix it. Read: What if I messed up so badly that my computer won’t ever start again?!) I read about how you can create a 3.6 environment just for data analysis and how to switch between the two. Big mistake. Way too advanced for someone like me who’s just starting to understand the Jupyter notebook and Kernels.
Bottom line is Jupyter is running on Python 3, so when I tried to pip install libraries, I had to use pip3 install for stuff to use in the Jupyter notebook. For example, I had pandas for Python 2 already but I needed to install it for Python 3 to be able to use it on Jupyter. For some reason, I was under the mistaken impression that Jupyter included all of this in its own little world. As a result, I became very confused with what was causing all these errors like knowing I had pandas but not understanding why I wasn’t able to use it.
Once I had Jupyter running, I was excited to test out what I’ve learned. Unfortunately, I stumbled upon this grave error:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)> . So after researching around, it turns out that Python 3 doesn’t have any certificates and can’t validate any SSL connections. So…the two options are t0 run a post-install script to install certifi or just add in code to import ssl and handle exceptions. I chose the second option. My reasoning? Someone posted the answer. No, seriously. No need to reinvent the wheel. More importantly, I remember learning about exception handling and I’ve rarely found the need to use them. This was the perfect opportunity for me to utilize it and learn a bit more about it. Thus….
_create_unverified_https_context = ssl._create_unverified_context
# Legacy Python that doesn't verify HTTPS certificates by default
# Handle target environment that doesn't support HTTPS verification
ssl._create_default_https_context = _create_unverified_https_context
This is strangely reminiscent of the SCE issue we had with Angular and videos back in our final project days!! (Challenge #2 in https://github.com/annasedlar/Story-Translate).
I would consider this experience a testament to learning how to read documentation in bootcamp. Prior to it, all of these issues combined would have been enough to discourage me from touching Jupyter ever again. Now, I was able to Stack Overflow my way to answers and interpret what I find. If you remember in my previous post of How Coding Bootcamp Changed Me, I used to struggle tremendously with this. I’m still embarrassed to admit how long it took but I finally have a graph showing, so I’m improving! Woo-hoo!! Onto plotting this thing!
This is the magical Stack Overflow post that I consulted: https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error