4.67 FAQ-1081 What should I do if I get "Could not install packages due to an EnvironmentError..." when install Python packages?

Last Update: 3/25/2021

When you install Python packages (no matter by Python Package menu or in Script Window), you may encounter error like the following one:

'ERROR: Could not install packages due to an EnvironmentError:

This problem probably happens to those packages which only have .tar.gz provided. If so, you can try solution 1 to workaround it.

Solution 1

  1. Manually download the *.tar.gz package you want to install.
  2. Run the following command in standalone pip command outside of Origin (which requires Python installed)
    pip wheel "FullFilePath.tar.gz" -w "FullTargetFileFolder"

    to generate *.whl file.
    For example, if you have downloaded package laserbeamsize-1.7.1.tar.gz to folder C:\Users\myusername\Downloads\, you can run the following command to generate the .whl file to C:\tmp folder:

    pip wheel "C:\Users\myusername\Downloads\laserbeamsize-1.7.1.tar.gz" -w "C:\tmp"
  3. Launch Origin. Run the following command in the Command Window to install the package:
    pip install "FullFilePath.whl"

If those packages which only have .tar.gz are written in C(or C++), above solution may probably not work. Please try solution 2 below.

Solution 2

You will need to either install a Windows complier like Visual Studio to build the file, or download it from some public websites.

Let's take package xclim and Bottleneck for example.

xclim depends on Bottleneck, while Bottleneck provides *.tar.gz file only.

  1. Download file Bottleneck-1.3.2-cp38-cp38-win_amd64.whl from:
  2. Put the file in folder C:\tmp\ for example.
  3. Launch Origin. Run LT script:
    pip install "C:\tmp\Bottleneck-1.3.2-cp38-cp38-win_amd64.whl" xclim

Note: If you cannot find the package from public websites, you may contact us for help, or install Visual Studio, and then try the solution 1 steps, which will become successfully building the *.whl files.

Keywords:python, pypi, pip, tar.gz, whl, install fail, package, pep517, EnvironmentError