Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:37:57+00:00 2026-06-16T01:37:57+00:00

I’m using redhat 5.8, which comes with python 2.4 installed automatically, but I’m using

  • 0

I’m using redhat 5.8, which comes with python 2.4 installed automatically, but I’m using a python package that requires python 2.6 or higher. SO, I installed python 2.7 alongside 2.4, so as to not step on the system version.

Now, I’m trying to install a package through pip, and get the following error:

CompressionError: bz2 module is not available

I do, however, have the module on my machine, as evidenced when I do this the server version gives:

[~]$ python -c "import bz2; print bz2.__doc__"
The python bz2 module provides a comprehensive interface for
the bz2 compression library. It implements a complete file
interface, one shot (de)compression functions, and types for
sequential (de)compression.

and the 2.7 install errors in this way:

[~]$ python2.7 -c "import bz2; print bz2.__doc__"
 Traceback (most recent call last):
  File "<string>", line 1, in <module>
 ImportError: No module named bz2

So, I have read these questions:
Already installed and this very good one, but neither of these seem quite on the mark. In the first case, the advice is to install the missing piece, and the second question is to remove (or stop referencing) the extra python install.

What I want to do is put in a symlink or some such so that the python 2.7 install knows where bz2 is so that I can use pip to install a python package.

Thanks,
B


EDIT: more information

So, after much research, it appears that the way the path variables are established changed dramatically in python 2.5 (probably why red hat hasn’t updated).

So, in python 2.7 you can add to the PYTHONPATH variable by adding a file with the .pth extension in this folder:

/usr/local/lib/python2.7/site-packages/

I have tried 2 ways to get this to work properly.

First, I simply fed a number of the python 2.4 path files to 2.7. This caused an error of a different type:

[~]$ python2.7 -c "import bz2; print bz2.__doc__"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib64/python2.4/lib-dynload/bz2.so: undefined symbol: Py_InitModule4

So, that’s something.

I also tried pointing the path to the libbz2.so file in /usr/lib/ which resulted in the familiar error:

[~]$ python2.7 -c "import bz2; print bz2.__doc__"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named bz2

I’m still stumped, but I feel like I’m closing in.

I could really use some input from someone with more experience setting up programming environments. I’m much more comfortable just writing code 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:37:58+00:00Added an answer on June 16, 2026 at 1:37 am

    Just did this yesterday on the same platform and got it working. Here’s what I did:

    Set CFLAGS="-I/path/to/bz2/include" and LDFLAGS="-L/path/to/bz2/lib". Make sure the bz2 library path is set in your LD_LIBRARY_PATH. You’ll likely need to do a make distclean and configure && make && make install, though.

    If that fails, directly edit the setup.py and make a replacement similar to the following:

    # Gustavo Niemeyer's bz2 module.
    if (self.compiler.find_library_file(['/home/someuser/packages/libbz2/lib'], 'bz2')): #lib_dirs, 'bz2')):
    

    Note the commented out portion at the end of the second line is the original rest of the setup.py line.

    Also, I found just downloading and building the latest version of bz2 and pointing all of the above to that easier than trying to get the system installed version to work.

    Regardless, this definitely works. I did it yesterday 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.