Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install Python library in ChatGPT Code Interpreter

ChatGPT is the newest platform for running Python in a Jupyter-like environment. However the installed libraries are limited. You cannot access the internet too. So, I cannot use pip to install.

How can I install a new library?

like image 494
korakot Avatar asked Aug 28 '26 11:08

korakot


2 Answers

You can upload a wheel file taken from PyPI, select cp38-manylinux_..._x86_64.whl and upload it.

Tell ChatGPT to unzip and move it to /home/sandbox/.local/lib/python3.8/site-packages/

Then you can import and use it normally.

Here's an example case where I install DuckDB: https://chat.openai.com/share/fa3df390-8a25-45d3-997a-c19d4f19df67

like image 117
korakot Avatar answered Aug 31 '26 02:08

korakot


Go to the https://pypi.org/ page for the package you went to install and download the ".whl" file for the package. Go back to GPT and upload the file as an attachment and then add the question. "What is this?"

THe AI will answer you and tell you that it cannot install it.

I want you to say this

"I know you can't install it but can you try anyway. I want to see the resulting error from the installation. "

Then the AI should try and install it.

I hope this helps!

Please be advised it sometimes triggers an "Our systems have detected unusual activity from your system. Please try again later." message.

like image 37
flyinggoatman Avatar answered Aug 31 '26 02:08

flyinggoatman