By Zubin Madon
In my first attempt I left the build command blank. It seemed to build successfully, and then the deploy log showed error: ModuleNotFoundError: No module named '_tkinter' I am not even using Tkinter in my app.
Second attempt I added a procfile with the line: web: uvicorn --app-dir src nft_server:app --reload in my repo and even the build failed.
My github repo: https://github.com/zubin-madon/NFTrees
To build locally this is what I do:
app.py - client side web application (transpiled files get put into ./src/target/)
(venv) $ transcrypt --nomin --map src/app.py
nft_server.py - FastAPI REST server
(venv) $ uvicorn --app-dir src nft_server:app --reload
http://localhost:8000
But the run command is failing me. Here’s what the article says:
Modify the Run Command setting to point to your application. For this example, my project is named
mysite. So the modified command would begunicorn --worker-tmp-dir /dev/shm --config gunicorn.conf.py src.main:app
I replaced src.main with src.nft_server as per my repo. The rest I kept the same. Build succeeded but deploy failed.
[2022-07-16 04:34:19] bash: gunicorn: command not found
Deploy Error: Run Command Not Executable
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
I’ve just forked your repo and tried to deploy it. It all worked as expected.
I can see that you’ve added the requirements.txt file just a couple of hours ago, have you tried deploying the app after the file was added?
The error that you are getting indicates that the first time you tried deploying the app you did not have the requirements.txt file in your repo.
Besides, for anyone who might come across this in the future, here are a few troubleshooting steps that might be helpful:
ModuleNotFoundError: No module named ‘_tkinter’: This is a common issue faced when deploying Python applications. ‘_tkinter’ is the standard Tcl/Tk interface module for Python. The issue can arise when certain libraries have a dependency on it, even if you aren’t directly using it. To address this, you might want to:
requirements.txt to see if there’s anything that might be pulling in Tkinter.Procfile: If you’re following the Heroku-style deployment (which DigitalOcean’s App Platform sometimes uses), the Procfile is crucial. The format and contents should be correct. Given that you mentioned web: uvicorn --app-dir src nft_server:app --reload, ensure the Procfile is at the root level of your repository and there are no typographical errors. Also, make sure there’s no additional whitespace.
Use of gunicorn: If you’re trying to use gunicorn, you must ensure it’s installed and listed in your requirements.txt. If not, the deploy process won’t know about it and you’ll receive the error “gunicorn: command not found”. Add it to your requirements.txt.
Additional Tips:
requirements.txt.Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.