Setting up Python for GPT Training
I've been doing some refresh "homework" on engineering work I haven't done in 20 years. One of the tools I've been working with is an AI agent to fast track my knowledge collection. Basically I go through an example activity, get a chat AI agent to build a reading list, convert that a markdown text file, and save the markdown file in Drafts. In the evening I covert the markdown to a PDF that I can read on the couch on my iPad.
One of the rabbit holes I went down recently is getting a "daily briefing" of everything I needed for tomorrow in a single information nugget - meetings, task that are due, etc. I want to use my Mac mini as an automation hub to run a series of scripts to collect different sources of information and put them into a single markdown file. The step I was working on was the conversion of markdown to HTML or rich text. The goal is to use a Python script that will take a markdown file, convert the markdown text to rich text format, and then copy it to the clipboard. I would append various snippets from different sources into a holding document to be emailed or texted to myself.
I got a working version of the Python script, but got the following errors when I ran the script:
mygeekdaddy@MBPM5:~ % ~/Dropbox/bin/Python/OF_markdown.py Missing dependency: markdown. Install with: python3 -m pip install markdown mygeekdaddy@MBPM5:~ %
Huh... maybe I forgot to install the markdown package for Python. I tried various package installers to install the missing Markdown package. Each time I got a variation of this:
mygeekdaddy@MBPM5:~ % brew install markdown
Warning: markdown 1.0.1 is already installed and up-to-date.
To reinstall 1.0.1, run:
brew reinstall markdown
mygeekdaddy@MBPM5:~ %
mygeekdaddy@MBPM5:~/Python % python3 -m pip install markdown
error:
× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to install.
If you wish to install a Python library that isn't in Homebrew, use a virtual environment:

Desktop, Music and Documents called Python.
3. Navigate to the folder and run python3 -m venv envname. The term envname will the name you give your working Python environment. In case I just used Python_Dev.
4. Congrats... your virtual Python environment is ready for you.
#### Activating a Python virtual environment
1. Open Terminal app and navigate to the Python development folder at ~/Python
2. Activate the environment by entering source envname/bin/activate. The \ will be the name/title of the virtual environment you previously created. Once you activate the virtual environment, your terminal prompt should change from something like this:
mygeekdaddy@MBPM5:~/Python %
To a prompt like this that includes your virtual environment in parentheses:(Python_Dev) mygeekdaddy@MBPM5:~/Python %
3. Now you can use a package manager to install Python packages likemarkdown or pandocs: pip install \pip install markdownbrew install pandoc.
To exit the virtual environment, just type deactivate and you will be back to a normal prompt.
Using this environment allows me to run Python scripts and install packages that don't conflict with macOS package manager.
Previous posts:
-
Migrating Keyboard Maestro to Windows
New job, new workflow. I finally figured out how to get my date snippets to work on Windows.
-
macOS won't let me format my own drive
I needed to "fix" macOS to allow me to format an external drive for my music library.
-
Working Shortcut to create Apple Music playlists
A working version of an iOS Shortcut to create music playlists
-
Waiting for Outlook to join the AppleScript club
Microsoft announced 1503 days ago that AppleScript was coming to Outlook
-
Using Apple Music and ChatGPT to recreate playlists
Learning a few tricks to get ChatGPT to recreate my Apple Music playlists...
