Failed to create virtualenv or venv on certain Windows7 PC using Winpython 3.8.10 distribution

28 Views Asked by At

I have an installer script, my python project whl file and Winpython 3.8.10, all bundled using pyinstaller. When executed, will run the following process.

  1. Unpack pyinstaller bundle
  2. Copy Winpython 3.8.10 dist folder (py_dist) to a location
  3. Execute Winpython to create virtual environment - py_dist\python.exe -m venv base_env
  4. Perform pip install in the virtual environment - base_env\Scripts\python.exe -m pip install mypackage.whl

During step 3, I encounter, for some Windows 7 PC, error creating virtual environment. the traceback ended with the following:

subprocess.CalledPRocessError: Command "['base_env\Scripts\python.exe', 'Im', 'ensurepip', '--upgrade', '--default-pip']" returned non zero exit status 1.

I performed the command manually and it returned another layer of subprocess error.

subprocess.CalledProcessError: Command '[..... long string of command ...]' returned non zero exit status 1.

I also encountered pyexpat import error when performing pip install into the Winpython dist directly.

    from pyexpat import *
ImportError: DLL load failed while importing pyexpat: The parameter is incorrect

I did a comparison between a successful windows 7 and an unsuccessful windows 7, I found some difference in Visual C++ versions and .NET Frameworks. But updating them did not resolve issues.

The successful Windows 7 had a large number of windows update, while the other PC did not. Since the computers are in an air-gapped environment, it means I have to download and transfer into the PC through my Client's portal and then transfer to troubleshoot the issue.

I also tried to install Original Python Distribution, 3.8.10. amd64, I could not install due to missing windows update, KB2533623 and KB3063858. I pushed in the windows update, but failed to update windows. The message was "This update is not applicable to your computer".

I'm wondering does anyone here knows what is the problem with the windows 7 PC? I'm running out of ideas and my only options is to use Python 3.8.10 portable to run my python scripts.

0

There are 0 best solutions below