1

I am facing issues with loading my code inside the Docker container.

My dockerfile is as follows :

 FROM python:3

USER ContainerAdministrator
RUN curl -fSLo vc_redist.x64.exe https://aka.ms/vs/16/release/vc_redist.x64.exe `
    && start /w vc_redist.x64.exe /install /quiet /norestart `
    && del vc_redist.x64.exe
RUN setx path "%path%;C:\Windows\SysWOW64"

ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH="$PYTHONPATH:/DeepLearningController"
COPY DeepLearningController /
COPY requirements.txt /

RUN pip install --upgrade pip
RUN pip --no-cache-dir install -r requirements.txt
RUN pip --no-cache-dir install tensorflow==2.2.0

CMD [ "python", "./DeepLearningController"] 

When I run this code I face an error :

ImportError: Could not find the DLL(s) 'msvcp140.dll or msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a directory that is named in your %PATH% environment variable. You may install these DLLs by downloading "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads

The same works perfectly if I use Linux containers on Docker. My Host OS is windows.

I have tried adding the python path in the dockerfile, but I am not sure why this is not working. Any suggestions would be great!

Thank you!

DragonsCanDance
  • 441
  • 4
  • 14
  • The error message tells pretty clear what you have to do: you need to install the redistributables into your image as well. Did you try to do this? – Daniel Junglas Aug 20 '20 at 15:19
  • @DanielJunglas, Thank you for the response. I am currently in the process to install the dll's, and currently even after installing "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019", the DLL's are not available in the environment Path. I have edited the question with additional information. Thanks. – DragonsCanDance Aug 21 '20 at 09:26
  • @DragonsCanDance "_be installed in a directory that is named in your %PATH% environment variable_" – hjpotter92 Aug 21 '20 at 09:36
  • 1
    First thing to try would be to double check that the `PATH` variable looks as expected. For example, are you sure that you don't need double back-slashes when you define the variable? You could try `RUN echo %PATH%` and check the output to make sure things look as expected. Next, make sure the DLLs are installed into the expected place. For example, by running `RUN dir C:\Windows\SysWOW64\msvcp140.dll` (and similarly for the other DLL). If all this is correct and things still do not work, then maybe add the path to `PYTHONPATH` environment variable as well? – Daniel Junglas Aug 24 '20 at 05:00
  • @DanielJunglas, Thank you I did try all the above solutions, but none really worked. The final straw was to copy those dll's physically from the host OS to the docker file system. Which partially worked, cropping up other unnecessary errors. I was not using linux containers due to an error with attaching windows network volumes as stated in these :https://stackoverflow.com/a/57510166/9338741 and https://stackoverflow.com/q/63487802/9338741. I focused my attention then, to solve this issue, which finally worked. Thank you for your suggestions. – DragonsCanDance Aug 24 '20 at 07:40

0 Answers0