I had downloaded Canopy at the insistence of the instructors of MIT’s introductory course on computer science using Python. That said, I rarely ever used it. I’ve all along been working on Python using a text editor and command line only. I also downloaded Anaconda and started working on IPython since I began working on a new machine learning MOOC offered by the University of Washington via Coursera. Anaconda is awesome! It has all the best scientific libraries and I love IPython compared to PyCharm or Canopy, which pale in comparison to IPython, especially if you’re using Python for Machine Learning.

Anyway, I was working on IPython, trying to importmatplotlib, when I got the following ImportError:

I noticed that the matplotlib library was trying to be accessed in Canopy’s Enthought directory. Since I never used or liked Canopy anyway, I decided to uninstall, bitch!

Step by step process of uninstalling Canopy from Linux:

1) From the Canopy preferences option in the Edit menu, mark off Canopy as your default Python (this step is not available on very early versions of Canopy).

5) Delete the file “locations.cfg” from each user’s Canopy configuration / preferences directory. For complete Canopy removal, delete this directory entirely; if you do so, the user will lose individual preferences such as fonts, bookmarks, and recent file list.

cd ~/.canopy
cd ..
rm -rf .canopy

6) If you are uninstalling completely, edit the following files to delete any lines which reference Canopy (usually, the Canopy-related lines will have been commented out by step 1 but on some system configurations the lines might remain):

I recently had to edit the .bashrc file in Ubuntu and comment / delete a subset of its contents. The file .bashrc had to be located (home directory) and opened in a text editor. The file isn’t visible in the desktop environment, so it can’t be opened from there, so I had to use bash. I’m no command line expert, so I used Python to open and edit the file. I intended to open the file in gedit text editor, so I had to run Python from the directory containing .bashrc. [Click image below to enlarge]

Which opened up .bashrc

Put simply:

Opening a file in text editor is a matter of two simple lines of code. First, navigate to the directory containing the file you wish to open in a text editor (such as gedit) in bash or terminal or CMD. Then type the following:

$ python
>>> import sys, os
>>> os.system("<text editor> <file name with extension>")
That’s all there is to it!