Learn to Code via Tutorials on Repl.it!

← Back to all posts
Python Custom Packages
dObbOb11 (13)

Python Custom Packages

If you have created your own custom python package and wish to use it in Replit there are two options to add it :

PyPI Method

This is relatively simple assuming you know how to use PyPI
you can upload your project to PyPI and then load up your repl you wish to use the package in: eg. Python_Repl-:).
once in the repl you can use the shell command: pip install <package name>

sys.path Method

You can use the sys.path method in python to see what directories python searches for packages.
Once you know what directories to use you can use shell command to add it to PATH.

How to do it in python:

Import the sys module

import sys

then list all of the included directories

for path in sys.path:

in Replit this should output something similar to the following:


the site-packages directory is were the 3rd-party packages are stored so we will use that one.
Replit only shows files things in the ~/<repl-name> directory, so to move our package we will need to use the shell.
to move files in bash you use the mv <folder/file-name> <destination-path> command. Type the following into the shell:

mv <package-name> /opt/virtualenvs/python3/lib/python3.8/site-packages

You should now be able to use the package in any repl.