Download Anaconda Mac

admin

Confusion and errors from many alternatives and options

  1. Download Anaconda Navigator Mac
  2. Download Anaconda Macos
  3. Download Anaconda Python 2.7 Mac
  • Folders Python on CLI
  • Python 3 vs. 2
  • Start a HTTP Server Using Python
  • Upgrade Python
  • Upgrade pip and setuptools
  • Virtual Environments
  • PIP (Python Installation Packager)
  • Python 2 executables
  • .bash_profile config
  • Scripting Python versions
  • Conda

This tutorial describes the different options to install anduninstall Python within variouspackage managers (which helps you find and install Python packages).

Installing on macOS. Download the graphical macOS installer for your version of Python. RECOMMENDED: Verify data integrity with SHA-256. For more information on hashes, see What about cryptographic hash. The installer describes the partnership between Anaconda and JetBrains and provides a link to install PyCharm for Anaconda at. Download the Anaconda distribution from the Continuum Analytics. We focus on the installation and configuration process for Pandas on a Mac machine. This website uses cookies to ensure you get the best experience on our website.

Here I’m taking a “deep dive” approach because I haven’t seen one on the internet.

I’ve pulled out the various incantations suggested by others on StackOverlowand put them here in context.

TL;DR Summary - It’s a mess

The version of Python that comes with Apple MacOS is obsolete and needs to be updated along with Apple XCode CLI for the MacOS version you’re using.

There are two separate versions of Python: 2 and 3. some Python functions in one version do not work with commands in another version.

This has given rise to several versions of Python frameworks being maintained in parallel. For example, the web application development framework exists as Django 1.3 and Django 1.0.

Adding to the confusion is that various methods of installing Python are incompatible with each other.This has given rise to the need for package managers such as pip (Python Installation Packager) that enable one to switch among different versions of Python installed.

pip (Python Installation Packager) is built on top of setuptools whichis what downloads and installs Python packages from the PyPI (Python Package Index) library online at https://pypi.org.

Setuptools itself is installed using easy_install.

MacOS does not come installed with a package manager for Python.

This complexity necessitates the packaging of whole virtual environments to isolatewithin a folder (directory) everything (all dependencies) that each Python project (application) needs to run.This means duplicated files for each Python application, which consume more disk space.

An additional complication is that there are several alternative virtual environment packagers such aseasy_install, virtualenv, and pipenv.

  • pip (Python Installation Packager) is a package manager.
  • Virtualenv (venv) is an environment manager for Python.
  • Conda does both, and is language agnostic (not just for Python).

  • Miniconda is a lightweight distribution of Conda, and uses conda commands.
  • Anaconda is installed on top of miniconda to provide a curated collection of over 720 “common” packages for scientific Python users.

It’s a “hot mess”.

Despite all this hassle around versioning, Python is the preferred language of Artificial Intelligence and Machine Learning at the forefront of computer science innovation today.The heavy use of math in AI and ML by TensorFlow means it’s best to install Anaconda and use conda commands (instead of Miniconda or pip with virtualenv).

IPython (Jupyter) Notebook enables a “notebook” interface to re-run commands.See http://sjbyrnes.com/python/

PIP install is troublesome, often because they are more recent than those in Conda.

Python Install Options

There is what can be a confusing conflict of choice here for installing Python and its package manager.

  • Not recommended is the manual approach of download Python installer from python.org, even though that’s the method described in various websites and books.

  • easy_install is an environment manager.

One writes: “Avoid easy_install or pip to install a Python package that needs a library used by non Python programs, such as Qt bindings (PySide)”.

Alternatively, use a package manager. CAUTION: MacPorts, Fink, and Homebrew do not coexist well on the same machine.

  • Install using Homebrew, then add homebrew science for scientific work (according to this).

  • MacPorts is an alternative to Homebrew some claim is more compatible with other Linux. However, not all packages are available in MacPorts.

Use Docker

  1. From Dockerhub account “python” get a Docker image on your machine containing Python3 running within Alpine Linux OS:

  2. Container:

  3. Execute the container:

  4. Use the container

  5. Stop the Docker instance:

