Skip to content
Sign upLog in
← 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
nizomuddiyn

Qoyile

Profile icon
SamuelGreig

this is so boring

Profile icon
dObbOb11

sorry :/

@SamuelGreig

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

@KiranShende
Yay!

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
dObbOb11

thanks!

@TravisRaney1

Profile icon
TravisRaney1

@dObbOb11
No problem

Profile icon
Karthikshivadsh

blood python

Profile icon
porachanok

/pa

Profile icon
[deleted]

I appreciate you taking the time to discuss it since I have strong opinions regarding it and I want to find out more information about it. Could you perhaps add some details to the post you made on your blog? It will actually be to our collective advantage. bubble shooter

Profile icon
dObbOb11

could you please clarify? Oh, and what is bubble shooter?

@boystrong1002ed

Profile icon
[deleted]

This was a very interesting article. I hope you continue to contribute quality content to the community. I'd like to introduce you to a new game genre that I've come across. A retro games is a game with traditional gameplay that you can enjoy in your spare time.

Profile icon
dObbOb11

@candymika
Thanks a lot! I really appreciate it. (oh and I played Donkey Kong on retrogames! It was fun)

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
abo-ta3lab-bw-t

cool

Profile icon
dObbOb11

@abo-ta3lab-bw-t
:)

Profile icon
SuperM1887

woaw!

Profile icon
[deleted]

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