Saturday, October 31, 2015

Installing Xcode, Python, MacPorts, Pip and more

By now I've figured out that if I'm going to be developing a Python app using a Mac and leveraging a lot of opensource code, I need the following (I'll add to this list as I go):

1. Xcode: Apples Development environment that feature a bunch of dev tools (including swift) and an IDE. Install from here.
2. Python: I am running Mac OS X Yosemite, so it is already installed with python version 2.7.10, which is the latest in the 2.x trail and is more than sufficient for what I'm doing. I may consider upgrading to 3.x later, but good for now.
4. Macports: Is an open source initiative that makes it easy to install open source code in the Mac OS X environment: Download and install from here.
3. Pip: Pip is the PyPa recommended tool for installing Python Packages.

If you are running python version 2.9 or newer, you will already have pip by default. check by typing “pip” at the command line. If you don’t already have pip, follow these steps to install:

1. Copy code from into your local file
Anils-MacBook-Air:Python anilmurty$ touch
Anils-MacBook-Air:Python anilmurty$ tw
Anils-MacBook-Air:Python anilmurty$ 
2. Install as follows:
Anils-MacBook-Air:Python anilmurty$ sudo python

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.
The directory '/Users/anilmurty/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/anilmurty/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB)
    100% |████████████████████████████████| 1.1MB 291kB/s
Collecting wheel
  Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB)
    100% |████████████████████████████████| 65kB 3.5MB/s
Installing collected packages: pip, wheel
Successfully installed pip-7.1.2 wheel-0.26.0
Anils-MacBook-Air:Python anilmurty$ 

3. Confirm Installation:

Anils-MacBook-Air:Python anilmurty$ pip

  pip [options]

  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log                 Path to a verbose appending log.
  --proxy             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries         Maximum number of retries each connection should attempt (default 5 times).
  --timeout             Set the socket timeout (default 15 seconds).
  --exists-action     Default action when a path already exists: (s)witch, (i)gnore, (w)ipe,
  --trusted-host   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert               Path to alternate CA bundle.
  --client-cert         Path to SSL client certificate, a single file containing the private key and
                              the certificate in PEM format.

          Store the cache data in .
  --no-cache-dir              Disable the cache.
                              Don't periodically check PyPI to determine whether a new version of pip is
                              available for download. Implied with --no-index.
Anils-MacBook-Air:Python anilmurty$