Obsolete Python comes with MacOS

Download anaconda for machine learning

Ever since the Mavericks version of Mac OSX,Python 2 comes installed on MacOS machines.

(Use the index at the right if you want to jump ahead)

  1. Open a Terminal shell window and issue command:

    The response, for example:

    CAUTION: The sub-version of Python that comes installed with MacOS may be obsoleteand needs to be upgraded.But keep to version 2, not version 3 of Python.

  2. Find where Python2 is installed:

    The response:

    You may also see the following if you’ve installed a shim to enable switching of Python versions:

Folders Python on CLI

  1. List your present working directory:

    pwd

    We next use a Python interactive command to obtain this again.

  2. Open a Python command-line prompt:

    python

    The response shows that version 2 comes with MacOS:

    The response on a new El Capitan machine:

    >>> is the Python interpreter prompt.

    Don’t enter or copy >>> when typing or copying Python commands.

    Current Working Directory

  3. Display Python’s current working directory:

    >>> import os
    >>> os.getcwd()

    In the response, the “mac” user name is substituted with your user name:

    The above should be the same as the path obtained from pwd before entering Python.

  4. Futhermore…

    >>> import os, sys
    >>> os.path.dirname(os.path.abspath(sys.argv[0]))

    The response is your home folder (substitue “mac” with your user name):

    ‘/Users/mac’

    Exit Python

  5. Exit the Python interpreter by typing the exit function (with the parentheses symbols) :

    exit()

    The exit() commmand works the same for both Python 2 and Python 3.

    Using Python 3

  6. After installing Python3, obtain the Python 3 command line with:

    python3

    The response I got:

Python 3 vs. 2

Since 2018, many say “all new Python code should be written for version 3.There are so many new features in Python 3 that it doesn’t make much sense to stick with Python 2 unless you’re working with old code.”

Most new features introduced with Python 3 are not backwards compatible with version 2.

Where are Python executables?

  1. Python3 is installed in a different folder than Python 2.

    The response:

  2. Get the location where Python is installed:

    which python
    which python3

    • Python v2 is installed in /usr/bin/python
    • Python v3 is installed in /usr/local/bin/python3
      If you get /Users/user/.pyenv/shims/python3

    Python command for Python3

    Some prefer to If you want If you tried to commit suicide like the above, the work-around is an alias,which the operating system resolves before going down PATH.

  3. To use Python3 as the default version for the python command, set in you Mac’s ~/.bash_profile

Print is different

For the most part, Python 2 code works with Python 3.

Where Python 2 code fails most often is the print statement.Printing in Python 2 is done like so:

The response:

Hello world!

If you input the above in Python 3, the response is:

SyntaxError: Missing parentheses in call to ‘print’

This is because Python 3 uses a function:

So in Python 2.6+, use the future module to back-port:

Try this:

The response:

Floating point

In Python 2, type in the REPL:

The response is:

In Python3, type:

The response is:

Python programming code

  1. Download or view a Python program:

    By convention, Python programming source files have a file suffix of .py regardless of the version.This is because, unlike on Windows, Linux looks at the first line of script files to identify what program is used to run the file.

    The “shebang” first line in Python 2 programs start with:

    This is an absolute file system path because the executor doesn’t look on the $PATH for the program defined in ~/.bash_profile.

    The “shebang” first line in Python 3 programs start with:

    env is an executable file from virtualenv.

Start a HTTP Server Using Python

A simple HTTP server service can be started with this Python 2 command:

python -m SimpleHTTPServer

For Python3:

python3 -m http.server

The response:

CAUTION: Hitting Ctrl-C on a Mac, does not shutdown the server gracefully, and the binded address will still be in use.

TODO: Add port designation in command line.

File handling using Pathlib

  1. To create a new folder using Python3: TODO:

  2. To create a new file using Python3, import the pathlib module’s Path object:

Don’t Uninstall Default Python on macs

The version of Python that comes with Mac OSX should not be removed because some Apple system software have hard-coded references to it.

