1
votes

I had installed Python manually by using below comamnd-

#cd Python-3.7.4
#./configure --enable-optimizations
#make altinstall

and later NumPy and Pandas libraries manually as below -

#python3.7 setup.py install

ERROR -

>>> import pandas as pd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/__init__.py", line 55, in <module>
    from pandas.core.api import (
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/api.py", line 29, in <module>
    from pandas.core.groupby import Grouper, NamedAgg
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/groupby/__init__.py", line 1, in <module>
    from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/groupby/generic.py", line 60, in <module>
    from pandas.core.frame import DataFrame
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/frame.py", line 104, in <module>
    from pandas.core.generic import NDFrame, _shared_docs
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/generic.py", line 99, in <module>
    from pandas.io.formats import format as fmt
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/io/formats/format.py", line 75, in <module>
    from pandas.io.common import stringify_path
  File "/opt/mycom/data/support/pandas-1.0.3/pandas/io/common.py", line 3, in <module>
    import bz2
  File "/usr/local/lib/python3.7/bz2.py", line 19, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

Then I tried workaround around as mentioned below but it didn't help

missing python bz2 module

Below are OS details-

Red Hat Enterprise Linux Server release 7.3 (Maipo)
Linux NVMBD1CJH190V03 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
Do you have bzip2 installed? Python won't be able to build optional modules that have missing dependencies. Did you try recompiling the interpreter after following the steps in the linked question? - Brian