Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not sure why I am having trouble installing the Python Module Bitarray on my Ubuntu 8.10 machine.

dan@Tower:~/py$ tar xzf bitarray-0.3.5.tar.gz
dan@Tower:~/py$ cd bitarray-0.3.5
dan@Tower:~/py/bitarray-0.3.5$
dan@Tower:~/py/bitarray-0.3.5$ python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.5
creating build/lib.linux-i686-2.5/bitarray
copying bitarray/test_bitarray.py -> build/lib.linux-i686-2.5/bitarray
copying bitarray/__init__.py -> build/lib.linux-i686-2.5/bitarray
running build_ext
building 'bitarray._bitarray' extension
creating build/temp.linux-i686-2.5
creating build/temp.linux-i686-2.5/bitarray
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c bitarray/_bitarray.c -o build/te
mp.linux-i686-2.5/bitarray/_bitarray.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.5/bitarray/_bitarray.o -o build/lib.linux-i686-2.5/bitarray/_bitarray.so
running install_lib
creating /usr/lib/python2.5/site-packages/bitarray
error: could not create '/usr/lib/python2.5/site-packages/bitarray': Permission denied


dan@Tower:~/py/bitarray-0.3.5$ sudo python setup.py install
[sudo] password for dan: 
running install
running build
running build_py
running build_ext
running install_lib
creating /usr/lib/python2.5/site-packages/bitarray
copying build/lib.linux-i686-2.5/bitarray/_bitarray.so -> /usr/lib/python2.5/site-packages/bitarray
copying build/lib.linux-i686-2.5/bitarray/test_bitarray.py -> /usr/lib/python2.5/site-packages/bitarray
copying build/lib.linux-i686-2.5/bitarray/__init__.py -> /usr/lib/python2.5/site-packages/bitarray
byte-compiling /usr/lib/python2.5/site-packages/bitarray/test_bitarray.py to test_bitarray.pyc
byte-compiling /usr/lib/python2.5/site-packages/bitarray/__init__.py to __init__.pyc
running install_egg_info
Writing /usr/lib/python2.5/site-packages/bitarray-0.3.5.egg-info


dan@Tower:~/py/bitarray-0.3.5$ python -c 'import bitarray; bitarray.test()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "bitarray/__init__.py", line 13, in <module>
    from _bitarray import _bitarray, bits2bytes, _sysinfo
ImportError: No module named _bitarray
share|improve this question

1 Answer 1

up vote 6 down vote accepted

The module is installed correctly, but it tries to import the local version if you are in ~/py/bitarray-0.3.5. This doesn't work because you don't have _bitarray.so in the source code tree (you would need python build_ext -i to make it work). Just go to some other directory and run python from there, it will work.

share|improve this answer
    
Thanks! I can't believe it was that simple. –  Jarvin Oct 16 '09 at 20:15
    
The last thing I would have think of. –  iuliux Aug 30 '12 at 13:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.