In this bad advice to harm yourself:

  1. Elevated privilages (sudo) are necessary to remove Python from your Mac

  2. Remove symbolic links pointing to the python version:

  3. Remove references to deleted paths in PATH environment variable within shell profile files.
    Depending on which shell you use, any of the following files may have been modified:

  4. List symbolic links pointing to the python version:

    On El Capitan, this should display: a sym link such as:

    Or if instead you followed some bad advice and see something like this:

  5. List symbolic links pointing to the python version:

    Response:

    The “././” means that it’s above your HOME folder, in the root of the Mac OS.

  6. So let’s go there:

    There are the executables “python” and “python2.7” plus others.

  7. Run:

    The response:

  8. Exit

  9. Run the generic python generically:

    The response is a newer Python:

  10. List symbolic links pointing to the Python version:

    According to this:

Upgrade Python

  1. Install XCode CLI.

Download Python installer

If you must do it the hard way, bareback, etc:

  1. In an internet browser at
    https://www.python.org/downloads/mac-osx

  2. Click the Latest link at the top or a
    specific “Mac OS X 64-bit installer” for macOS 10,9+.

    FileDateDownload
    python-2.7.15-macosx10.9.pkg2018-05-0122.7 MB
    python-2.7.12-macosx10.6.pkg2016-06-2521.3 MB
    python-2.7.11-macosx10.6.pkg2015-12-0521.1 MB
    python-2.7.10-macosx10.6.pkg2015-05-2321.1 MB
    python-2.7.09-macosx10.6.pkg2014-12-1021.0 MB
    python-2.7.08-macosx10.6.pkg2014-07-0219.4 MB
    python-2.7.07-macosx10.6.pkg2014-05-3119.4 MB
    python-2.7.06-macosx10.6.pkg2013-11-1019.2 MB

    This table shows the growth in download size over time,an analysis unique to this page.

Upgrade pip and setuptools

Install pip homebrew without setuptools

Instead of following instructions such as this with:

pip install -U pip setuptools

BTW, on Windows it’s:

