TIL how to install packages using Anaconda Navigator

To do my web crawling, I started using Selenium,which is a Python module for doing web crawling.

I installed it from my command prompt by doing ‘pip install selenium’, and Selenium was working just fine in PyCharm and Python shell. But when I tried doing ‘import selenium’ in a Jupyter notebook, I kept getting a module not found error.

It turned out to be a Python path issue. In short, Selenium had already been installed, but Jupyter could not import Selenium because it wasn’t pointing to the path where Selenium had been installed.

The usual digging led me to this helpful thread, but in the end I couldn’t get Selenium to work on my Jupyter notebook by following the instructions provided.

Fortunately, an intern told me about Anaconda Navigator, a GUI-based application that could be used to install packages for the (virtual) environment running Jupyter notebook. As long as you have anaconda installed, you just had to run the below command to install Navigator:

So I tried searching for the Selenium package on Anaconda Navigator, but the search returned no results.



After doing some digging, I came across this site that had a piece of code I could run to get Selenium:

conda install -c conda-forge selenium

After running this code in my command prompt, I got selenium to work on Jupyter notebook!

Now I could use Selenium and Chrome Driver in a Jupyter notebook just fine.


TIL that I need to keep up

Since my coding skills are not yet good enough, I do need to keep up and improve. The things I can currently do are pretty limited in scope, and I certainly hope to improve a lot faster. I intended to stay at the office a little after work and practice and learn, but my brother called asking when I’m going to be home. Turns out we were eating 삼겹살 (samgyeopsal) tonight, and I sure as hell wasn’t going to miss that. Again.

After dinner, I worked on the measure word extractor some more. I essentially started from scratch. I was so surprised that I could focus a lot better, working on this at home. Need to concentrate more at work. I did some googling and found out how to list the directory properly using os.listdir.

I got to the part where I needed to run a for loop on the files in the directory list, read each file, and put the lines into a list, but it just wouldn’t work. Lots of googling later, I came across an online book called Python for Informatics, which looked like a useful book.
(EDIT: There seems to be an updated version of the book. Check it out here. It referenced Think Python, another excellent free resource. In fact, I’ve been thinking about picking up a book on Python to read. I of course know that merely reading a book on coding won’t make me improve all that much. But the point is that I can’t watch stuff like Udemy on the bus to work, and when I get home, I have other stuff to do. I wanted to get an overview of Python and one way to do that is to just read through a book or two. My intention isn’t to remember everything; rather, I just want to be exposed to what Python is in its entirety. Just a sweeping overview, so I get what I need to learn further.

Well, I guess today I learned a few things about the os module. I think working through that Python for Informatics will definitely be helpful in learning more.