This is the error I am getting:
Traceback (most recent call last):
File "reader.py", line 5, in <module>
import pandas as pd
File "/usr/local/lib/python3.7/site-packages/pandas/__init__.py", line 55, in <module>
from pandas.core.api import (
File "/usr/local/lib/python3.7/site-packages/pandas/core/api.py", line 24, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/usr/local/lib/python3.7/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import ( # noqa: F401
File "/usr/local/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 44, in <module>
from pandas.core.frame import DataFrame
File "/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 88, in <module>
from pandas.core.generic import NDFrame, _shared_docs
File "/usr/local/lib/python3.7/site-packages/pandas/core/generic.py", line 71, in <module>
from pandas.io.formats.format import DataFrameFormatter, format_percentiles
File "/usr/local/lib/python3.7/site-packages/pandas/io/formats/format.py", line 47, in <module>
from pandas.io.common import _expand_user, _stringify_path
File "/usr/local/lib/python3.7/site-packages/pandas/io/common.py", line 9, in <module>
import lzma
File "/usr/local/lib/python3.7/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
Traceback (most recent call last):
File "server.py", line 9, in <module>
from search import Search
File "/home/n_pawar0414/20deg-c/search.py", line 6, in <module>
import pandas as pd
File "/usr/local/lib/python3.7/site-packages/pandas/__init__.py", line 55, in <module>
from pandas.core.api import (
File "/usr/local/lib/python3.7/site-packages/pandas/core/api.py", line 24, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/usr/local/lib/python3.7/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import ( # noqa: F401
File "/usr/local/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 44, in <module>
from pandas.core.frame import DataFrame
File "/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 88, in <module>
from pandas.core.generic import NDFrame, _shared_docs
File "/usr/local/lib/python3.7/site-packages/pandas/core/generic.py", line 71, in <module>
from pandas.io.formats.format import DataFrameFormatter, format_percentiles
File "/usr/local/lib/python3.7/site-packages/pandas/io/formats/format.py", line 47, in <module>
from pandas.io.common import _expand_user, _stringify_path
File "/usr/local/lib/python3.7/site-packages/pandas/io/common.py", line 9, in <module>
import lzma
File "/usr/local/lib/python3.7/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
I have attempted to install pyenv as well as uninstall python and reinstall it with no luck
The code works on my laptop just fine and runs with no error, i only have the error when running my code on google cloud shell.
The requirements I have installed are:
pandas==0.25.0
nose==1.3.7
tornado==6.0.3
numpy==1.17.0
nltk==3.4.4
pyspellchecker==0.5.0
tqdm==4.32.2
ujson==1.35
cachetools==3.1.1
flask==1.1.1
flask_cors==3.0.8
gevent==1.4.0
openpyxl==2.6.2
xlrd==1.2.0
The issue is that there is no module named _lzma present in/on google cloud console
If you are using cloud shell, this is an expected behaviour since cloud shell vms are ephemeral and are not prepared to work like full development environment, for this reason the python installation is incomplete, you can use a compute engine always free instance to have an small and not preemptible instance to try your code.