ModuleNotFoundError: No module named '_lzma'
See original GitHub issue🐛 Bug
Importing the latest version of torchvision==0.8.1 throws following error:
File "tor-example.py", line 2, in <module>
import torchvision
File "/home/zoran/MyProjects/mindsdb-examples/tor/lib/python3.7/site-packages/torchvision/__init__.py", line 7, in <module>
from torchvision import datasets
File "/home/zoran/MyProjects/mindsdb-examples/tor/lib/python3.7/site-packages/torchvision/datasets/__init__.py", line 6, in <module>
from .mnist import MNIST, EMNIST, FashionMNIST, KMNIST, QMNIST
File "/home/zoran/MyProjects/mindsdb-examples/tor/lib/python3.7/site-packages/torchvision/datasets/mnist.py", line 11, in <module>
import lzma
File "/usr/local/lib/python3.7/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
To Reproduce
Steps to reproduce the behavior:
- pip install torchvision
- import torchvision
Environment
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A
OS: Ubuntu 19.10 (x86_64)
GCC version: (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
Clang version: Could not collect
CMake version: version 3.13.4
Python version: 3.7 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.7.0
[pip3] torchvision==0.8.1
[conda] Could not collect
- PyTorch / torchvision Version (1.7.0 / 0.8.1):
- OS : Linux Ubuntu
- How you installed PyTorch / torchvision (
conda
,pip
, source): pip - Python version: 3.7.3
cc @pmeier
Issue Analytics
- State:
- Created 3 years ago
- Comments:16
Top 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' #27532
Can't import last pandas release (0.25.0). I've installed pandas using pipenv : $ pipenv --three $ pipenv shell [pandas-lzma ...
Read more >ModuleNotFoundError: No module named '_lzma' - vision
This means that the torchvision I have is broken or buggy. Can someone suggest a fix for this error. If u need a...
Read more >no module named '_lzma' when import torchvision ... - CodeThief
In my case, uninstall my current python version and install xz using homebrew and reinstall the python version that I removed. pyenv uninstall ......
Read more >ModuleNotFoundError: No module named 'pycopy-lzma'
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pycopy-lzma' How to remove the Module.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I came across this issue after installing python from source. It seems that I installed python without
liblzma-dev
. After installingliblzma-dev
and installing python again, the import error was gone.Thus issue occurs in 3.10 but not in 3.7 for me.