scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
405 stars 68 forks source link

Python 3.10 bitarray compatibility? #345

Closed nbahar-intel closed 1 week ago

nbahar-intel commented 3 weeks ago

Encountered this issue with fresh installation of Python 3.10.8

bitarray 2.9.2
bitstring 4.2.0
from bitstring import BitStream

Failure: ImportError: cannot import name 'BytesLike' from 'bitarray'

nbahar-intel commented 3 weeks ago

Downgrading bitarray did the trick for me, but I'm not worried of potential logic issues due to incompatibility.

scott-griffiths commented 3 weeks ago

Hi. Thanks for the bug report.

I can't reproduce the problem. I created a new virtual env (Python 3.10.14) and pip install bitstring==4.2.0 which pulled in bitarray 2.9.2. It worked on my machine:

(venv_3_10_test) scottg@Scotts-MacBook-Pro dev % pip list
Package    Version
---------- -------
bitarray   2.9.2
bitstring  4.2.0
pip        24.0
setuptools 69.2.0

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
(venv_3_10_test) scottg@Scotts-MacBook-Pro dev % python
Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from bitstring import BitStream
>>>

I did run a few more sanity checks after this point and it was all working as expected.

The BytesLike is part of bitarray, but that version is very stable and well used so I think it must be another part of your setup. Perhaps you could see if you can reproduce it with a fresh virtualenv?

nbahar-intel commented 3 weeks ago

Just to make sure, have you tried python 3.10.8 ? Most probably will not reproduce since there's a small difference between minor version, but worth trying.

I will also try to reproduce locally with a clean enviornment.

scott-griffiths commented 1 week ago

Closing as either not a bug, or at least not my bug.