I am running pypy and after adding the path to the bitarray library to sys.path
I still can't import the module:
Python 2.7.3 (87aa9de10f9ca71da9ab4a3d53e0ba176b67d086, Feb 10 2014, 05:26:49)
[PyPy 2.2.1 with GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``every VM should come with neural
network trained to recognize microbenchmarks and randomly fluctuate them
+/-9000%''
>>>> import sys
>>>> sys.path.append('/usr/local/lib/python2.7/dist-packages/')
>>>> sys.path.append('/usr/local/lib/python2.7/dist-packages/bitarray/')
>>>> import bitarray
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/bitarray/__init__.py", line 11, in <module>
from bitarray._bitarray import _bitarray, bitdiff, bits2bytes, _sysinfo
ImportError: No module named bitarray._bitarray
In regular python (CPython installed from aptitude) importing bitarray works fine and I haven't made any modifications to the module after installing it with pip. What's wrong here?
Just in case you need it here is the content of the bitarray dir:
$ls /usr/local/lib/python2.7/dist-packages/bitarray/
_bitarray.so __init__.py __init__.pyc test_bitarray.py test_bitarray.pyc
UPDATE
After creating a virtualenv for pypy and installing bitarray with pip as Sunny suggested I still get an ImportError:
$ ls my-pypy-env/site-packages/bitarray
_bitarray.pypy-22.so __init__.py __init__.pyc test_bitarray.py test_bitarray.pyc
$ cd my-pypy-env/
~/my-pypy-env$ ./bin/activate
~/my-pypy-env$ pypy
Python 2.7.3 (87aa9de10f9ca71da9ab4a3d53e0ba176b67d086, Feb 10 2014, 05:26:49)
[PyPy 2.2.1 with GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``__xxx__ and __rxxx__ vs operation
slots: particle quantum superposition kind of fun''
>>>> import sys
>>>> sys.path.append('/home/sofia/my-pypy-env/site-packages/bitarray')
>>>> import bitarray
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bitarray
UPDATE 2
Sunny's solution is correct. The new problem was appending /site-packages/bitarray
instead of just /site-packages/
. I would have though that virtualenv would add this to the path automatically but it seems that it doesn't.