I need to install python packages gspread and google-api-python-client which my droplet (Ubuntu 24.04) was unable to locate. I’ve already tried apt install python3-gspread and similar variants, is there any other way to install these packages?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Heya,
Yep, you’re really close — the issue is that gspread
and google-api-python-client
are Python packages, not system packages.
So instead of using apt install
, you need to use pip
, which is the Python package installer.
Here’s exactly what you should do:
pip
is installedFirst, check if you have pip
for Python 3:
python3 -m pip --version
If that shows a version, you’re good. If not, install pip:
sudo apt update
sudo apt install python3-pip
gspread
and google-api-python-client
Now install the two libraries with pip:
python3 -m pip install gspread google-api-python-client
This will install them system-wide.
If this is for a project, it’s a good practice to use a virtual environment to avoid messing with system packages:
python3 -m venv myenv
source myenv/bin/activate
python3 -m pip install gspread google-api-python-client
That way your project dependencies are isolated.
Heya, @eb147ecc8fba46029a0e09a862aefa
gspread
and google-api-python-client
are not available through apt
, they must be installed with pip
.
Just run:
sudo apt install python3-pip
pip3 install gspread google-api-python-client
If you want it cleaner, you can also install them inside a virtual environment. Let me know if you want that version too!
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.