Be cautious if you are using a Python install that is managed by your operating system or another package manager. Get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state. Recently I had to install Python on Windows 10, so I could use the “Closure Linter” tool for PhpStorm. Here is a simple guide to show you exactly how to install Python and PIP on your Windows 10 machine. Download Python The first step is to download Python from python.org and select the most recent. Code of Conduct¶. Everyone interacting in the pip project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.
The easiest way to install pandas is to install itas part of the Anaconda distribution, across platform distribution for data analysis and scientific computing.This is the recommended installation method for most users.
Instructions for installing from source,PyPI, ActivePython, various Linux distributions, or adevelopment version are also provided.
Python version support¶
Officially Python 3.5.3 and above, 3.6, and 3.7.
Mar 23, 2016 The OS X El Capitan 10.11.1 update improves the stability, compatibility, and security of your Mac, and is recommended for all users. This update: Improves installer reliability when upgrading to OS X El Capitan. Improves compatibility with Microsoft Office 2016. Fixes an issue where outgoing server information may be missing from Mail. Update Office from the Mac App Store. If you downloaded Office from the Mac App Store, and have automatic updates turned on, your apps will update automatically. But you can also manually download the updates: Open the Mac App Store from your Dock or Finder. Can mac el capitan do manual updates work. Apr 04, 2019 Get El Capitan from the App Store. Now that High Sierra is available, you should upgrade to High Sierra instead of El Capitan. For security and compatibility reasons, Apple always recommends using the latest version of macOS. If your Mac doesn't support High Sierra, or you're using Snow Leopard or Lion and would like to upgrade to High Sierra.
Installing pandas¶
Installing with Anaconda¶
Installing pandas and the rest of the NumPy andSciPy stack can be a littledifficult for inexperienced users.
The simplest way to install not only pandas, but Python and the most popularpackages that make up the SciPy stack(IPython, NumPy,Matplotlib, …) is withAnaconda, a cross-platform(Linux, Mac OS X, Windows) Python distribution for data analytics andscientific computing.
After running the installer, the user will have access to pandas and therest of the SciPy stack without needing to installanything else, and without needing to wait for any software to be compiled.
Installation instructions for Anacondacan be found here.
A full list of the packages available as part of theAnaconda distributioncan be found here.
Another advantage to installing Anaconda is that you don’t needadmin rights to install it. Anaconda can install in the user’s home directory,which makes it trivial to delete Anaconda if you decide (just deletethat folder).
Installing with Miniconda¶
The previous section outlined how to get pandas installed as part of theAnaconda distribution.However this approach means you will install well over one hundred packagesand involves downloading the installer which is a few hundred megabytes in size.
If you want to have more control on which packages, or have a limited internetbandwidth, then installing pandas withMiniconda may be a better solution.
Conda is the package manager that theAnaconda distribution is built upon.It is a package manager that is both cross-platform and language agnostic(it can play a similar role to a pip and virtualenv combination).
Miniconda allows you to create aminimal self contained Python installation, and then use theConda command to install additional packages.
First you will need Conda to be installed anddownloading and running the Minicondawill do this for you. The installercan be found here
The next step is to create a new conda environment. A conda environment is like avirtualenv that allows you to specify a specific version of Python and set of libraries.Run the following commands from a terminal window:
This will create a minimal environment with only Python installed in it.To put your self inside this environment run:
On Windows the command is:
The final step required is to install pandas. This can be done with thefollowing command:
To install a specific pandas version:
To install other packages, IPython for example:
To install the full Anacondadistribution:
If you need packages that are available to pip but not conda, theninstall pip, and then use pip to install those packages:
Installing from PyPI¶
pandas can be installed via pip fromPyPI.
Installing with ActivePython¶
Installation instructions forActivePython can be foundhere. Versions2.7 and 3.5 include pandas.
Installing using your Linux distribution’s package manager.¶
The commands in this table will install pandas for Python 3 from your distribution.To install pandas for Python 2, you may need to use the
python-pandas
package.Distribution | Status | Download / Repository Link | Install method |
---|---|---|---|
Debian | stable | official Debian repository | sudoapt-getinstallpython3-pandas |
Debian & Ubuntu | unstable (latest packages) | NeuroDebian | sudoapt-getinstallpython3-pandas |
Ubuntu | stable | official Ubuntu repository | sudoapt-getinstallpython3-pandas |
OpenSuse | stable | OpenSuse Repository | zypperinpython3-pandas |
Fedora | stable | official Fedora repository | dnfinstallpython3-pandas |
Centos/RHEL | stable | EPEL repository | yuminstallpython3-pandas |
However, the packages in the linux package managers are often a few versions behind, soto get the newest version of pandas, it’s recommended to install using the
pip
or conda
methods described above.Installing from source¶
See the contributing guide for complete instructions on building from the git source tree. Further, see creating a development environment if you wish to create a pandas development environment.
Running the test suite¶
pandas is equipped with an exhaustive set of unit tests, covering about 97% ofthe code base as of this writing. To run it on your machine to verify thateverything is working (and that you have all of the dependencies, soft and hard,installed), make sure you have pytest >= 4.0.2 and Hypothesis >= 3.58, then run:
Dependencies¶
Package | Minimum supported version |
---|---|
setuptools | 24.2.0 |
NumPy | 1.13.3 |
python-dateutil | 2.6.1 |
pytz | 2017.2 |
Recommended dependencies¶
- numexpr: for accelerating certain numerical operations.
numexpr
uses multiple cores as well as smart chunking and caching to achieve large speedups.If installed, must be Version 2.6.2 or higher. - bottleneck: for accelerating certain types of
nan
evaluations.bottleneck
uses specialized cython routines to achieve large speedups. If installed,must be Version 1.2.1 or higher.
Note
You are highly encouraged to install these libraries, as they provide speed improvements, especiallywhen working with large data sets.
Optional dependencies¶
Pandas has many optional dependencies that are only used for specific methods.For example,
pandas.read_hdf()
requires the pytables
package. If theoptional dependency is not installed, pandas will raise an ImportError
whenthe method requiring that dependency is called.Dependency | Minimum Version | Notes |
---|---|---|
BeautifulSoup4 | 4.6.0 | HTML parser for read_html (see note) |
Jinja2 | Conditional formatting with DataFrame.style | |
PyQt4 | Clipboard I/O | |
PyQt5 | Clipboard I/O | |
PyTables | 3.4.2 | HDF5-based reading / writing |
SQLAlchemy | 1.1.4 | SQL support for databases other than sqlite |
SciPy | 0.19.0 | Miscellaneous statistical functions |
XLsxWriter | 0.9.8 | Excel writing |
blosc | Compression for msgpack | |
fastparquet | 0.2.1 | Parquet reading / writing |
gcsfs | 0.2.2 | Google Cloud Storage access |
html5lib | HTML parser for read_html (see note) | |
lxml | 3.8.0 | HTML parser for read_html (see note) |
matplotlib | 2.2.2 | Visualization |
openpyxl | 2.4.8 | Reading / writing for xlsx files |
pandas-gbq | 0.8.0 | Google Big Query access |
psycopg2 | PostgreSQL engine for sqlalchemy | |
pyarrow | 0.9.0 | Parquet and feather reading / writing |
pymysql | 0.7.11 | MySQL engine for sqlalchemy |
pyreadstat | SPSS files (.sav) reading | |
pytables | 3.4.2 | HDF5 reading / writing |
qtpy | Clipboard I/O | |
s3fs | 0.0.8 | Amazon S3 access |
xarray | 0.8.2 | pandas-like API for N-dimensional data |
xclip | Clipboard I/O on linux | |
xlrd | 1.1.0 | Excel reading |
xlwt | 1.2.0 | Excel writing |
xsel | Clipboard I/O on linux | |
zlib | Compression for msgpack |
Optional dependencies for parsing HTML¶
One of the following combinations of libraries is needed to use thetop-level
read_html()
function:- BeautifulSoup4 and html5lib
- BeautifulSoup4 and lxml
- BeautifulSoup4 and html5lib and lxml
- Only lxml, although see HTML Table Parsingfor reasons as to why you should probably not take this approach.
Warning
- if you install BeautifulSoup4 you must install eitherlxml or html5lib or both.
read_html()
will not work with onlyBeautifulSoup4 installed. - You are highly encouraged to read HTML Table Parsing gotchas.It explains issues surrounding the installation andusage of the above three libraries.
This section covers the basics of how to install Python packages.
It’s important to note that the term “package” in this context is being used asa synonym for a distribution (i.e. a bundle ofsoftware to be installed), not to refer to the kind of package that you import in your Python source code (i.e. a container ofmodules). It is common in the Python community to refer to a distribution using the term “package”. Using the term “distribution”is often not preferred, because it can easily be confused with a Linuxdistribution, or another larger software distribution like Python itself.
Contents
- Requirements for Installing Packages
This section describes the steps to follow before installing other Pythonpackages.
Before you go any further, make sure you have Python and that the expectedversion is available from your command line. You can check this by running:
You should get some output like
Python3.6.3
. If you do not have Python,please install the latest 3.x version from python.org or refer to theInstalling Python section of the Hitchhiker’s Guide to Python.Note
If you’re a newcomer and you get an error like this:
It’s because this command and other suggested commands in this tutorialare intended to be run in a shell (also called a terminal orconsole). See the Python for Beginners getting started tutorial foran introduction to using your operating system’s shell and interacting withPython.
Note
If you’re using an enhanced shell like IPython or the Jupyternotebook, you can run system commands like those in this tutorial byprefacing them with a
!
character:It’s recommended to write
{sys.executable}
rather than plain python
inorder to ensure that commands are run in the Python installation matchingthe currently running notebook (which may not be the same Pythoninstallation that the python
command refers to).Note
Due to the way most Linux distributions are handling the Python 3migration, Linux users using the system Python without creating a virtualenvironment first should replace the
python
command in this tutorialwith python3
and the pip
command with pip3--user
. Do notrun any of the commands in this tutorial with sudo
: if you get apermissions error, come back to the section on creating virtual environments,set one up, and then continue with the tutorial as written.Additionally, you’ll need to make sure you have pip available. You cancheck this by running:
If you installed Python from source, with an installer from python.org, orvia Homebrew you should already have pip. If you’re on Linux and installedusing your OS package manager, you may have to install pip separately, seeInstalling pip/setuptools/wheel with Linux Package Managers.
If
pip
isn’t already installed, then first try to bootstrap it from thestandard library:If that still doesn’t allow you to run
pip
:- Securely Download get-pip.py[1]
- Run
pythonget-pip.py
. [2] This will install or upgrade pip.Additionally, it will install setuptools and wheel if they’renot installed already.WarningBe cautious if you’re using a Python install that’s managed by youroperating system or another package manager. get-pip.py does notcoordinate with those tools, and may leave your system in aninconsistent state. You can usepythonget-pip.py--prefix=/usr/local/
to install in/usr/local
which is designed for locally-installedsoftware.
While
pip
alone is sufficient to install from pre-built binary archives,up to date copies of the setuptools
and wheel
projects are usefulto ensure you can also install from source archives:See section below for details,but here’s the basic venv[3] command to use on a typical Linux system:
Pip Install On Mac With Manual Free
This will create a new virtual environment in the
tutorial_env
subdirectory,and configure the current shell to use it as the default python
environment.Python “Virtual Environments” allow Python packages to be installed in an isolated location for a particular application,rather than being installed globally. If you are looking to safely installglobal command line tools,see Installing stand alone command line tools.
Imagine you have an application that needs version 1 of LibFoo, but anotherapplication requires version 2. How can you use both these applications? If youinstall everything into /usr/lib/python3.6/site-packages (or whatever yourplatform’s standard location is), it’s easy to end up in a situation where youunintentionally upgrade an application that shouldn’t be upgraded.
Or more generally, what if you want to install an application and leave it be?If an application works, any change in its libraries or the versions of thoselibraries can break the application.
Also, what if you can’t install packages into theglobal site-packages directory? For instance, on a shared host.
In all these cases, virtual environments can help you. They have their owninstallation directories and they don’t share libraries with other virtualenvironments.
Mcculloch mac 60-a manual free. Currently, there are two common tools for creating Python virtual environments: Mcculloch mac 3516 gas chainsaw manual.
- venv is available by default in Python 3.3 and later, and installspip and setuptools into created virtual environments inPython 3.4 and later.
- virtualenv needs to be installed separately, but supports Python 2.7+and Python 3.3+, and pip, setuptools and wheel arealways installed into created virtual environments by default (regardless ofPython version).
The basic usage is like so:
Using venv:
Using virtualenv:
For more information, see the venv docs or the virtualenv docs.
In both of the above cases, Windows users should _not_ use thesource command, but should rather run the activate script directlyfrom the command shell. The use of source under Unix shells ensuresthat the virtual environment’s variables are set within the currentshell, and not in a subprocess (which then disappears, having nouseful effect).
Managing multiple virtual environments directly can become tedious, so thedependency management tutorial introduces ahigher level tool, Pipenv, that automatically manages a separatevirtual environment for each project and application that you work on.
pip is the recommended installer. Below, we’ll cover the most commonusage scenarios. For more detail, see the pip docs,which includes a complete Reference Guide.
The most common usage of pip is to install from the Python PackageIndex using a requirement specifier. Generally speaking, a requirement specifier iscomposed of a project name followed by an optional version specifier. PEP 440 contains a fullspecificationof the currently supported specifiers. Below are some examples.
To install the latest version of “SomeProject”:
To install a specific version:
To install greater than or equal to one version and less than another:
To install a version that’s “compatible”with a certain version: [4]
In this case, this means to install any version “1.4.*” version that’s also“>=1.4.2”.
pip can install from either Source Distributions (sdist) or Wheels, but if both are presenton PyPI, pip will prefer a compatible wheel.
Wheels are a pre-built distribution format that provides faster installation compared to SourceDistributions (sdist), especially when aproject contains compiled extensions.
If pip does not find a wheel to install, it will locally build a wheeland cache it for future installs, instead of rebuilding the source distributionin the future.
Upgrade an already installed SomeProject to the latest from PyPI.
To install packages that are isolated to thecurrent user, use the
--user
flag:For more information see the User Installs sectionfrom the pip docs.
Note that the
--user
flag has no effect when inside a virtual environment- all installation commands will affect the virtual environment.If
SomeProject
defines any command-line scripts or console entry points,--user
will cause them to be installed inside the user base’s binarydirectory, which may or may not already be present in your shell’sPATH
. (Starting in version 10, pip displays a warning wheninstalling any scripts to a directory outside PATH
.) If the scriptsare not available in your shell after installation, you’ll need to add thedirectory to your PATH
:- On Linux and macOS you can find the user base binary directory by running
python-msite--user-base
and addingbin
to the end. For example,this will typically print~/.local
(with~
expanded to the absolutepath to your home directory) so you’ll need to add~/.local/bin
to yourPATH
. You can set yourPATH
permanently by modifying ~/.profile. - On Windows you can find the user base binary directory by running
py-msite--user-site
and replacingsite-packages
withScripts
. Forexample, this could returnC:UsersUsernameAppDataRoamingPython36site-packages
so you wouldneed to set yourPATH
to includeC:UsersUsernameAppDataRoamingPython36Scripts
. You can set your userPATH
permanently in the Control Panel. You may need to log out for thePATH
changes to take effect.
Install a list of requirements specified in a Requirements File.
Install a project from VCS in “editable” mode. For a full breakdown of thesyntax, see pip’s section on VCS Support.
Install from an alternate index
Search an additional index during install, in addition to PyPI
Installing from local src in Development Mode,i.e. in such a way that the project appears to be installed, but yet isstill editable from the src tree.
You can also install normally from src
Install a particular source archive file.
Install from a local directory containing archives (and don’t check PyPI)
To install from other data sources (for example Amazon S3 storage) you cancreate a helper application that presents the data in a PEP 503 compliantindex format, and use the
--extra-index-url
flag to direct pip to usethat index.Find pre-release and development versions, in addition to stable versions. Bydefault, pip only finds stable versions.
Install setuptools extras.
[1] | “Secure” in this context means using a modern browser or atool like curl that verifies SSL certificates when downloading fromhttps URLs. |
[2] | Depending on your platform, this may require root or Administratoraccess. pip is currently considering changing this by making userinstalls the default behavior. |
[3] | Beginning with Python 3.4, venv (a stdlib alternative tovirtualenv) will create virtualenv environments with pip pre-installed, thereby making it an equal alternative tovirtualenv. |
[4] | The compatible release specifier was accepted in PEP 440and support was released in setuptools v8.0 andpip v6.0 |