pip install specific version of a Python Package

If you want to install a specific version of a Python Package, then you can make use of the pip index version command to first know which all versions of the package are available.


Show the list of available versions of a Package

    % pip index versions rumps
    
    WARNING: pip index is currently an experimental command. 
    It may be removed/changed in a future release without prior warning.
    rumps (0.4.0)
    Available versions: 0.4.0, 0.3.0, 0.2.2, 0.2.1, 0.2.0, 0.1.5, 0.1.4
      INSTALLED: 0.4.0
      LATEST:    0.4.0
    

    As you can see, I have installed version 0.4.0 of package rumps and have 0.3.0, 0.2.2, 0.2.1, 0.2.0, 0.1.5, 0.1.4 available.


How to install a specific version of a pip package

    To install a specific version of a package, we make use of the pip install command followed by the package name and == then the version of the package that you want to install explicitly.

    Syntax:
    pip install <package-name>==<desired-version>

    Example:

    % pip install rumps==0.3.0
    
    Collecting rumps==0.3.0
      Downloading rumps-0.3.0.tar.gz (33 kB)
      Installing build dependencies ... done
    ...
    Installing collected packages: rumps
      Attempting uninstall: rumps
        Found existing installation: rumps 0.4.0
        Uninstalling rumps-0.4.0:
          Successfully uninstalled rumps-0.4.0
    Successfully installed rumps-0.3.0
    

    Now when I run the pip index version command, I see my installed version has changed to 0.3.0.

    % pip index versions rumps
    
    Available versions: 0.4.0, 0.3.0, 0.2.2, 0.2.1, 0.2.0, 0.1.5, 0.1.4
      INSTALLED: 0.3.0
      LATEST:    0.4.0
    Installing specific version of a Python Package

    Comments & Discussion

    Facing issues? Have questions? Post them here! We're happy to help!