ImportError: cannot import name 'force_text' from 'django.utils.encoding'
Opened this issue · 4 comments
Checklist
- I have verified that I am using a GIS-enabled database, such as PostGIS or Spatialite.
- I have verified that that issue exists against the
master
branch of django-cities. - I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- I have reduced the issue to the simplest possible case.
- I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Steps to reproduce
Expected behavior
Actual behavior
Hey @Qbes179s which django version are you using?
The pypi version of this package is not updated, hence doesn't support django versions >= 4, where
force_text was removed.
In that case you should pip clone the package.
Thanks this helped me. The documentation is a little misleading, because the remote package name is the same than the extracted folder. So it's easy to pip install
the remote package instead of the extracted one ^^
However, may I ask why the package is not updated? It seems the project is not maintained by the initial author. However, as the Github repo seems to be up to date, why not the pypi package?
Just a matter of time, will try to look into getting one released soon, but there is some tooling stuff I have to check on.
@arthanson Thanks for the answer.
My bad, I was struggling with the installation doc, until I realised these are not 3 steps to follow, but 3 different ways to install django-cities.
I feel a little dumb, but I suggest clarifying this step anyway, with:
- Adding a
There are 3 different ways to install the project:
paragraph - Dissuading people to use the
pip install
solution as it's currently not maintained.
Maybe the best way to install the project at the time is to use pip (or another package manager like Poetry), but pointing to the git repository. Something like:
pip install git+https://github.com/coderholic/django-cities.git
should work.
Doing this:
- No way to install an old package from PyPi and have weird errors, by mistake
- No need to wget stuff manually (which would not work with hosting services like Heroku for example)
What do you think?