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. How to recreate a necessary and minimal virtual env
Forum Updated to NodeBB v4.3 + New Features

How to recreate a necessary and minimal virtual env

Scheduled Pinned Locked Moved Unsolved Qt for Python
11 Posts 3 Posters 1.1k Views 2 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.
  • J Offline
    J Offline
    jaaf
    wrote on 27 Jun 2023, 14:44 last edited by
    #1

    Hi,
    I have a PyQt6 application that was developed on a virtual environment. I try to dockerize this app but when trying to install the requirements with pip a dozen of the requirements fail with a message as this:

    ERROR: Could not find a version that satisfies the requirement libcomps==0.1.18 (from versions: 0.1.11.post1, 0.1.14.post1, 0.1.15.post1)
    ERROR: No matching distribution found for libcomps==0.1.18

    I created my requirements file with
    pip freeze >requirement.txt

    I am thinking that there are a lot of superfluous packages installed.
    Therefore I created a new virtual env and launched my application that complained about missing packages. I installed the claimed packages (whose list is dramatically shorter) and I could run my app but there are some dysfunctions. The most evident is a QTabWidget that displays 7 tab in the original virtual env and in the real env but displays only one tab in the new virtual env.

    Your help is welcome.

    S 1 Reply Last reply 27 Jun 2023, 17:20
    0
    • S SGaist moved this topic from General and Desktop on 27 Jun 2023, 14:46
    • J jaaf
      27 Jun 2023, 14:44

      Hi,
      I have a PyQt6 application that was developed on a virtual environment. I try to dockerize this app but when trying to install the requirements with pip a dozen of the requirements fail with a message as this:

      ERROR: Could not find a version that satisfies the requirement libcomps==0.1.18 (from versions: 0.1.11.post1, 0.1.14.post1, 0.1.15.post1)
      ERROR: No matching distribution found for libcomps==0.1.18

      I created my requirements file with
      pip freeze >requirement.txt

      I am thinking that there are a lot of superfluous packages installed.
      Therefore I created a new virtual env and launched my application that complained about missing packages. I installed the claimed packages (whose list is dramatically shorter) and I could run my app but there are some dysfunctions. The most evident is a QTabWidget that displays 7 tab in the original virtual env and in the real env but displays only one tab in the new virtual env.

      Your help is welcome.

      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Jun 2023, 17:20 last edited by SGaist
      #2

      Hi and welcome to devnet,

      Does any of these tabs creation have something to do with the dependencies that are now absent ?

      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
      • J Offline
        J Offline
        jaaf
        wrote on 28 Jun 2023, 03:56 last edited by jaaf
        #3

        Hi, thank you for your welcome and for caring about my problem.
        Since I posted my question I went a bit further.
        Using the QtDesigner 6 I observed that the QTabWidget has a strange behavior.
        Admit that it has 4 tabs. Tab1 ... Tab4.
        When saving the form, if Tab4 is selected after converting it with pyuic6 when the app is running the QTabWidget appears with only Tab4 displayed. In this case there is no mean to make the others tabs show up.
        But if Tab3 is selected when saving the form, Tab3 and Tab4 show up with Tab3 selected. In this case, selecting Tab4 makes the other Tabs appears. This is not satisfying as the user cannot see the other tabs at start up but it is much better than the previous situation.
        Eventually, saving the form with Tab1 selected makes all the Tabs appear at start up, and this is good for the user of the app.
        Do you think this is a normal behaviour or a bug to be reported ?
        To answer your question it seems that this issue has nothing to do with the absent dependencies.
        I also meet an other malfunctioning that I must investigate deeper.

        BTW I didn't receive a notification when you answered my post although I selected "Watchin" in the toolbar above ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 28 Jun 2023, 06:23 last edited by
          #4

          Can you provide a minimal script and .ui file that shows this issue ? It seems quite strange that setting a specific tab hides the others.

          As for the notifications, they should be on. You can check that in your account settings. If already checked, try to toggle the setting. I remember having to do that a long time ago.

          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
          1
          • J Offline
            J Offline
            jaaf
            wrote on 28 Jun 2023, 09:19 last edited by
            #5

            Hi,
            I tried to make a mini project with only a main window containing a QTabWidget with several tabs.
            I also reproduced the virtual env that has no problem and the other that has problem.
            I could not reproduce the malfunctioning. Both venv works properly.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jaaf
              wrote on 29 Jun 2023, 04:29 last edited by jaaf
              #6

              I could investigate a little further. I made some tests that show the the issue is inherent to the ui file not the rest of the application.
              The issue can be reproduced in the designer itself (here QtDesigner 6).
              If I select the last tab and save the file, then the preview shows only one tab and the others cannot show up.
              i I select on intermediary tab and save the file, then the preview shows initially the last tabs but the others show up when I change the selection.
              If I select the first tab, all is good.

              Give it a try yourself
              link text

              You can even reproduce this behaviour with fresh new mainwindow in which you add a QTabWidget with some tabs. Selecting one tab and looking at the preview.

              J 1 Reply Last reply 29 Jun 2023, 08:06
              0
              • J jaaf
                29 Jun 2023, 04:29

                I could investigate a little further. I made some tests that show the the issue is inherent to the ui file not the rest of the application.
                The issue can be reproduced in the designer itself (here QtDesigner 6).
                If I select the last tab and save the file, then the preview shows only one tab and the others cannot show up.
                i I select on intermediary tab and save the file, then the preview shows initially the last tabs but the others show up when I change the selection.
                If I select the first tab, all is good.

                Give it a try yourself
                link text

                You can even reproduce this behaviour with fresh new mainwindow in which you add a QTabWidget with some tabs. Selecting one tab and looking at the preview.

                J Offline
                J Offline
                JonB
                wrote on 29 Jun 2023, 08:06 last edited by JonB
                #7

                @jaaf

                I could investigate a little further. I made some tests that show the the issue is inherent to the ui file not the rest of the application.

                Before analyzing what you say any further: please make it 100% clear whether you only see this issue when previewing in Designer or whether it happens at runtime when you execute your program?

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jaaf
                  wrote on 29 Jun 2023, 10:55 last edited by
                  #8

                  As I say in the first post of this thread, I first discovered the trouble at run time. Then after that I had this idea to check that with a simplified widget in the designer itself. It behaves the same i.e. as I describe in my last post.
                  What is more surprising is the fact that at run time with my original widget, the problem disappears when I deactivate my venv. But in Designer the behaviour remains the same whatever is the environment i.e. with the issue..

                  J 1 Reply Last reply 29 Jun 2023, 11:02
                  0
                  • J jaaf
                    29 Jun 2023, 10:55

                    As I say in the first post of this thread, I first discovered the trouble at run time. Then after that I had this idea to check that with a simplified widget in the designer itself. It behaves the same i.e. as I describe in my last post.
                    What is more surprising is the fact that at run time with my original widget, the problem disappears when I deactivate my venv. But in Designer the behaviour remains the same whatever is the environment i.e. with the issue..

                    J Offline
                    J Offline
                    JonB
                    wrote on 29 Jun 2023, 11:02 last edited by JonB
                    #9

                    @jaaf
                    And given that you are Python do you use pyqt6-uic or whatever it is to produce a .py source file from the .ui file before running your code or do you use loadUi() to read the .ui file at runtime, since you could be doing either?

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jaaf
                      wrote on 29 Jun 2023, 12:41 last edited by
                      #10

                      I use pyuic6 command to transform the .ui to .py.

                      J 1 Reply Last reply 29 Jun 2023, 14:42
                      0
                      • J jaaf
                        29 Jun 2023, 12:41

                        I use pyuic6 command to transform the .ui to .py.

                        J Offline
                        J Offline
                        JonB
                        wrote on 29 Jun 2023, 14:42 last edited by
                        #11

                        @jaaf
                        Then you can ignore the .ui file. The only thing that runs is the .py file. That will include whatever tab is selected initially from Designer. Check the code in that, play with it for different behaviour.

                        My guess is whatever you are/are not seeing is to do with Qt6 rather than PyQt6.

                        If behaviour varies between virtual environments examine what could be different. Possibly a change in path/files picked up.

                        1 Reply Last reply
                        0

                        1/11

                        27 Jun 2023, 14:44

                        • Login

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