I am going through this post Numpy, Scipy, and Pandas - Oh My!, installing some python packages, but got stuck at the line for installing Pandas:
pip install
You need to build python with BZIP2 support.
Install the following package before building python:
yum install bzip2-devel
sudo apt-get install libbz2-dev
Extract python tarball. Then
configure;
make;
make install
Install pip
using the new python.
Alternative:
Install a binary python distribution using yum or apt, that was build with BZIP2 support.
See also: ImportError: No module named bz2 for Python 2.7.2
sudo apt-get install libbz2-dev
Thanks to Freek Wiekmeijer for this.Now you also need to build python with bz2. Previously installed python won't work. For the do following:-
Download stable python version from https://www.python.org/downloads/source/ then extract that Gzipped source tarball file. You can use wget https://python-tar-file-link.tgz
to download and tar -xvzf python-tar-file.tgz to exact it in current directory
Go inside exacted folder then run following command on at a time
./configure
make
make install
python
file in the same directory. Just create a virtual environment.
./python -m env myenv
(create myenv in the same directory or outside it's your choice)source myenv/bin/activate
(activate virtual environment)pip install pandas
(install pandas in the current environment) I noticed that installing Python using source takes a long time (I am doing it on i7 :/ ); especially the make
and make test
...
A simpler and shorter solution was to install another version of Python (I did Python 3.7.8) using pyenv
, install it using these steps.
It not only saved the problem of using multiple Python instances on the same system but also maintain my virtual environments without virtualenvwrapper
(which turned buggy on my newly setup ubuntu-20.04).