question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Last release trigger ModuleNotFoundError: No module named '_lzma'

See original GitHub issue

Since the last release, our tensorflow/datasets tests are failing with E ModuleNotFoundError: No module named '_lzma'. Triggered by:

/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/fastavro/_read_py.py:12: in <module>
    import lzma

Is it expected ? Is there a solution ?


_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tensorflow_datasets/testing/dataset_builder_testing.py:305: in test_download_and_prepare_as_dataset
    self._download_and_prepare_as_dataset(builder)
tensorflow_datasets/testing/dataset_builder_testing.py:365: in _download_and_prepare_as_dataset
    import apache_beam as beam   # pylint: disable=import-outside-toplevel,g-import-not-at-top
/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/apache_beam/__init__.py:95: in <module>
    from apache_beam import coders
/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/apache_beam/coders/__init__.py:19: in <module>
    from apache_beam.coders.coders import *
/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/apache_beam/coders/coders.py:46: in <module>
    from apache_beam.coders import coder_impl
apache_beam/coders/coder_impl.py:53: in init apache_beam.coders.coder_impl
    ???
/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/fastavro/__init__.py:47: in <module>
    import fastavro.read
/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/fastavro/read.py:4: in <module>
    from . import _read_py as _read  # type: ignore
/home/kbuilder/virtualenv/tfds_env/lib/python3.6/site-packages/fastavro/_read_py.py:12: in <module>
    import lzma
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """

    __all__ = [
        "CHECK_NONE", "CHECK_CRC32", "CHECK_CRC64", "CHECK_SHA256",
        "CHECK_ID_MAX", "CHECK_UNKNOWN",
        "FILTER_LZMA1", "FILTER_LZMA2", "FILTER_DELTA", "FILTER_X86", "FILTER_IA64",
        "FILTER_ARM", "FILTER_ARMTHUMB", "FILTER_POWERPC", "FILTER_SPARC",
        "FORMAT_AUTO", "FORMAT_XZ", "FORMAT_ALONE", "FORMAT_RAW",
        "MF_HC3", "MF_HC4", "MF_BT2", "MF_BT3", "MF_BT4",
        "MODE_FAST", "MODE_NORMAL", "PRESET_DEFAULT", "PRESET_EXTREME",

        "LZMACompressor", "LZMADecompressor", "LZMAFile", "LZMAError",
        "open", "compress", "decompress", "is_check_supported",
    ]

    import builtins
    import io
    import os
>   from _lzma import *
E   ModuleNotFoundError: No module named '_lzma'

/home/kbuilder/.pyenv/versions/3.6.8/lib/python3.6/lzma.py:27: ModuleNotFoundError

Full logs: https://source.cloud.google.com/results/invocations/e89f8616-7250-42ee-bae5-0b4b01dd2f2e/targets/tensorflow_datasets%2Fgh_testing%2Fsubjobs%2Fpy3_tfnightly/log

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
gshaikovcommented, Nov 3, 2020

Found solution, I am using 3.7.0, probably works with other versions:

pyenv local --unset
pyenv uninstall -f 3.7.0
sudo apt-get -y update
sudo apt-get -y install --no-install-recommends liblzma-dev
pyenv install -f 3.7.0

Better solution though is to update machine image you’re and install the lzma library before installing pipenv.

0reactions
Conchylicultorcommented, Nov 4, 2020

Closing this. Installing liblzma-dev works (with the caveat this has to be installed before Pyenv). If anything, this should be a Pyenv bug. Thank you for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named '_lzma' when building python using pyenv ...
The reason is that the module you're trying to use is implemented in C ... <module> from _lzma import * ModuleNotFoundError: No module...
Read more >
ModuleNotFoundError: No module named '_lzma' - vision
I'm using python 3.7.10 with torch 1.81 and torchvision 0.9.1 in my machine and while importing dset from torchvision.dataset this error ...
Read more >
Changelog — Python 3.11.1 documentation
The errno modules exposes the new error number. getpath.py now ignores PermissionError when it cannot open landmark files pybuilddir.txt and ...
Read more >
ModuleNotFoundError: No module named 'pip' in Python
The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, install the...
Read more >
Failure Exception: ModuleNotFoundError: No module named ...
Result: Failure Exception: ModuleNotFoundError: No module named 'requests', HTTP Trigger of Azure Function with Python 500. Hello community,.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found