How to use python on glitch?

I know that glitch officially supports JavaScript but is there anyway to use Python on it? Can someone give me a step-by-step instruction please?

creating your python file and then changing package.json should work:

    "start": "python"

How would I import

Open console and write pip3 install

1 Like

Alright, thank you. I’ll try it

Hey @Infinity1231 I suggest you take a look at the projects in for some examples of how to work with Python on Glitch. One thing to keep in mind is that if you omit a package.json file and instead include a requirements.txt file, Glitch will automatically install the dependencies from requirements.txt and run the project using Python.

Hope this helps!


I was very busy these days, but now I have tried it but I don’t know how do I start the main file? Can you check my project @cori? It’s wobbly-coast

Hey @Infinity1231, with a python project, Glitch looks for a file called in your project’s home directory and runs that when it starts up. You can place code to start your app in that file and go from there.!/hello-flask? might be a good place to look for a working example.

Hey @cori. Can you check why glitch isn’t running my bot? The code is correct, I think I there’s problem with importing modules. Project name: acoustic-burglar

Hey @Infinity1231 I’m not quite sure what you’re trying to do in that project, but based on the code you have it’s doing what I would expect.

Having a glitch.json file in your project puts Glitch into “custom app mode” and runs that install and start scripts you’ve defined. In that file you’re telling Glitch to install from requirements.txt and then to start which in turn starts up a minimal Flask app that renders “Hello World!” when requested. All of that works exactly as I’d expect it to.

If you don’t have a glitch.json file but do have a requirrements.txt file then Glitch goes into “Python mode”, automagically installs from requirements.txt and then starts the app using what’s in In there it looks like you might be trying to start a bot, but you’re asking Glitch to run a file called using Python. This code won’t run as long as you have the glitch.json file in place, and if that weren’t there, Glitch wouldn’t be able to find the non-existant file.

Can you help me understand how you’d like this to work?