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

Problems getting python-apt properly installed #4741

Closed
1 of 7 tasks
elear opened this issue Dec 15, 2021 · 6 comments
Closed
1 of 7 tasks

Problems getting python-apt properly installed #4741

elear opened this issue Dec 15, 2021 · 6 comments
Assignees
Labels
Area: Python investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Ubuntu

Comments

@elear
Copy link

elear commented Dec 15, 2021

Description

I am struggling to find a way to get python apt modules to properly load. This is for a program that needs to examine the install using apt.cache and apt.package etc.

I've tried whacking both the PYTHONPATH and LD_LIBRARY_PATH but I am still eating it. Thanks for any and all help.

Virtual environments affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

ubuntu-latest with python 3.9.9 (I image it would recur with 3.10 as well).

Is it regression?

don't know

Expected behavior

No traceback

Actual behavior

 Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.9/x64/bin/apt2sbom", line 5, in <module>
    from apt2sbom import cli
  File "/home/runner/work/apt2sbom/apt2sbom/apt2sbom/__init__.py", line 7, in <module>
    from .dp2json import *
  File "/home/runner/work/apt2sbom/apt2sbom/apt2sbom/dp2json.py", line 11, in <module>
    from apt.cache import Cache
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Error: Process completed with exit code 1.

Repro steps

apt install python-apt
or
apt install python3-apt

foo.py:

from apt.cache import Cache
@nikolai-frolov nikolai-frolov added Area: Python investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Ubuntu and removed needs triage labels Dec 15, 2021
@nikolai-frolov
Copy link
Contributor

Hello @elear. Thanks for reporting, we'll take care about the issue investigation.

@V-Zabayrachny V-Zabayrachny self-assigned this Dec 15, 2021
@V-Zabayrachny
Copy link
Contributor

V-Zabayrachny commented Dec 16, 2021

Hello @elear. Could you share your workflow, please? The usage scenario is a bit unclear for us at the moment.

@elear
Copy link
Author

elear commented Dec 16, 2021

Of course, @V-Zabayrachny. If you have a look at apt2sbom, and check out the fix-integration branch, you can see all of my toils, exposed to the world. Check out pylint.yml, and blame away. README.md explains what I'm trying to do. I've held off on further CI/CD actions until you guys have had a chance to tell me what I'm doing wrong ;-)

@elear
Copy link
Author

elear commented Dec 16, 2021

Sorry link correction: https://github.com/elear/apt2sbom.

@V-Zabayrachny
Copy link
Contributor

V-Zabayrachny commented Dec 16, 2021

@elear, I would like to clarify how pythons are installed on our Ubuntu20 image. What we have is:

@elear
Copy link
Author

elear commented Dec 16, 2021

Ok, thanks for the advice. I understand the difficulty in this case, so I'm sticking right now with just the built in ubuntu version of python.

@elear elear closed this as completed Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Python investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Ubuntu
Projects
None yet
Development

No branches or pull requests

3 participants