django works well on my local machine. But, when I deploy it to heroku, I see "ModuleNotFoundError" "No module named '_tkinter'". Though, I never imported "_tkinter" or "tkinter" in my code. Your help will be appreciated. Thank you.
ModuleNotFoundError at /
No module named '_tkinter'
Request Method: GET
Request URL: https://howididit.herokuapp.com/
Django Version: 4.0.6
Exception Type: ModuleNotFoundError
Exception Value:
No module named '_tkinter'
Exception Location: /app/.heroku/python/lib/python3.10/tkinter/init.py, line 37, in
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.10.5
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python310.zip',
'/app/.heroku/python/lib/python3.10',
'/app/.heroku/python/lib/python3.10/lib-dynload',
'/app/.heroku/python/lib/python3.10/site-packages']
If you don't use Tkinter, just remove it from /forms.py. otherwise it'll be imported.
If you want to use tkinter,then consider the below process
please try adding tkinter to your requirements.txt. If it fails, even after that, check if you have added Python buildpack. If both the cases pass, try shelling into your Heroku instances and run the following command:
sudo apt install python3-tk
This will install Tkinter library in your instance of Heroku. That will resolve your error.
I found out these from pyexpat import model from turtle import title from attr import fields where imported in my forms.py. After deleting them, The problem was solved. Again, thank you all guys for your time, I really appreciate it.
Okay so for anyone looking at this in the future and banging their head against the desk...this is what worked for me:
I started with a new Hello World app and started adding bits of my original code until i got to the error
found out that one of the modules I was using : icu, was using tkinter and i needed to install the Pyicu module instead
pip installed directly into heroku bash console instead of through my app
None of the answers i found online had worked for me, and I think its because this error isnt from having tkinter directly in your app, but from another module thats calling it.
When in doubt do what I did and start a new project from scratch and add chunks of code until you get the error to see which module is creating it
Dont forget to change DEBUG to False in your settings file
I'm trying to use extra_view Django package. I've installed it and in terminal it showed as successful and I added it to installed apps in setting.py. As I don't use virtual environment it's all installed globally, but when I try to import that package there is an unresolved import error. I use VS Code if it means something. It also happened with some other packages that I installed. Do you have any idea what is happening?
Can you show full traceback to this error?
And your code where you import it.
It should work fine if you do everything as it says here in the docs:
https://django-extra-views.readthedocs.io/en/latest/pages/getting-started.html
Everything is ok actually. I just restarted VS Code and then there weren't any errors anymore. Apparently VS Code was the only issue.
I have a Django project running on Azure, and I encountered this issue with the enum module and I have tried everything from
here(Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?)
The problem is that I don't have the issue locally, I only see the issue on Azure. Therefore, I cannot just uninstall it locally. I have tried to uninstall it in the Azure terminal, but it showed that the module was not found. I have also tried to install aenum instead of enum by adding it to requirements.txt, still didn't work.
Can someone PLEASE advise me on how to fix this issue?
Here is a screenshot of the error
Here is the link to the source code In the folder, the problem occurred after we added "search".
I am working on a project and it was working fine until I decided to update all the packages in my virtual environment of Pycharm. Now it's giving me error on the function that was working fine before. I'm getting
'SVC' object has no attribute '_probA'
on this line of code
pickle.loads(open(rec, "rb").read()).predict_proba(vec)[0]
Is there a way to rollback packages updates or what is the new attribute which will work?
Can you remove the package and reinstall? The installation screen gives you the option to 'Specify Version'.
I am creating my first Django project from docs.djangoproject.com. After completing tutorial 4, I tried to import my project in LiClipse. But LiClipse is showing error of Unresolved Import however my projects works perfectly fine.
I have added django in external library.
Please help me with this issue.
LiClipse shows error only with django libraries and not with any other python library
Instead of adding django package as external library, add the containing folder of django. For example if folder hierarchy is something like /site-package/django than add site-package as external library and not django.