docker-pyinstaller
docker-pyinstaller copied to clipboard
Microsoft Visual C++ 9.0 is required
I'm using this great repo to create my Windows PyInstaller executables. Currently, I still have some projects in Python2 so I'm using the Python2 version and it needs the "Microsoft Visual C++ 9.0" to compile some of the modules.
I'm installing it in the docker like this:
wget -q -P "$W_TMP" https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi \
wine msiexec /i "$W_TMP"/VCForPython27.msi /qn
And it seems to work perfectly, the modules that I use compile and installed successfully.
I tried to add these steps to the Dockerfile like this:
# install Microsoft Visual C++ Compiler for Python 2.7
RUN set -x \
&& wget -q -P "$W_TMP" https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi \
&& wine msiexec /i "$W_TMP"/VCForPython27.msi /qn
It seems to be installed but when I try to install the python module I get the same error:
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
If I re-install it from inside the docker container it is working again. I'm not sure what I'm doing wrong and I prefer it will be part of the docker image instead of installing it for every build.
I will be happy to apply a PR if someone will help me to get it to work.
Interesting that you've actually got it working somewhat, last I checked one needed to use precompiled binary wheels for any native extensions.
@jameshilliard here is the output of the commands I'm using, you can see that installing netifaces
is failing, after installing the VCForPython27.msi
the installation worked
root@f4c42631d935:/src# pip install netifaces
0074:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting netifaces
Downloading netifaces-0.10.9.tar.gz (28 kB)
Could not build wheels for netifaces, since package 'wheel' is not installed.
Installing collected packages: netifaces
Running setup.py install for netifaces ... error
ERROR: Command errored out with exit status 1:
command: 'c:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\root\\temp\\pip-install-awadin\\netifaces\\setup.py'"'"'; __file__='"'"'c:\\users\\root\\temp\\pip-install-awadin\\netifaces\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\root\temp\pip-record-ylh6xf\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\Python27\Include\netifaces'
cwd: c:\users\root\temp\pip-install-awadin\netifaces\
Complete output (5 lines):
running install
running build
running build_ext
building 'netifaces' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\root\\temp\\pip-install-awadin\\netifaces\\setup.py'"'"'; __file__='"'"'c:\\users\\root\\temp\\pip-install-awadin\\netifaces\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\root\temp\pip-record-ylh6xf\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\Python27\Include\netifaces' Check the logs for full command output.
WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\Python27\python.exe -m pip install --upgrade pip' command.
root@f4c42631d935:/src# wget https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
--2020-07-27 09:07:21-- https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
Resolving download.microsoft.com (download.microsoft.com)... 95.100.204.183, 2001:41a8:45:38f::e59, 2001:41a8:45:3aa::e59, ...
Connecting to download.microsoft.com (download.microsoft.com)|95.100.204.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 87891968 (84M) [application/octet-stream]
Saving to: 'VCForPython27.msi'
VCForPython27.msi. 100%[======================================================================================================>] 83.82M 3.99MB/s in 20s
2020-07-27 09:07:41 (4.20 MB/s) - 'VCForPython27.msi' saved [87891968/87891968]
root@f4c42631d935:/src# wine msiexec /i VCForPython27.msi /qn
0078:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
0024:err:mscoree:LoadLibraryShim error reading registry key for installroot
0024:err:mscoree:LoadLibraryShim error reading registry key for installroot
0024:err:mscoree:LoadLibraryShim error reading registry key for installroot
0024:err:mscoree:LoadLibraryShim error reading registry key for installroot
root@f4c42631d935:/src# pip install netifaces
0078:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting netifaces
Using cached netifaces-0.10.9.tar.gz (28 kB)
Could not build wheels for netifaces, since package 'wheel' is not installed.
Installing collected packages: netifaces
Running setup.py install for netifaces ... done
Successfully installed netifaces-0.10.9
WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\Python27\python.exe -m pip install --upgrade pip' command.
root@f4c42631d935:/src#
For some reason that I cannot explain when installing in the Dockerfile while building the image, the files are created in Program Files (x86)
but installing netifaces
is failing until I'm running the installation again when the container is up.
Any suggestions?
I moved the same command from the Dockerfile
into the entrypoint.sh
script and it seems to work that way.
I don't really want to do it, it makes the start time pretty long to download the .msi file and install it (I can add the msi in the build time and only install in the entrypoint).
It seems a bit odd doing it like this, any suggestions what it is not working in the build time?