You may have realized that numpy and scipy are already installed on your Linux machine because they are part of the python “batteries-included” philosophy. However, pandas are not. It is an add-on package that you must install separately on your Linux machine.
Preamble [to use as knowledge, not to be copied verbatim]:numpy scipy pandas, install numpy pandas matplotlib scipy Linux
Steps: Once you decide that you want to install pandas, you should make sure that your Linux machine has the necessary prerequisites installed. The first thing to do is to make sure that python and pip are also installed. You can check this by typing the python command line like this,
$ which python
Which should show you the Linux version of python, and the pip version, if available. You should also be able to get pip from PyPi like this.
$ pip install -U pip==8.1.2
You will have to install numpy and scipy first, with a couple of commands like this. Of course, you’ll have to change numpy, scipy…etc to match your system settings.
## numpy and scipy, to use on linux [http://www.numpy.org/ numpy] [http://www.scipy.org/ scipy], install like this $ sudo pip freeze > requirements.txt $ sudo pip install -r requirements.txt $ sudo pip install numpy scipy $ sudo pip install matplotlib –download-only
Step 2: Install pandas, to use on Linux [http://pandas.pydata.org/ pandas]
$ sudo pip install pandas –download-only
Step 3: Test and enjoy pandas
$ python -c ‘import pandas as pd; print(pd.Series([1,2,3], index=True))’ [1 2 3]
Note: you should have installed pandas using the –download-only option. The command above can be used to sort out your pip installation and test that it works fine on your system. Or this.. Note: .. $ python -c ‘import pandas as pd; print(pd.Series([1,2,3], index=True))’
Note: pandas sort of works on python 2.7, but not enough for my taste. If someone has a reliable way to fix that please share it with the rest of the community.
Note2: Instead of using pip, the following is also possible. $ sudo apt-get install libpython-stdlib python=2.7.9-0~8~ubuntu16.04.1 $ sudo apt-get install python-pip python2.7
Note3: The above should work w/ yosemite (macos) but not with debians wheezy version (too old). In these cases, the following has been known to work with yosemite, but not yet tested with wheeze. $ export MACOSX_DEPLOYMENT_TARGET=10.7 $ sudo pip install pandas –download-only
Note4: You can replace python-pip by pip in the above.
Conclusion
Make sure that you install pandas using the –download-only option so that you can test it on your system without downloading the complete package. Bear in mind that pandas are available for Linux and OSX as an “add-on” package, but not Windows.
Leave a Reply