How do I upgrade packages used by iPython?

Viewed 20065

I am using iPython on OSX (on system, not inside a virtualenv) and importing pandas into a notebook. My system python is Python 2.

The version of pandas visible in the notebook is 0.16.2:

import pandas as pd
print pd.__version__

I want to use pandas 0.18. So I have quit the notebook and run:

pip install --upgrade ipython
pip install --upgrade pandas

This appeared to install ipython 4.1.2 and pandas 0.18.0, but if I run:

ipython --version

I see v4.0. And running my notebook still shows pandas 0.16.2.

How do I upgrade my packages so that I can use pandas 0.18 inside my notebook?

5 Answers

The ipython command invokes the respective python script, which is typically stored at /usr/local/bin/ipython. The first line of this script denotes the python version to be used. In my case it is #!/usr/bin/python3.6 which means that ipython is using version 3.6 of python. Use the command which ipython | xargs head -n 1 to read this first line of your ipython script. Once you know which python version ipython is using you can invoke the upgrade command. In my case, I have to execute pip3.6 install --upgrade ipython and pip3.6 install --upgrade pandas.

Using the following command you can update ipython, Open cmd and type the command:

pip install ipython --upgrade

ipython3

To change ipython from version 3.8 to 3.10, I edited first line of /usr/bin/ipython3 to #!/usr/bin/python3.10

Related