Project

General

Profile

Actions

Bug #5666

closed

ModuleNotFoundError: No module named 'construct.lib.containers'

Added by r.groesbeek over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
08/29/2022
Due date:
% Done:

100%

Spec Reference:

Description

Hi,

Is there some handy thing I could debug this?

[root@changeme pysim ]# apt-get install -y python3-construct && ./pySim-read.py -p0
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-construct is already the newest version (2.8.16-0.4).
The following package was automatically installed and is no longer required:
libfwupdplugin1
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.
Traceback (most recent call last):
File "./pySim-read.py", line 31, in <module>
from pySim.ts_51_011 import EF, DF, EF_SST_map, EF_AD
File "/root/pysim/pySim/ts_51_011.py", line 32, in <module>
from pySim.profile import match_sim
File "/root/pysim/pySim/profile.py", line 24, in <module>
from pySim.commands import SimCardCommands
File "/root/pysim/pySim/commands.py", line 25, in <module>
from pySim.construct import LV
File "/root/pysim/pySim/construct.py", line 1, in <module>
from construct.lib.containers import Container, ListContainer
ModuleNotFoundError: No module named 'construct.lib.containers'
[root@changeme pysim ]#

Construct itself (from source) seems to work mostly as well

[root@changeme construct ]# make test
python3.9 -m pytest --benchmark-disable --showlocals =========================================================== test session starts ===========================================================
platform linux -- Python 3.9.5, pytest-7.1.2, pluggy-1.0.0
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /root/construct
plugins: benchmark-3.4.1, cov-3.0.0
collected 469 items

tests/test_benchmarks.py .......................................................................................................... [ 22%]
................................................................................................ [ 43%]
tests/test_compiler.py .. [ 43%]
tests/test_core.py ..............................................x........x...........................................x............ [ 67%]
....................................x..........x...xx.x.... [ 79%]
tests/test_expr.py .....xx.. [ 81%]
tests/test_multiprocessing.py . [ 82%]
tests/deprecated_gallery/test_formats.py .......... [ 84%]
tests/deprecated_gallery/test_protocols.py ...........x. [ 86%]
tests/gallery/test_gallery.py .. [ 87%]
tests/lib/test_binary.py .......... [ 89%]
tests/lib/test_bitstream.py .. [ 89%]
tests/lib/test_containers_dict.py .................................. [ 97%]
tests/lib/test_containers_list.py . [ 97%]
tests/lib/test_hex.py .. [ 97%]
tests/lib/test_py3compat.py .... [ 98%]
tests/lib/test_search.py ...... [100%]

===================================================== 458 passed, 11 xfailed in 4.17s =====================================================
[root@changeme construct ]#


Related issues

Blocked by pySim - Bug #5668: Jenkins build verification is broken: pylint crashesResolvedfixeria08/30/2022

Actions
Actions #1

Updated by fixeria over 1 year ago

  • Status changed from New to Rejected

You need a more recent python3-construct: at least v2.9.40 or better v2.10. v2.8.16 (released on Oct 1, 2017) is too old.

Actions #2

Updated by r.groesbeek over 1 year ago

Thnx for speedy response! (Much appreciated).

I got it working for a stock Ubuntu 20.04 LTS.
Could you update the docs accordingly?

[root@changeme ~]# dpkg -r python3-construct
[root@changeme ~]# git clone https://github.com/construct/construct.git && cd construct
[root@changeme construct ]# python3 setup.py install
running install
running bdist_egg
running egg_info
writing construct.egg-info/PKG-INFO
writing dependency_links to construct.egg-info/dependency_links.txt
writing requirements to construct.egg-info/requires.txt
writing top-level names to construct.egg-info/top_level.txt
reading manifest file 'construct.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'construct.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/construct
copying build/lib/construct/version.py -> build/bdist.linux-x86_64/egg/construct
copying build/lib/construct/debug.py -> build/bdist.linux-x86_64/egg/construct
copying build/lib/construct/expr.py -> build/bdist.linux-x86_64/egg/construct
creating build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/lib/hex.py -> build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/lib/bitstream.py -> build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/lib/py3compat.py -> build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/lib/binary.py -> build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/lib/containers.py -> build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/lib/__init__.py -> build/bdist.linux-x86_64/egg/construct/lib
copying build/lib/construct/core.py -> build/bdist.linux-x86_64/egg/construct
copying build/lib/construct/__init__.py -> build/bdist.linux-x86_64/egg/construct
byte-compiling build/bdist.linux-x86_64/egg/construct/version.py to version.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/debug.py to debug.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/expr.py to expr.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/lib/hex.py to hex.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/lib/bitstream.py to bitstream.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/lib/py3compat.py to py3compat.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/lib/binary.py to binary.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/lib/containers.py to containers.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/lib/__init__.py to init.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/core.py to core.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/construct/__init__.py to init.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying construct.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying construct.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying construct.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying construct.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying construct.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/construct-2.10.68-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing construct-2.10.68-py3.8.egg
Copying construct-2.10.68-py3.8.egg to /usr/local/lib/python3.8/dist-packages
Adding construct 2.10.68 to easy-install.pth file

Installed /usr/local/lib/python3.8/dist-packages/construct-2.10.68-py3.8.egg
Processing dependencies for construct==2.10.68
Finished processing dependencies for construct==2.10.68
[root@changeme construct ]#

[root@changeme pysim ]# ./pySim-read.py -p 0
Using PC/SC reader interface
Reading ...
Autodetected card type: sysmoUSIM-SJS1
.....

Actions #3

Updated by laforge over 1 year ago

  • Status changed from Rejected to New
  • Assignee set to fixeria

fixeria, that was a bit quick to disregard the issue. Indeed, if you are arware of the specific minimal version requirements, please submit a patch to add it to setup.py/requirements.txt - thanks!

Actions #4

Updated by fixeria over 1 year ago

  • Status changed from New to In Progress

laforge wrote in #note-3:

that was a bit quick to disregard the issue. Indeed, if you are arware of the specific minimal version requirements, please submit a patch to add it to setup.py/requirements.txt - thanks!

https://gerrit.osmocom.org/c/pysim/+/29226 construct: use Python's API for int<->bytes conversion [NEW]
https://gerrit.osmocom.org/c/pysim/+/29227 Bump minimum required construct version to v2.9.51 [NEW]
https://gerrit.osmocom.org/c/pysim/+/29228 README.md,requirements.txt: add missing construct version info [NEW]

Actions #5

Updated by fixeria over 1 year ago

  • Blocked by Bug #5668: Jenkins build verification is broken: pylint crashes added
Actions #6

Updated by fixeria over 1 year ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

All patches merged, wiki updated. Marking this ticket as Resolved. @r.groesbeek please re-open if something is still missing.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)