Skip to content
← Back to Community
Python Custom Packages
Profile icon
dObbOb11

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: print(path)

in Replit this should output something similar to the following:

/opt/virtualenvs/python3/lib/python3.8/site-packages /usr/lib/python38.zip /usr/lib/python3.8 /usr/lib/python3.8/lib-dynload

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.

#EDIT# I am don't think this still works because of the new package manager but it might (I haven't tested since)

Voters
Profile icon
TravisRaney1
Profile icon
adamporzuc1
Profile icon
EthanKe2
Profile icon
Fantastic003
Profile icon
LuisFerney1
Profile icon
DuyNguyen176
Profile icon
Sonam-TembaTemb
Profile icon
MAGULURI-VENKAT
Profile icon
DiegoDavila93
Profile icon
Javkhlantugts
Comments
hotnewtop
Profile icon
porachanok

/print

Profile icon
Eduardo700

Nice

Profile icon
ISpot

mv <176187.gif>

Profile icon
Biel-AnimadorAn

@ISpot yes

Profile icon
RUHANGABAHORIDD

We learn everyday

Profile icon
Parinya2668

Nice

Profile icon
xWhvty

yoo thx

Profile icon
xxxwo

thx

Profile icon
abdulrahmanalk3

Than

Profile icon
ErnestRante

import sys

Profile icon
JeetVyas1

Cool work.

Profile icon
SuperWhiteFish

nice

Profile icon
Jxggerzz

..

Profile icon
TravisRaney1

/print (path)

Profile icon
dObbOb11

@TravisRaney1 Does that work? If it does thanks!

Profile icon
TravisRaney1

@dObbOb11 let me try it and I'll let u know tomorrow when I get home

Profile icon
TravisRaney1

@dObbOb11 I believe it works then

Profile icon
Karthikshivadsh

blood python

Profile icon
porachanok

/pa

Profile icon
Katety

This is a great blog, full of fun. Thank you everyone for sharing this useful information!lol beans

Profile icon
franek327

print("5yebr")

Profile icon
DivN46

nice

Profile icon
Biel-AnimadorAn

lib

Profile icon
nizomuddiyn

Qoyile

Profile icon
SamuelGreig

this is so boring

Profile icon
ctvcanli

This piece of your work is exceptionally succinct and straightforward.

Canlı TV

Profile icon
dObbOb11

@ctvcanli thanks!

Profile icon
BAHODIRABDUSALO

salom

Profile icon
KiranShende

Excellent

Profile icon
dObbOb11
Profile icon
abo-ta3lab-bw-t

cool

Profile icon
dObbOb11
Profile icon
SuperM1887

woaw!

Profile icon
felicia78863

This part of your work is very concise and easy to understand.
@slope game

Profile icon
dObbOb11

@felicia78863 Thanks
what's slopegame.io?

Profile icon
aradhyaparida

okay

Profile icon
modyaymen

/print/

Profile icon
Arjun1s

Nice