code-interpreter icon indicating copy to clipboard operation
code-interpreter copied to clipboard

Import dependency to execute code

Open 404notfoundyc-L opened this issue 1 year ago • 5 comments

How to execute the code with sandbox of the imported package? For example: image

404notfoundyc-L avatar Jul 03 '24 06:07 404notfoundyc-L

Hi @404notfoundyc-L are you asking how to install a dependency inside a sandbox?

I'm not sure from what app is the UI you shared - that's not from us so not sure how they're handling it

mlejva avatar Jul 03 '24 06:07 mlejva

Hi @404notfoundyc-L are you asking how to install a dependency inside a sandbox?

I'm not sure from what app is the UI you shared - that's not from us so not sure how they're handling it

yes, I want to know how to install a dependency inside a sandbox. As the image I provided shows, I want to be able to customize and install some third-party dependencies to run the code.

404notfoundyc-L avatar Jul 03 '24 09:07 404notfoundyc-L

@404notfoundyc-L check out custom sandboxes. You can create your own custom sandbox with dependencies preinstalled. The other option is to install dependencies dynamically during runtime. You can do that by starting any process inside the sandbox (docs)

JS/TS

await sandbox.process.startAndWait("npm i ...")

Python

sandbox.process.start_and_wait("npm i ...")

mlejva avatar Jul 08 '24 19:07 mlejva

Hey @404notfoundyc-L, were you able to use the custom dependencies with your project?

ValentaTomas avatar Jul 22 '24 15:07 ValentaTomas

Hey @404notfoundyc-L, were you able to use the custom dependencies with your project?

yes, I install custom dependency with sandbox.process successfully. Thank you!

cy1665 avatar Aug 02 '24 13:08 cy1665