Skip to main content
All CollectionsOnline IDEUsing the Sandbox
Installing Libraries in Python
Installing Libraries in Python

CodeHS can automatically install libraries for you to use in Python 3 programs

Zach Galant avatar
Written by Zach Galant
Updated over 5 months ago

In the CodeHS Code Editor, you can install libraries via the Python Package Index.

To specify libraries to install, create a file named "requirements.txt". Within that file, write the name of each package on its own line.

Check out this sandbox program which that uses the requests library as an example.

gif showing creation of requirements.txt

gif showing program running using requirements.txt file

When you run your program, the libraries will automatically be installed for use in your program!

Note: If you are working with graphics, be sure to enable the Display Server Graphics setting in the Code Editor.

Click on the "gear" icon (⛭) on the left-hand side to open up the Editor settings panel, then toggle the switch for "Display Server Graphics Screen" to On. Once this is set, you'll be able to see a graphics panel above the console:


Still have questions? Contact our team at hello@codehs.com to learn more!

Did this answer your question?