[PY2.7] import uszipcode raise Import Error
Closed this issue · 2 comments
Describe the bug
We use uszipcode in python2.7 for historical reason
after an update we can't import uszipdecode anymore
To Reproduce
install latest version of uszipcode using pip for python2.7 (--force-reinstall
if needed)
then
$ python2.7
Python 2.7.18 (default, Aug 24 2020, 19:12:23)
[GCC 10.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import uszipcode
cannot import name ExtendedBase
>>> from uszipcode import SearchEngine
cannot import name ExtendedBase
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name SearchEngine
It seem related to the latest build which didn't upgrade the package version.
It is still in 0.2.4 on pypi
Edit 2021-04-12
After futher investigation
we use the package sqlalchemy_mate
But the path of latest build don't include this change
To fix this I need to install this lib from, github direcly
pip2.7 install git+https://github.com/MacHu-GWU/uszipcode-project.git
Hi @chmuche it is because the version of dependencies is not hardcoded. And one of the dependencies are not maintained for python2.7 anymore, when you pip install uszipcode, by default it install the latest dependencies version. A hacky way but not recommended way to fix it is: "manually install specific version of the dependencies, and install uszipcode at last"
I strongly recommend you to use pythn3.6 + since more and more python library are not going to support python2.7