Windows Python with Wine on Linux, but now in Docker












0















Here is a recipe for trouble:



because I have some hardware that can only talk to Windows Python I used Wine to run the Windows Python in Linux (Ubuntu). That worked.



Now I wanted to make this solution a bit more portable and do the same thing inside a Docker container.



Here is the minimal example dockerfile:



FROM ubuntu:18.04

#install wine
RUN apt-get update
RUN dpkg --add-architecture i386
RUN apt-get install -y software-properties-common wget unzip
RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key && apt-key add winehq.key && apt update
RUN apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
RUN apt-get update
RUN apt-get install -y --install-recommends winehq-stable
RUN wine wineboot --init


#now get python
RUN wget https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-amd64.zip
RUN unzip python-3.5.4-embed-amd64.zip -d python
RUN wget https://bootstrap.pypa.io/get-pip.py
#set random seed, otherwise python won't start
ENV PYTHONHASHSEED=1234
#get pip
RUN wine /python/python.exe get-pip.py


while this general approach worked when I ran this on Ubuntu without Docker, it fails when run inside this container:



Step 14/14 : RUN wine /python/python.exe get-pip.py
---> Running in 26b4f8ea85d6
0010:fixme:msvcrt:_configure_wide_argv (1) stub
0010:fixme:msvcrt:_initialize_wide_environment stub
Traceback (most recent call last):
File "get-pip.py", line 28, in <module>
import tempfile
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "tempfile.py", line 45, in <module>
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "random.py", line 727, in <module>
File "random.py", line 90, in __init__
File "random.py", line 112, in seed
OSError: [WinError -2146893801] Windows Error 0x80090017
The command '/bin/sh -c wine /python/python.exe get-pip.py' returned a non-zero code: 1


Anyone has an idea?










