Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using apt-get in PRE_COMMANDS #3378

Closed
InvincibleRMC opened this issue Feb 14, 2024 · 9 comments
Closed

Using apt-get in PRE_COMMANDS #3378

InvincibleRMC opened this issue Feb 14, 2024 · 9 comments
Labels
question Further information is requested

Comments

@InvincibleRMC
Copy link

I'm sure I'm missing something but when I try to use apt-get it says no command apt-get. The reason I want to do this is so I can pip install pyqt6. This is failing because of a qmake error. The internet seems to suggest installing qt6-base-dev manually before using apt-get (or brew if on mac).

@InvincibleRMC InvincibleRMC added the question Further information is requested label Feb 14, 2024
@Jayllyz
Copy link
Contributor

Jayllyz commented Feb 14, 2024

Try : pip install PyQt6
MegaLinter doc about pre-commands : https://megalinter.io/latest/config-precommands/

@InvincibleRMC
Copy link
Author

It fails with the following error.

Collecting PyQt6
Downloading PyQt6-6.6.1.tar.gz (1.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 16.5 MB/s eta 0:00:00
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [26 lines of output]
    pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead
    Traceback (most recent call last):
      File "/venvs/mypy/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
        main()
      File "/venvs/mypy/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/venvs/mypy/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/pip-build-env-aomu3j8c/overlay/lib/python3.12/site-packages/sipbuild/api.py", line 46, in build_wheel
        project = AbstractProject.bootstrap('wheel',
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/pip-build-env-aomu3j8c/overlay/lib/python3.12/site-packages/sipbuild/abstract_project.py", line 92, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/tmp/pip-build-env-aomu3j8c/overlay/lib/python3.12/site-packages/sipbuild/project.py", line 587, in setup
        self.apply_user_defaults(tool)
      File "/tmp/pip-install-zatrlroh/pyqt6_5ece6f0ab94d4d61badd84a252fe12f2/project.py", line 66, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-aomu3j8c/overlay/lib/python3.12/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-aomu3j8c/overlay/lib/python3.12/site-packages/sipbuild/project.py", line 237, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/tmp/pip-build-env-aomu3j8c/overlay/lib/python3.12/site-packages/pyqtbuild/builder.py", line 69, in apply_user_defaults
        raise PyProjectOptionException('qmake',
    sipbuild.pyproject.PyProjectOptionException
    [end of output]

@nvuillam
Copy link
Member

@InvincibleRMC apt-get is not available because megalinter is based on alpine linux

Available packages are available at https://pkgs.alpinelinux.org/packages

About your pip error, maybe it requires so dependencies to be previously installed ?

@echoix
Copy link
Collaborator

echoix commented Feb 14, 2024

Megalinter is using an Alpine-based image. Alpine uses the apk (alpine package keeper) package manager. Apt, used with apt install or apt-get install is used with Debian-based distros like Ubuntu.

Does using a python package bundled by the OS work for you use case?

I think on alpine it is
https://pkgs.alpinelinux.org/package/v3.19/community/x86_64/py3-qt6

But installing from source might be impossible for you

Here, for pyqt5 https://stackoverflow.com/questions/76266695/cant-install-pyqt5-using-pip-on-alpine-docker, the user wasn't able to compile with 32 GB RAM, it ended up OOM (out of memory).

@echoix
Copy link
Collaborator

echoix commented Feb 14, 2024

Haha, @nvuillam was writing when I was writing too. The first missing dependency mentioned in your trace (qmake) could be installed with https://pkgs.alpinelinux.org/package/edge/community/x86_64/qt6-qtbase-dev as mentioned (for qt5) in the SO post I linked to.

@echoix
Copy link
Collaborator

echoix commented Feb 14, 2024

For your use case, I see it is for mypy, would a stub-only package be enough?

@InvincibleRMC
Copy link
Author

Yeah a stub file would be fine.

@InvincibleRMC
Copy link
Author

Thanks everyone for letting me know that is running Alpine Linux not sure how I missed that.

@InvincibleRMC
Copy link
Author

Ok finally got it working by using a third party stub package. Since my question has been answered I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants