Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. No modulo 'QtCore' Found - Windows Docker Container
Forum Updated to NodeBB v4.3 + New Features

No modulo 'QtCore' Found - Windows Docker Container

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 2 Posters 384 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rodrigoleao
    wrote on 9 Nov 2023, 16:57 last edited by
    #1

    There is a .py running some prediction model in this container on client's virtual machine.

    Files in deploy repository
    enter image description here

    1 - Requirements file

    matplotlib==3.4.3
    dill==0.3.4
    numpy==1.24.4
    pandas==2.0.3
    scikit-learn==1.1.3
    scipy==1.10.1
    seaborn==0.11.2
    Orange3==3.34.0
    PyQt5==5.15.9
    

    2 .py script (the only problem is in PyQt5 import, especifically QtCore)

    import os, sys
    import numpy as np
    import pandas as pd
    import logging
    import pickle
    import json
    from typing import List, Union
    from datetime import datetime, timedelta
    
    # import QtCore
    
    import PyQt5
    
    logger = logging.getLogger("VOA.%s" % __name__)
    
    class VOAModel():
    
        models_folder = os.path.dirname(__file__) #get .py file folder
    ...
    
    1. One of my attempts was to get the .pyd file of the module and import it locally inside .py but the same error was shown.

    I am stuck in this error:
    enter image description here

    Pip freeze in container
    enter image description here

    Python version in container
    enter image description here

    When installing the docker image all the requirements appear to be okay and installed, but when executing the process we have this error.

    There is no internet connection on this virtual machine and there is just a shared directory to move files.

    There is nothing with GUI in this process, it is just a machine learning model from orange that I dont know why use this module QtCore.

    Have already tried to do some stuffs like download .whl files from this libs and install locally in container, change lib versions and so on, but nothing works. The only problem is the import of module.

    Anyone have a clue?
    How can I get this import QtCore error fixed?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 9 Nov 2023, 19:55 last edited by
      #2

      Hi and welcome to devnet,

      What is this PyQt5.QtCore.pyd doing there ?
      You should move it out of your project structure.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply 9 Nov 2023, 20:37
      0
      • S SGaist
        9 Nov 2023, 19:55

        Hi and welcome to devnet,

        What is this PyQt5.QtCore.pyd doing there ?
        You should move it out of your project structure.

        R Offline
        R Offline
        rodrigoleao
        wrote on 9 Nov 2023, 20:37 last edited by
        #3

        @SGaist It was just some attemps to import the lib directly in the path structure, but it is there just as garbage, not being used

        S 1 Reply Last reply 9 Nov 2023, 21:46
        0
        • R rodrigoleao
          9 Nov 2023, 20:37

          @SGaist It was just some attemps to import the lib directly in the path structure, but it is there just as garbage, not being used

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 9 Nov 2023, 21:46 last edited by
          #4

          @rodrigoleao so as I wrote, remove it.

          Are you using a virtual environment ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply 10 Nov 2023, 11:06
          0
          • S SGaist
            9 Nov 2023, 21:46

            @rodrigoleao so as I wrote, remove it.

            Are you using a virtual environment ?

            R Offline
            R Offline
            rodrigoleao
            wrote on 10 Nov 2023, 11:06 last edited by rodrigoleao 11 Oct 2023, 11:06
            #5

            @SGaist this is the dockerfile used for generate de container

            #Windows Server 2016:
            #ARG WINDOWS_VERSION="10.0.14393.2248"
            #Windows Server 2019:
            ARG WINDOWS_VERSION="10.0.17763.737-amd64"
            FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}
            
            
            
            ARG PYTHON_PIP_VERSION=21.1.2
            
            WORKDIR C:/Temp
            SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"]
            
            COPY ./environment/Python38.zip .
            
            RUN Expand-Archive -Path "Python38.zip" -Destination "C:/Python"
            
            WORKDIR C:/Python/Python38
            
            COPY ./environment/get-pip-${PYTHON_PIP_VERSION}.py .
            
            RUN [String]::Format('@set PYTHON_PIP_VERSION={0}', $env:PYTHON_PIP_VERSION) | Out-File -FilePath 'pipver.cmd' -Encoding ASCII; \
                Remove-Item -Path "python38._pth"; \
                Expand-Archive -Path "python38.zip" -Destination "Lib/"; \
                Remove-Item -Path "python38.zip"; \
                New-Item -Type Directory -Path "DLLs";
            
            FROM mcr.microsoft.com/windows/nanoserver:${WINDOWS_VERSION}
            COPY --from=0 C:\\Python\\Python38 C:\\Python\\Python38
            
            ARG PYTHON_PIP_VERSION=21.1.2
            ENV PORT=8090
            
            # RUN cmd /c mklink C:\Python\Python38\python38.exe C:\Python\Python38\python.exe
            
            WORKDIR C:/Python/Python38
            
            USER Administrator
            
            ENV PYTHONPATH C:\\Python\\Python38;C:\\Python\\Python38\\Scripts;C:\\Python\\Python38\\DLLs;C:\\Python\\Python38\\Lib;C:\\Python\\Python38\\Lib\\plat-win;C:\\Python\\Python38\\Lib\\site-packages
            
            RUN setx.exe /m PATH %PATH%;%PYTHONPATH% && \
                setx.exe /m PYTHONPATH %PYTHONPATH% && \
                setx.exe /m PIP_CACHE_DIR C:\Users\ContainerUser\AppData\Local\pip\Cache && \
                reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
            
            # RUN echo %PATH%
            # RUN echo %PYTHONPATH%
            
            # https://soooprmx.com/archives/6471
            RUN assoc .py=Python.File && \
                assoc .pyc=Python.CompiledFile && \
                assoc .pyd=Python.Extension && \
                assoc .pyo=Python.CompiledFile && \
                assoc .pyw=Python.NoConFile && \
                assoc .pyz=Python.ArchiveFile && \
                assoc .pyzw=Python.NoConArchiveFile && \
                ftype Python.ArchiveFile="C:\Python\Python38\python.exe" "%1" %* && \
                ftype Python.CompiledFile="C:\Python\Python38\python.exe" "%1" %* && \
                ftype Python.File="C:\Python\Python38\python.exe" "%1" %* && \
                ftype Python.NoConArchiveFile="C:\Python\Python38\pythonw.exe" "%1" %* && \
                ftype Python.NoConFile="C:\Python\Python38\pythonw.exe" "%1" %*
            
            RUN call C:\Python\Python38\pipver.cmd && \
                %COMSPEC% /s /c "echo Installing pip==%PYTHON_PIP_VERSION% ..." && \
                %COMSPEC% /s /c "C:\Python\Python38\python.exe C:\Python\Python38\get-pip-21.1.2.py --disable-pip-version-check --no-cache-dir pip==%PYTHON_PIP_VERSION% --no-warn-script-location" && \
                echo Removing ... && \
                del /f /q C:\Python\Python38\get-pip-21.1.2.py C:\Python\Python38\pipver.cmd && \
                echo Checking installation... && \
                echo python version && \
                python --version && \
                echo Verifying pip installation... && \
                echo pip version && \
                pip --version && \
                echo Verification complete!
            
            WORKDIR C:/app
            
            COPY . .
            
            RUN pip install -r requirements.txt
            
            ENV ANALYZER_NAME=Q3_Cracker_Viscosidade
            ENV DELAY=30
            ENV LOG_DIR=C:/logs
            ENV PORT=8090
            
            CMD ["python", "api_analyzer.py"]
            
            S 1 Reply Last reply 10 Nov 2023, 21:02
            0
            • R rodrigoleao
              10 Nov 2023, 11:06

              @SGaist this is the dockerfile used for generate de container

              #Windows Server 2016:
              #ARG WINDOWS_VERSION="10.0.14393.2248"
              #Windows Server 2019:
              ARG WINDOWS_VERSION="10.0.17763.737-amd64"
              FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}
              
              
              
              ARG PYTHON_PIP_VERSION=21.1.2
              
              WORKDIR C:/Temp
              SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"]
              
              COPY ./environment/Python38.zip .
              
              RUN Expand-Archive -Path "Python38.zip" -Destination "C:/Python"
              
              WORKDIR C:/Python/Python38
              
              COPY ./environment/get-pip-${PYTHON_PIP_VERSION}.py .
              
              RUN [String]::Format('@set PYTHON_PIP_VERSION={0}', $env:PYTHON_PIP_VERSION) | Out-File -FilePath 'pipver.cmd' -Encoding ASCII; \
                  Remove-Item -Path "python38._pth"; \
                  Expand-Archive -Path "python38.zip" -Destination "Lib/"; \
                  Remove-Item -Path "python38.zip"; \
                  New-Item -Type Directory -Path "DLLs";
              
              FROM mcr.microsoft.com/windows/nanoserver:${WINDOWS_VERSION}
              COPY --from=0 C:\\Python\\Python38 C:\\Python\\Python38
              
              ARG PYTHON_PIP_VERSION=21.1.2
              ENV PORT=8090
              
              # RUN cmd /c mklink C:\Python\Python38\python38.exe C:\Python\Python38\python.exe
              
              WORKDIR C:/Python/Python38
              
              USER Administrator
              
              ENV PYTHONPATH C:\\Python\\Python38;C:\\Python\\Python38\\Scripts;C:\\Python\\Python38\\DLLs;C:\\Python\\Python38\\Lib;C:\\Python\\Python38\\Lib\\plat-win;C:\\Python\\Python38\\Lib\\site-packages
              
              RUN setx.exe /m PATH %PATH%;%PYTHONPATH% && \
                  setx.exe /m PYTHONPATH %PYTHONPATH% && \
                  setx.exe /m PIP_CACHE_DIR C:\Users\ContainerUser\AppData\Local\pip\Cache && \
                  reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
              
              # RUN echo %PATH%
              # RUN echo %PYTHONPATH%
              
              # https://soooprmx.com/archives/6471
              RUN assoc .py=Python.File && \
                  assoc .pyc=Python.CompiledFile && \
                  assoc .pyd=Python.Extension && \
                  assoc .pyo=Python.CompiledFile && \
                  assoc .pyw=Python.NoConFile && \
                  assoc .pyz=Python.ArchiveFile && \
                  assoc .pyzw=Python.NoConArchiveFile && \
                  ftype Python.ArchiveFile="C:\Python\Python38\python.exe" "%1" %* && \
                  ftype Python.CompiledFile="C:\Python\Python38\python.exe" "%1" %* && \
                  ftype Python.File="C:\Python\Python38\python.exe" "%1" %* && \
                  ftype Python.NoConArchiveFile="C:\Python\Python38\pythonw.exe" "%1" %* && \
                  ftype Python.NoConFile="C:\Python\Python38\pythonw.exe" "%1" %*
              
              RUN call C:\Python\Python38\pipver.cmd && \
                  %COMSPEC% /s /c "echo Installing pip==%PYTHON_PIP_VERSION% ..." && \
                  %COMSPEC% /s /c "C:\Python\Python38\python.exe C:\Python\Python38\get-pip-21.1.2.py --disable-pip-version-check --no-cache-dir pip==%PYTHON_PIP_VERSION% --no-warn-script-location" && \
                  echo Removing ... && \
                  del /f /q C:\Python\Python38\get-pip-21.1.2.py C:\Python\Python38\pipver.cmd && \
                  echo Checking installation... && \
                  echo python version && \
                  python --version && \
                  echo Verifying pip installation... && \
                  echo pip version && \
                  pip --version && \
                  echo Verification complete!
              
              WORKDIR C:/app
              
              COPY . .
              
              RUN pip install -r requirements.txt
              
              ENV ANALYZER_NAME=Q3_Cracker_Viscosidade
              ENV DELAY=30
              ENV LOG_DIR=C:/logs
              ENV PORT=8090
              
              CMD ["python", "api_analyzer.py"]
              
              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 10 Nov 2023, 21:02 last edited by
              #6

              Why are you using a Windows based image to run a python workload rather than the official Python images ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              9 Nov 2023, 16:57

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved