Users sometimes need to know how to install a newer version of Pandas than their OS package manager offers. Pandas requires NumPy, and works best with SciPy, Matplotlib and IPython.
How can I install the latest versions of NumPy/Scipy/Matplotlib/IPython/Pandas?
Install Numpy, Pandas, Scipy, Matplotlib By PIP Command. First, make sure pip has been installed on your OS. If it is not installed, please refer article How To Install Python/Pip On Windows. Run pip install command to install related packages. Run pip uninstall command to uninstall related packages.
If you are using the Python version that comes with your Linux distribution, you can install Matplotlib via your package manager, e.g.: Debian / Ubuntu: sudo apt-get install python3-matplotlib. Fedora: sudo dnf install python3-matplotlib. Red Hat: sudo yum install python3-matplotlib.
Using Ubuntu, here is how to install the entire NumPy/Scipy/Matplotlib/IPython/Pandas stack from Github in a virtualenv using Python2.7:
Note: The instructions below install the latest development version of each package. If you wish to install the latest tagged version, then after git clone
, inspect the tags available with
git tag
and select the version you wish to install with
git checkout tag-name
sudo apt-get install python-virtualenv
sudo pip install virtualenvwrapper
# edit ~/.bashrc to include
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
# edit ~/.profile to include
export WORKON_HOME=$HOME/.virtualenvs
# You may have to log out then log back in to make the change effective
mkvirtualenv --system-site-packages dev
workon dev
# If you want to make this virtual environment your default Python,
# edit ~/.bashrc to include
workon dev
add2virtualenv $USER/.virtualenvs/dev/lib/python2.7/site-packages
pip install -U Cython
sudo apt-get install git
cd ~/src
git clone https://github.com/numpy/numpy.git
sudo apt-get install python-dev build-essential
sudo apt-get install libatlas-base-dev libatlas3gf-base
# ensure clean build
# this is not necessary the first time, but useful when upgrading
cd ~/src/numpy
/bin/rm -rf ~/src/numpy/build
cdsitepackages && /bin/rm -rf numpy numpy-*-py2.7.egg-info
cd ~/src/numpy
python setup.py build --fcompiler=gnu95
python setup.py install
cd ~/src
git clone https://github.com/scipy/scipy.git
# ensure clean build
cd ~/src/scipy
/bin/rm -rf ~/src/scipy/build
cdsitepackages && /bin/rm -rf scipy scipy-*-py2.7.egg-info
cd ~/src/scipy
git clean -xdf
python setup.py install
pip install -U pyparsing
pip install -U six
pip install -U python-dateutil
pip install -U pytz
sudo apt-get install libzmq-dev
pip install -U tornado pygments pyzmq
pip install -U nose
sudo apt-get install python-qt4 python-qt4-doc python-pyside python-cairo python-wxgtk2.8 python-gtk2 dvipng
apt-cache depends python-matplotlib | awk '/Depends:/{print $2}' | xargs dpkg --get-selections
sudo apt-get build-dep python-matplotlib
cd ~/src/
git clone https://github.com/matplotlib/matplotlib
# ensure clean build
cd ~/src/matplotlib
/bin/rm -rf ~/src/matplotlib/build
cdsitepackages && /bin/rm -rf matplotlib* mpl_toolkits
# compile and install
cd ~/src/matplotlib
python setup.py build
python setup.py install
cd ~/src
git clone https://github.com/ipython/ipython.git
# ensure clean build
cd ~/src/ipython
/bin/rm -rf ~/src/ipython/build
cdsitepackages && /bin/rm -rf ipython-*-py2.7.egg
cd ~/src/ipython
python setupegg.py install
cd ~/src
git clone https://github.com/pydata/pandas.git
cd ~/src/pandas
# update
git fetch origin
git rebase --interactive origin/master
# ensure clean build and install
/bin/rm -rf ~/src/pandas/{build,dist} && cdsitepackages && /bin/rm -rf pandas* && cd ~/src/pandas && python setup.py build_ext --inplace && python setup.py install
The advantage of the git approach is that it provides a way to always keep these packages up-to-date:
cd ~/src/package-name
git fetch origin
git rebase --interactive origin/master
Follow the instructions above to ensure a clean build, and then rebuild and reinstall the package.
The above steps to clone and install packages can be automated to an extent with pip. For example, we can also install NumPy like this:
pip install git+git://github.com/numpy/numpy.git
The updating would then be just
pip install numpy --upgrade --force-reinstall
--force-reinstall
flag may be needed because pip checks the version from PyPI and doesn't update if the current version isn't smaller.
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
chmod +x miniconda.sh
./miniconda.sh -b
export PATH=/home/travis/miniconda/bin:$PATH
conda update conda --yes
conda create --name myenv --yes python=3.4 pandas matplotlib ipython-notebook
source activate myenv
Note: I believe anaconda supports Python versions 2.6, 2.7, 3.3, and 3.4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With