python -m pip install -U pip setuptools

  1. On a Mac use the Mac system package manager Homebrewto install pip (as recommended by this siteand https://pip.readthedocs.io/en/stable/installing):

    brew install pip

    Conda installs outside the standard structure, so

  2. Run:

    brew doctor

    this warning appears (which can be safely ignored):

QUESTION: Is there a way to suppress these messages?

Requirements.txt

In a GitHub repo cloned locally,if you see a file Requirements.txt, it is likely a list of Python packages needed by the application:

Notice each specific version is specified.

  1. In a Terminal shell window, change the directory to where app resides.

  2. Just for laughs:

    pip install

    The response:

    The use of the word “requirement” in this message is partly why lists of Python package dependencies are in a requirements.txt file.

Di

  1. Get a Python 2.7 installed. For example, at:

    ./Cellar/python/2.7.12_2/bin/python2.7

  2. Verify the sym link:

    The response:

  3. Edit ~/.bash_shell to add a shell alias:

  4. Close and open another Terminal.
  5. Verify the version.

    The response should be the newer sub-version:

Virtual Environments

Examples of instructions for installing a requirements.txt file are typically preceded by a source bin/activate command which executes the activate script in the project’s bin folder.

An activate script is placed in each virtual environment established to store different sets of dependencies required by different projects in separate isolated locaations.

This solves the 'Project X depends on version 1.x but, Project Y needs 4.x' dilemma, and keeps your global site-packages directory clean and manageable.

Before the pip install command: Automatically download the packages listed (after you manually change the /path/to)

source bin/activate
pip install -r /path/to/requirements.txt
</strong>

This downloads dependencies from PyPI (the Python Package Index), a public repository of software for the Python programming language at https://pypi.python.org/pypi.

However, adding the “--no-index” option would not use it.

NOTE: pip compiles everything from source if a “wheel” is not available for it. Wheels are a pre-built distribution format that provides faster installation compared to Source Distributions (sdist), especially when a project contains compiled (C language) extensions.

pip install --use-wheel package

### pip scikit-learn #

  1. In a Terminal on any folder, globally install dependencies libraries:

    pip install -U scikit-learn

  2. Edit the Python script to add at the top:

    pip iPython Jupyter

  3. iPython is the kernel of Jupyter.

    pip install ipython

Virtualenv and Docker

  • Don’t pip-install anything beyond virtualenv into its global site-packages.

  • Install both virtualenv and system isolation (they are not mutually exclusive):

    • Isolate your application server’s OS from its host using Docker/lxc/jails/zones/kvm/VMware/… to one container/vm per application.

    • inside of them also do isolate your Python environment using virtualenv from unexpected surprises in the system site-packages.

Remove hassles from managing per-project virtualenvs by using one of these, depending on the shell and operating system used:

  • virtualenvwrapper
  • virtualenvwrapper-win on MS Windows

PIP (Python Installation Packager)

As of Python 2.7.9 and Python 3.4.x, python.org installers for OS X install pip as wellfrom Activestate.com and download ActivePython. It’s a simple install that gives you both Python and pip.

According to https://www.python.org/download/mac/tcltk/,download fromhttp://www.activestate.com/activetcl/downloadsfile ActiveTcl8.6.3.1.298624-macosx10.5-i386-x86_64-threaded.dmg

After install, the ActiveTcl User Guide is popped up.

Jesse Noller notes inSo you want to use python on the Mac:

“Now, some people may recommend you install Macports or Fink: these are both “sorta” package managers for OS/X, and while I do have Macports installed, I do not use it for Python work. I prefer compilation and self management.”

Easy_install

Others use easy_install (with setuptools) to install packages from the web.

Download Anaconda Navigator Mac

sudo easy_install pip

The response:

Virtual pip environments

The best way to have painless and reproducible deployments is to package whole virtual environments of the application you want to deploy including all dependencies but without configuration.

In the world of Python, an environment is a folder (directory) containing everything that a Python project (application) needs to run in an organised, isolated fashion.

When it is initiated, it automatically comes with its own Python interpreter

  • a copy of the one used to create it - alongside its very own pip.

The ability to work with either version 3 or 2.7 on the same machine is neededbecause, as this MacWorld articlepoints out, Mac Mavericks and Yosemite are installed with Python 2.7,cannot run python3 scripts.

You can work on a Python project which requires Django 1.3
while also maintaining a project which requires Django 1.0.

It’s done by creating isolated Python environments usingvirtualenv (Virtual python environment builder).

sudo pip install virtualenv

As the reponse requests, activate:

source /usr/local/opt/autoenv/activate.sh

This does not issue a response.

  1. Instead of 'venv', substitute your project name to to create:

    cd my_project_folder
    virtualenv venv

    Exclude the virtual environment folder from source control by adding it to the git ignore list.

  2. List all virtual environments:

    lsvirtualenv

  3. To use a particular Python interpreter:

    virtualenv -p /usr/bin/python2.7 venv

  4. Activate your project:

    source venv/bin/activate

    The name of the current virtual environment should now appear on the left of the prompt (e.g. (venv)Your-Computer:your_project UserName$).

    From now on, any package that you install using pip will be placed in the venv folder, isolated from the global Python installation.

    autoenv

  5. To automatically activate an vironment when you cd into it:

    brew install autoenv

    The response:

  6. Install packages as usual, for example:

    pip install request

  7. When you are done working in the virtual environment for the moment:

    deactivate

    The above puts you back to the system’s default Python interpreter with all its installed libraries.

  8. To delete a virtual environment, delete its folder. In this case, it would be:

    rm -rf venv

  9. To keep your environment consistent,

    freeze

    the current state of the environment packages:

    pip freeze > requirements.txt

    This creates (or overwrites) a requirements.txt file containing a simple list of all the packages in the current environment and their respective versions. This file would make it easier to re-create the environment andto install the same packages using the same versions:

    pip install -r requirements.txt

    This ensures consistency across installations, deployments, and developers.

As noted in http://docs.python-guide.org/en/latest/dev/virtualenvs/this create a folder in the current directory containing the Python executable files, and a copy of the pip library which you can use to install other packages. The name of the virtual environment (in this case, it was venv) can be anything;omitting the name will place the files in the current directory instead.

  1. Open an internet browser to https://www.python.org/downloads/and download file python-3.4.2-macosx10.6.pkg.

    See http://docs.python-guide.org/en/latest/dev/virtualenvs/https://www.digitalocean.com/community/tutorials/common-python-tools-using-virtualenv-installing-with-pip-and-managing-packages

  2. To list what packages have been installed:

    pip list

  3. Look for packages by keyword:

    pip search django

Use pip to install Tensorflow

As Siraj shows in his video, on a Mac Terminal,define an environment variable that points to the download URL:

(This is for Python 3 on a Mac.)

Install it using PIP and the variable:

Vagrant

This explanation forks another.

Setup a provider VM solution to store the image (like VMware, AWS, Hyper-V).https://www.virtualbox.org/wiki/Downloadsclick “x86/amd64” next to VirtualBox 4.3.20 for OS X hoststo download VirtualBox-4.3.20.96.dmg (109 MB)Read the 368 page User Manual.

Install https://github.com/dotless-de/vagrant-vbguestto keep VirtualBox guest additions up to date.http://schof.org/2014/03/31/working-around-virtualbox-bug-12879/

In the Finder, in the Applications folder, drag and drop it onto your Dock for quicker use later.Double-click on VirtualBox for the VirtualBox Manager.

Download the 224.3 MB vagrant_1.7.1.dmg

The binary gets installed in the Applications folder with a link to the /usr/bin so it is added to the shell path.

List commands:

vagrant
vagrant list-commands

Change directory to where you want to store the Vagrant project and run

vagrant init

The response:

A Vagrantfile has been placed in this directory. You are nowready to vagrant up your first virtual environment! Please readthe comments in the Vagrantfile as well as documentation onvagrantup.com for more information on using Vagrant.

ls

This shows Vagrantfile (with capital V).

https://www.vagrantup.com/downloads.html

https://vagrantcloud.com/boxes/searchlists boxes created by the community.

I am pulling the box from ATT M2X https://m2x.att.com/developer/sample-codeThis Repo provides a Vagrant virtual machine that contains several demo applications (Ruby and Python) that report data to AT&T M2X.https://github.com/attm2x/m2x-demo-vagrant

git clone https://github.com/attm2x/m2x-demo-vagrant.git

vagrant box add chef/centos-6.5

bootstrap.bash

User data for Vagrant is filed in the directory from which vagrant was used and is stored in an invisible directory .vagrant.d

Python 2 executables

This advice from 2010.

### Path to executables #

  1. To see what MacOS

    which python

    If you have MiniConda installed:

    If you have Anaconda installed:

    If you are inside a conda activated environment:

  2. For a list of what Python executes:

    ls ~/miniconda2/bin

    The response begins with this:

    Type python

  3. Find where you are picking up Python from?

    type python

    If Python was installed:

    python is hashed (/usr/bin/python)

    Alternately, if Conda was installed:

    python is hashed (/Users/mac/miniconda2/bin/python)

  4. Open a Terminal shell window and issue command:

    The response is its version. My Mac Yosemite default of Python shows this:

    With Miniconda installed on El Capitan, it’s this instead:

  5. Get the folder:

The response I got is this:

/Users/mac/Library/Python/2.7/lib/python/site-packages

Alternately:

/Users/mac/.local/lib/python2.7/site-packages

Miniconda install

Below is a more “hands-on” description than whatpydata.org andKyle Purdon offers.

  1. Use an internet browser to visit the Miniconda Download page at http://conda.pydata.org/miniconda.html

    Alternately, download:

    cd ~/Downloads
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh

  2. Select version to download. For Python 2.7:

    VersionFileSize
    Python 2.7Miniconda2-latest-MacOSX-x86_64.sh20.3 MB
    Python 3.5Miniconda3-latest-MacOSX-x86_64.sh23.4 MB

    NOTE: Python3 is not backward compatible with Version 2.

    Notice the “.sh” means these are shell scripts.

  3. Open a Terminal shell window tonavigate to your Downloads folder and run the Python 2.7 script:

    Apple iPhoto was first released in 2002 and is the flagship image manipulation software for Mac users. It can be used for editing, printing and sharing digital pictures among users and is usually included as a part of the iLife Suite on Mac computers. With the help of this program users can directly. Nov 04, 2010  Provides the ability to create and order calendars in iPhoto. Additional letterpress holiday greeting card themes are now available. Fixes an issue that prevented videos downloaded from MobileMe or Flickr from importing correctly into iPhoto events. Iphoto 9.5.1 dmg software. Jul 29, 2014  How to create a 3D Terrain with Google Maps and height maps in Photoshop - 3D Map Generator Terrain - Duration: 20:32. Orange Box Ceo 6,658,285 views. Sep 04, 2015  Since I did not buy iPhoto from the AppStore, how can I upgrade it to 9.5.1?? The AppStore don't show iPhoto anymore, and even if it tell me that I need to upgrade it, AppStore keep telling me that iPhoto is not available in my country (Canada). There is no download for a.dmg with iPhoto 9.5.1. You can contact the Support personnel at the.

    cd ~/Downloads
    bash Miniconda2-latest-MacOSX-x86_64.sh -b

    PROTIP: The “-b” option specifies unattended with defaults.

    The response:

  4. Press Enter to accept the license.
  5. Press “q” to the “:” prompt.
  6. Type yes.

    “ERROR: File or directory already exists:”appears if miniconda was already installed.

  7. Confirm conda version.

Anaconda Install

This video by Corey Schafer explains it well.

  1. Go to web page:

    QUESTION: Is there a brew anaconda?

  2. Click on the operating system icon (Mac, Windows, Linux) or scroll down and press the tab.
  3. Click to download the “command-line installer”.

  4. In a (bash) Terminal:

    The response:

  5. Press Enter (as if you cared).
  6. Press Tab until you’re exhausted.
  7. Type yes and press Enter.

    Anaconda3 will now be installed into this location:/Users/mac/anaconda3

  8. Press ENTER to confirm the location
  9. Press CTRL-C to abort the installation
  10. Or specify a different location below

  11. Press Enter.

    PREFIX=/Users/mac/anaconda3

  12. Wait for it to come back to you.

  13. Type yes.

Conda verson

See https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

  1. For the version of conda installed, specify the upper-case V:

    conda -V

    Alternately:

    conda --version

    The response is like:

Update conda

  1. To update miniconda’s version, use the conda command line installed above:

    conda update conda

    The response is a list of packages to be updated if you agree:

  2. Press “y” to proceed. A sample response:

  3. After install, close and then re-open the terminal window so the changes can take effect.

  4. For a list of packages installed locally (in the currently active environment):

    conda list

    The “py36_1” in the list are pip installed.

Download Anaconda Macos

.bash_profile config

TODO: Instructions for both Miniconda and conda.

The path to Python should be the first in PATH:

  1. Open a text editor to ~/.bash_profile and add:

    export PATH=”~/miniconda2/bin:$PATH”
    export PYTHON_PATH=~/miniconda2/bin/python

    When you’re done:

    To download Yosemite you must sign in to the Mac Apps store by using Apple ID username and password. The Yosemite file is 5GB of size. So, please choose a proper drive which has relevant free space to download the file. After you download the Yosemite download file it. Nov 12, 2014  OS X 10.10, aka Yosemite, sports a more modern look and bridges the gap between Apple's desktop and mobile devices. The new Continuity helps you hand off tasks from iPhone to iPad to Mac. Mac Load more results. Apple Footer Apple Support.

  2. Activate the shell file :

    source ~/.bash_profile

    Troubleshoot brew install

  3. To reset:

Scripting Python versions

TODO: Use a shim so that a script can display the version of Python it is using:

Some answers:

Per https://docs.python.org/3/library/sys.html#sys.hexversion

For a script to ensure that it’s running the version of Python intended:

Alternately:

Download Anaconda Python 2.7 Mac

Conda info

  1. Get a list:

    conda info

    The response:

    Conda environments

  2. Get a list of Conda environments (from any folder) using the -e flag:

    conda info -e

    Alternately, if you like typing long options:

    The response are like this:

  3. Create a Conda environment named py2 using Python 2.7:

  4. Press y to go ahead.

  5. Add python packages, such as TensorFlow:

  6. Activate to use the environment:

  7. When done using TensorFlow, deactivate the environment:

Conda pyenv

pyenv enables switch between multiple versions of Python on a single system (laptop).

  1. Create two “named” Conda environments (one with Python2 and the other with Python3):

  2. Set one of these as my default by adding to my terminal startup file ~/.bash_profile:

    Typically I only use these “named python” environments to run a Python REPL or do general Python tasks. I’ll create another conda environment named specifically for each real project I work on.

Uninstall

PROTIP: Delete Conda one folder at a time (without the –yes parameter).

anaconda-clean

Files such as:

Install Python packages

From inside a conda environment:

  1. NumPy at http://www.numpy.orgneeded by http://www.pymvpa.org/installation.html

    pip install numpy

  2. Instead of downloadinghttp://www.scipy.org/scipylib/download.html#linear algebra, standard distributions, signal processing, data IO

    pip install scipy

  3. SKlearn

    pip install sklearn

  4. Pandas based onVIDEO: How to install Pandas Miniconda:

    pip install pandas

  5. matplotlib

    Other Python packages:

    • xlwings interfaces with Microsoft Excel spreadsheets
    • pygame develops GUI

OpenCV for computer vision

Follow the instructions below to install python2 + OpenCV in mac

In case of python3 + OpenCV follow

Conda vs Pip

  • Conda handles library dependencies outside of the Python packages as well as Python packages themselves.

  • Conda installs from binary, meaning that someone (e.g., Continuum) has already done the hard work of compiling the package, making installation easier, and faster.

  • pip can install anything from PyPI in one command.
  • Conda requires at least three commands: skeleton, build, install, and possibly more.

  • Conda uses its own format, which has some advantages (like being static, and again, Python agnostic).

Conda provides an alternative set of commandspopular for scientific (Machine Learning) computing.See http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf

This table lists the difference in commands between Conda and pip, a summary of the more detailed table is at https://conda.io/projects/conda/en/latest/commands.html#conda-vs-pip-vs-virtualenv-commands

TaskConda package and environment manager commandPip package manager commandVirtualenv environment manager command
Install a packagecondainstall$PACKAGE_NAMEpipinstall$PACKAGE_NAME-
Update a packagecondaupdate--name$ENVIRONMENT_NAME$PACKAGE_NAMEpipinstall--upgrade$PACKAGE_NAME-
Update package managercondaupdatecondaLinux/OSX: pipinstall-Upip Win: python-mpipinstall-Upip-
Uninstall a packagecondaremove--name$ENVIRONMENT_NAME$PACKAGE_NAMEpipuninstall$PACKAGE_NAME-
Create an environmentcondacreate--name$ENVIRONMENT_NAMEpython-cd$ENV_BASE_DIR;virtualenv$ENVIRONMENT_NAME
Activate an environmentsourceactivate$ENVIRONMENT_NAME-source$ENV_BASE_DIR/$ENVIRONMENT_NAME
/bin/activate
Deactivate an environmentsourcedeactivate-deactivate
Search available packagescondasearch$SEARCH_TERMpipsearch$SEARCH_TERM-
Install package from specific sourcecondainstall--channel$URL$PACKAGE_NAMEpipinstall--index-url$URL$PACKAGE_NAME-
List installed packagescondalist--name$ENVIRONMENT_NAMEpiplist-
Create requirements filecondalist--exportpipfreeze-
List all environmentscondainfo--envs-Install virtualenv wrapper,
then lsvirtualenv
Install other package managercondainstallpippipinstallconda-
Install Pythoncondainstallpython=x.x--
Update Pythoncondaupdatepython *--

PyCharm IDE

https://discussions.udacity.com/t/referencing-pygame-from-pycharm-with-anaconda/223711/13

Turi (Dato) Python algorithms

GraphLab Create from Dato provides scalable “pre-implemented” ML algorithms using Anaconda.Entire courses on its use is at

  • https://www.coursera.org/learn/ml-foundations
  • https://www.turi.com/learn/userguide/
  • https://www.turi.com/products/create/docs/
  • https://github.com/learnml/machine-learning-specialization
  • https://www.coursera.org/learn/ml-clustering-and-retrieval/supplement/iF7Ji/software-tools-you-ll-need-for-this-course

When the one-year free license is over, notescikit-learn also uses Python with Anaconda.

Python libraries

For matrix operations, use the Numpy open-source Python library for fast performance with data that fits in memory.Quickstart.

In a requirements.txt file:

tweepy (http://www.tweepy.org)

csv (https://pypi.python.org/pypi/csv)

textblob (https://textblob.readthedocs.io/en/dev/)

keras (https://keras.io)

bokehFlaskipythonjupytermatplotlibnosenumpypandasPillowpymcrequestsscikit-imagescikit-learnscipyseabornstatsmodeltensorflowvirtualenvvirtualenvwrapper

OpenCV3

Data Manipulation

SFrame is an open-source, highly-scalable Python library for data manipulation. Unlike Pandas, SFrame is not limited to datasets which can fit in memory, so it can deal with large datasets, even on a laptop.

http://stackoverflow.com/questions/509211/explain-pythons-slice-notation/

Conda

Conda is similar to virtualenv and pyenv, other popular environment managers.

https://virtualenv.pypa.io/en/stable/

https://github.com/yyuu/pyenv

https://www.continuum.io/downloads

conda install numpy pandas matplotlib

conda install jupyter notebook

  1. List the packages installed, with its version number andwhat version of Python:

    conda list

Conda Environments

  1. Create new environment for Python, specifying packages needed:

    conda create -n my_env python=3 numpy pandas

  2. Enter an environment on Mac:

    source activate my_env

    On Windows:

    activate my_env

    When you’re in the environment, the environment’s name appears in the prompt:

    (my_env) ~ $.

  3. Leave the environment

    source deactivate

    On Windows, it’s just deactivate.

  4. Get back in again.

  5. Create an enviornment file by piping the output from an export:

    conda env export > some_env.yaml

    When sharing your code on GitHub, it’s good practice to make an environment file and include it in the repository. This will make it easier for people to install all the dependencies for your code. I also usually include a pip requirements.txt file using pip freeze (learn more here) for people not using conda.

  6. Load an environment metadata file:

    conda env create -f some_env.yaml

  7. List environments created on your machine:

    conda env list

  8. Remove an environment:

    conda env remove -n some_env

Read:

  • https://conda.io/docs/using/index.html

  • https://jakevdp.github.io/blog/2016/08/25/conda-myths-and-misconceptions/

Where installed?

When Python is installed using pip, see where it’s installed:

The response on my system:

Miscellaneous

http://stackoverflow.com/questions/990754/how-to-leave-exit-deactivate-a-python-virtualenv?rq=1

Anaconda

https://gist.github.com/alyssaq/f60393545173379e0f3fdescribes install of https://bootstrap.pypa.io/get-pip.py

https://docs.python.org/3/library/2to3.html2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code.

References

https://joernhees.de/blog/2014/02/25/scientific-python-on-mac-os-x-10-9-with-homebrew/recommends several pip libraries

https://linuxacademy.com/cp/socialize/index/type/community_post/id/14209released 1/25/2017 by Michael Jenkinsmakes use of AWS Boto3 with Python2 to create S3 buckets, upload files, and delete S3 buckets incode examples as part of Linux Academy’s Red Hat Certified Specialist in Virtualization (EX318) Preparation video Course

More on OSX

This is one of a series on Mac OSX:

Please enable JavaScript to view the comments powered by Disqus.