ImportError: cannot import name 'checksum' from 'modeltranslation.models'
Hello🖐️
I just try to update my project on railway and got that:
ImportError: cannot import name 'checksum' from 'modeltranslation.models' (/opt/venv/lib/python3.10/site-packages/modeltranslation/models.py)
I really don't know what to do anymore
So I hope for your help)
id: 64d445b5-9b8a-47fb-ae3c-c0d392283196
38 Replies
Project ID:
64d445b5-9b8a-47fb-ae3c-c0d392283196
64d445b5-9b8a-47fb-ae3c-c0d392283196
can you share your repo?
GitHub
GitHub - MichailoZaichenko/bike_shop
Contribute to MichailoZaichenko/bike_shop development by creating an account on GitHub.
seems like you are just missing a dependency from your requirements.txt file
also, please go and regnerate your database credentials, and going forward use environment variables, never hardcode credentials of any kind
And what should I do with my requirements.txt?
add the missing package
I did this with pip freeze > requirements.txt
I thought that it collects all the data, isn't it?
have you tried searching for other people who have had this error on the interwebs before?
Yes, I found a solution to this problem on github, but it didn't work:
I resolved it by deleting modeltranslation folder in env/lib/site-packages and reinstalling django-modelstranslation.
If it still doesn't work try to do the same steps again but with this version #436 (comment)
I tried to reinstall but nothing has changed, because the modules are installed on the server.
The project is running on my computer properly.
And I considered installing the modeltranslation module under Django2 a bad idea because I use Django==4.2.2
does this error happen during build logs?
it happened here
are you using python 3.10 locally?
yes
just an idea, set the service variable
NIXPACKS_NO_CACHE
= 1
I need to paste it in settings.py?
no
railway service variable
ok
I got the same error
i saw it in another thread was talking about runtime.txt
What is it and do i need it?
show me the table at the top of the build log?
you have already told railway to use python 3.10
I don`t think so
How am I supposed to do that?
you have already done it
so the version is not the problem
there is one oddity when I try to delete modeltranslation:
that's locally, that has nothing to do with what railway is doing
I will say, I'm stumped
Today I tried to upload this code on render(it like railway) and got same issue
So I really don't know what to do anymore
well we know it's not a railway specific issue, so uh do more googling?
or maybe that package simply isn't compatible with Linux?
railway is built on linux?
uh yeah
Ubuntu to be specific
well at least your python code runs on Ubuntu when on railway
I also wanted to ask how to transfer all my data from db.sqlite3 to PostgreSQL?
I found a solution to this problem but I'm afraid that all data is deleted:
Next, delete all migration files and create a new migration file for each application. The following command will allow you to delete the old migration files:
find. -path “/migrations/.py” -not -name “init.py” -delete
find. -path “/migrations/.pyc” -delete
do
python manage.py makemigrations
python manage.py migrate
I don't see what that has to do with the error you are seeing
one thing at a time
oh ok
whats the biggest file you have in your repo?
what do you mean - file?
I have some photos in my repo which are the biggest
well there goes that idea, back to googling you go
but check if the package can even run on linux