lsb_release -a
Ubuntu: 20.04.5
Python3 --version
Python 3.8.10
pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
I have a Python script with the following imports that runs fine when I run python3 Program.py
import gi
gi.require_version('Gtk', '3.0')
import subprocess
import os.path
import re
import cairo
import json
import base64
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GdkPixBuf
from gi.repository import GLib
from gi.repository import Gio
from dataclasses import dataclass
from typing import List
I am trying to get these libraries downloaded to use for an offline situation as the computer running the program won't have internet access.
...
pip download subprocess
ERROR: Could not find a version that satisfies the requirement gi (from versions: none)
ERROR: No matching distribution found for gi
pip3 download subprocess
ERROR: Could not find a version that satisfies the requirement gi (from versions: none)
ERROR: No matching distribution found for gi
pip3 install gi
ERROR: Could not find a version that satisfies the requirement gi (from versions: none)
ERROR: No matching distribution found for gi
...
I have been trying to use pip through tutorials and other answers, but keep getting the "Could not find a version that satisfies the requirement gi" or other libraries besides gi. This has occurred when running against a requirements.txt file, or the single library in a pip command. For the gi library at least, I have seen some things online about gi being PyGObject for the sake of importing into newer python versions, but I don't understand why the imports have no issue in the program running normally then. But I also have the same issues with libraries like os and subprocess.
As you said, to use gi
, you need to run pip install PyGObject
. See the PyGObject docs.
Moreover, you are trying to install subprocess
using pip download/install subprocess
. The lib subprocess
is a built-in library, you don't need to install it: it should be already available to your script.
For more info, see the subprocess documentation.