How can I install Python library in ChatGPT Code Interpreter
Asked Answered
G

3

6

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?

Gemmiparous answered 12/7, 2023 at 6:58 Comment(0)
G
12

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

Gemmiparous answered 12/7, 2023 at 6:58 Comment(2)
permission denied after upgrade to python 3.11Mook
damn, that's a long conversationBenavides
B
3

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.

Bulldog answered 31/8, 2023 at 13:34 Comment(0)
P
1

Following the answer above and the example case, was able to install a package with providing a wheel file and promting:

give it a shot

"Find the correct site-packages directory by checking the location of an already installed package." "Extract the wheel file to a temporary location first, and then move the files to the site-packages directory."

Pinchpenny answered 4/8, 2023 at 16:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.