share|improve this question



























    0















    Here is a recipe for trouble:



    because I have some hardware that can only talk to Windows Python I used Wine to run the Windows Python in Linux (Ubuntu). That worked.



    Now I wanted to make this solution a bit more portable and do the same thing inside a Docker container.



    Here is the minimal example dockerfile:



    FROM ubuntu:18.04

    #install wine
    RUN apt-get update
    RUN dpkg --add-architecture i386
    RUN apt-get install -y software-properties-common wget unzip
    RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key && apt-key add winehq.key && apt update
    RUN apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
    RUN apt-get update
    RUN apt-get install -y --install-recommends winehq-stable
    RUN wine wineboot --init


    #now get python
    RUN wget https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-amd64.zip
    RUN unzip python-3.5.4-embed-amd64.zip -d python
    RUN wget https://bootstrap.pypa.io/get-pip.py
    #set random seed, otherwise python won't start
    ENV PYTHONHASHSEED=1234
    #get pip
    RUN wine /python/python.exe get-pip.py


    while this general approach worked when I ran this on Ubuntu without Docker, it fails when run inside this container:



    Step 14/14 : RUN wine /python/python.exe get-pip.py
    ---> Running in 26b4f8ea85d6
    0010:fixme:msvcrt:_configure_wide_argv (1) stub
    0010:fixme:msvcrt:_initialize_wide_environment stub
    Traceback (most recent call last):
    File "get-pip.py", line 28, in <module>
    import tempfile
    File "<frozen importlib._bootstrap>", line 968, in _find_and_load
    File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
    File "tempfile.py", line 45, in <module>
    File "<frozen importlib._bootstrap>", line 968, in _find_and_load
    File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
    File "random.py", line 727, in <module>
    File "random.py", line 90, in __init__
    File "random.py", line 112, in seed
    OSError: [WinError -2146893801] Windows Error 0x80090017
    The command '/bin/sh -c wine /python/python.exe get-pip.py' returned a non-zero code: 1


    Anyone has an idea?










    share|improve this question

























      0












      0








      0








      Here is a recipe for trouble:



      because I have some hardware that can only talk to Windows Python I used Wine to run the Windows Python in Linux (Ubuntu). That worked.



      Now I wanted to make this solution a bit more portable and do the same thing inside a Docker container.



      Here is the minimal example dockerfile:



      FROM ubuntu:18.04

      #install wine
      RUN apt-get update
      RUN dpkg --add-architecture i386
      RUN apt-get install -y software-properties-common wget unzip
      RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key && apt-key add winehq.key && apt update
      RUN apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
      RUN apt-get update
      RUN apt-get install -y --install-recommends winehq-stable
      RUN wine wineboot --init


      #now get python
      RUN wget https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-amd64.zip
      RUN unzip python-3.5.4-embed-amd64.zip -d python
      RUN wget https://bootstrap.pypa.io/get-pip.py
      #set random seed, otherwise python won't start
      ENV PYTHONHASHSEED=1234
      #get pip
      RUN wine /python/python.exe get-pip.py


      while this general approach worked when I ran this on Ubuntu without Docker, it fails when run inside this container:



      Step 14/14 : RUN wine /python/python.exe get-pip.py
      ---> Running in 26b4f8ea85d6
      0010:fixme:msvcrt:_configure_wide_argv (1) stub
      0010:fixme:msvcrt:_initialize_wide_environment stub
      Traceback (most recent call last):
      File "get-pip.py", line 28, in <module>
      import tempfile
      File "<frozen importlib._bootstrap>", line 968, in _find_and_load
      File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
      File "tempfile.py", line 45, in <module>
      File "<frozen importlib._bootstrap>", line 968, in _find_and_load
      File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
      File "random.py", line 727, in <module>
      File "random.py", line 90, in __init__
      File "random.py", line 112, in seed
      OSError: [WinError -2146893801] Windows Error 0x80090017
      The command '/bin/sh -c wine /python/python.exe get-pip.py' returned a non-zero code: 1


      Anyone has an idea?










      share|improve this question














      Here is a recipe for trouble:



      because I have some hardware that can only talk to Windows Python I used Wine to run the Windows Python in Linux (Ubuntu). That worked.



      Now I wanted to make this solution a bit more portable and do the same thing inside a Docker container.



      Here is the minimal example dockerfile:



      FROM ubuntu:18.04

      #install wine
      RUN apt-get update
      RUN dpkg --add-architecture i386
      RUN apt-get install -y software-properties-common wget unzip
      RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key && apt-key add winehq.key && apt update
      RUN apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
      RUN apt-get update
      RUN apt-get install -y --install-recommends winehq-stable
      RUN wine wineboot --init


      #now get python
      RUN wget https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-amd64.zip
      RUN unzip python-3.5.4-embed-amd64.zip -d python
      RUN wget https://bootstrap.pypa.io/get-pip.py
      #set random seed, otherwise python won't start
      ENV PYTHONHASHSEED=1234
      #get pip
      RUN wine /python/python.exe get-pip.py


      while this general approach worked when I ran this on Ubuntu without Docker, it fails when run inside this container:



      Step 14/14 : RUN wine /python/python.exe get-pip.py
      ---> Running in 26b4f8ea85d6
      0010:fixme:msvcrt:_configure_wide_argv (1) stub
      0010:fixme:msvcrt:_initialize_wide_environment stub
      Traceback (most recent call last):
      File "get-pip.py", line 28, in <module>
      import tempfile
      File "<frozen importlib._bootstrap>", line 968, in _find_and_load
      File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
      File "tempfile.py", line 45, in <module>
      File "<frozen importlib._bootstrap>", line 968, in _find_and_load
      File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
      File "random.py", line 727, in <module>
      File "random.py", line 90, in __init__
      File "random.py", line 112, in seed
      OSError: [WinError -2146893801] Windows Error 0x80090017
      The command '/bin/sh -c wine /python/python.exe get-pip.py' returned a non-zero code: 1


      Anyone has an idea?







      linux python docker wine






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 7 at 13:56









      SebastianSebastian

      1515




      1515






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403137%2fwindows-python-with-wine-on-linux-but-now-in-docker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403137%2fwindows-python-with-wine-on-linux-but-now-in-docker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

          Eduardo VII do Reino Unido