15 Days of Data / Round 2

Monday June 12, 2021



CRASH!

r/ProgrammerHumor - How I spend my time in Python

Bang!

Okay…I’ve hit my first real speed bump! I’ll try to explain it. I am learning these concepts through experience and contact.  So, at times, I will give my impression, which may not be exact. However, I will try to be precise about things I don’t know. I hope that this is a formative learning experience. I will be slowly reading through documents and various online explanations and will try to link to the most helpful sites that I find.

All I know is that it has to do with packages and installing them and what happens when you have different versions of python and where everything is located.

First, I have to say that I am pretty sure that it had to do with a Homebrew update. I am learning what I can about these package installations and I understand that Homebrew is a free and open source package manager for macOS and pip is the Python package manager. Now, I know this is systems architecture and we need to know how things work and learn precisely what things we can and should be able to manipulate.


Boom!

This is like entering the jungle for most of us newbs who have just recently taken programming seriously and who maybe have a substantial amount of projects under our belt. It took us a lot to get to where we are and maybe less attention has been paid to adjacent issues such as the situation of our global system. Of course, I know Linux commands and how to navigate and manipulate files and directories and the terminal. Yet, there are some sophisticated relationships in the inner workings that give me the cold sweats. You never know when a tiger might leap from under the brush and take you down. You would be left just wishing you’d never been curious about anything at all. You should have just stayed under your bed and locked the door…didn’t they tell you the world out there is dangerous?

Okay, but I want to learn about things and the only way is by doing. So, I installed a package last night through Homebrew. No biggie! Yes, I usually install with pip but I’m a big boy and I have Homebrew and kind of know what is. So, the package I want is not available on pip and that is why we have Homebrew…right? Well…kind of.

Hombrew asks me if I want an update and I say yes. I haven’t used it in a while and everything is always updating and I am not conscious of anything thing that could happen if my package manager updates. There are no tigers in Hombrew. (Mind you, I haven’t updated my macOS to Big Sur yet due to concerns about changes to the system that might require my full attention. I’ve been waiting to make sure the bumps have smoothed out.)


When I discovered today was not a good day

The install through Homebrew was one of the last things I did before going to bed. So, I open it today and start up Jupyter Lab. I really like Jupyter lab because it is so much easier to manage what is in your directory. But I get:

Exception: Jupyter command 'jupyter-lab' not found.

I always make mistakes in spelling with the ‘p’ and the ‘y’. So, make sure that I spelled it right and I cut and paste the command. But I get the same message. No problem, I tell myself, I’ll put in Juptyer Notebook. I receive the same message telling me jupyter notebook is not found. How can I work with this? Did something bad happen to my jupyters. I installed a few things last night while trying to be careful. Maybe something mysterious changed in my system from one of the installtions.

Then, I decided to check my packages. That was when I knew I wasn’t going to be working today. There were no package except for the ones included in the initial download.

I understand that the more experienced out there probably have connected the dots. But this is a discovery process for me and the connections are not being made immediately. But I decided to stay calm and take my time and learn everything I could to get back to my previous state.


What I discovered when I looked under the hood

So, if I had gone back to look at the traceback errors closely maybe I would see something informative. So, I did and strangely enough I see the path to jupyter is /usr/local/bin/jupyter. So, it is confirmed that I have jupyter somewhere, but now I don’t know if I broke something or what. I try to find where pip and homebrew install my packages and I find I should use the command:

~ python -m site

Which gives me a direction and I should enter the next command:

~ ls -l /Library/Python.2.7/site-packages

But this is the native version of Python and of course I don’t find much because I don’t use this version. So, I try the python I usually use:

~ python3 -m site

And I follow with:

~ ls -l /usr/local/lib/python3.9/site-packages

I should have already caught the problem but now. But was still in exploring mindset and less observant. All I know is that there was nothing here except a few packages and they had all been modified the night before when I downloaded Homebrew.


 When I connected it all

I came to the conclusion that installing the package with  Homebrew and the update was the cause. But, I was still not fully conscious of all the details. And because I know that jupyter is somewhere on my system I decide to make a search through all the files on my computer. I have to use superusers privledges and the wild card character * :

~ sudo find / -type f -name "*jupyter*"

This was one of the paths that came up in the search:

/usr/local/lib/python3.8/site-packages/

Wait, had I over looked this! Yes, I did. My eyes are sometimes a little lazy. That says 3.8. In fact, the only two versions of Python that I have in mind are 2.7 because it is the native macOS version that I don’t use and 3.8 because it is the only version I have ever used. 3.9 is the monkey that has come down from the tree to trick me. Now, when I enter this:

~ ls -l /usr/local/lib/python3.8/site-packages/

All of my packages are there pandas and numpy and sklearn and JUPYTER! The default version of python had been switched to the newer version after I updated Homebrew which included a python update. So, all I need to do is change my default python back to the previous version and everything will be okay. The planets will be in harmony and all evil will leave this Earth. The tigers will make friends with the lambs and my chakras will stop itching me.

 

…..to be continued…..but here is a spoiler.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *