cannot import name 'Appender' from 'statsmodels.compat.pandas' in google colab error? - google-colaboratory

I am trying to import from pmdarima.arima import auto_arima and
from pmdarima.arima import ADFTest but it giving me error cannot import name 'Appender' from 'statsmodels.compat.pandas'
I tried !pip install pmdarima in google colab but it is still giving me error

I had the same and fixed it by downgrading scipy
pip install pmdarima scipy==1.2 -Uqq
got it from How to fix Google colab import errors on statsmodels logsumexp and factorial
A restart of the runtime environment was needed after installation.

Related

Cannot import name 'to_html' from 'pandas_profiling.report' using JupyterLab

I'm new using Jupyter Lab and Pandas profiling.
I'm trying to install and import and install Pandas Profiling in a jupyter notebook. I'm able to install pandas collab using pip, but unable to import the library. The error says I cannot import name 'to_html' from 'pandas_profiling.report'.
Here's the code and the error.
Funny thing is: I also tried to run the notebook in Google Colab, but I got a different but similar error:
ImportError: cannot import name 'PandasProfiling' from 'pandas_profiling' (/usr/local/lib/python3.8/dist-packages/pandas_profiling/__init__.py)
I already tried to use Jupyter Lab and Jupyter Notebook from Anaconda and Google Colab to see if it works, but no look.
conda install -c conda-forge pandas-profiling
See this question.
from pandas_profiling import ProfileReport
https://pandas-profiling.ydata.ai/docs/master/pages/getting_started/quickstart.html
PandasProfiling object does not exist.

Importing TensorFlow "async" syntax error

I am trying to use the module imageai for a project and ran the line "from imageai.Detection import ObjectDetection". However, when I do so, this error appears:
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/pywrap_tensorflow_internal.py:114
def TFE_ContextOptionsSetAsync(arg1, async):
^
SyntaxError: invalid syntax
I found someone who had the same issue here: https://github.com/tensorflow/tensorflow/issues/20690 , but I'm not quite sure how to edit the last file of the trace where the error occurs. Does anyone have any tips on how to do this? Thanks!
I have tried looking at the above GitHub error but am not sure how to approach it.
ImageAI uses Pytorch as backend. So you need to install all the required libraries before installing and importing the imageai module.
Please use the code below to install imageai in your system:
pip install cython pillow>=7.0.0 numpy>=1.18.1 opencv-python>=4.1.2 torch>=1.9.0 --extra-index-url https://download.pytorch.org/whl/cpu torchvision>=0.10.0 --extra-index-url https://download.pytorch.org/whl/cpu pytest==7.1.3 tqdm==4.64.1 scipy>=1.7.3 matplotlib>=3.4.3 mock==4.0.3
pip install imageai --upgrade
Now, import the Object detection from imageai:
from imageai.Detection import ObjectDetection
Please refer this link for more details.
Note: You can easily install imageai in Google Colab with this code
!pip install imageai
from imageai.Detection import ObjectDetection
Hints: Please use below code to install, import and check the TensorFlow version
pip install tensorflow
import tensorflow as tf
tf.__version__

ANACONDA "ModuleNotFoundError: No module named 'pandas.tslib'" in pandas python

I would like to run below code but I received an error in my anaconda environment. How can I solve this issue in Anaconda? Please help!
Thank you.
import pandas as pd
import numpy as np
from statsmodels.tools.eval_measures import rmse, aic
from darts import TimeSeries
from darts.utils.timeseries_generation import gaussian_timeseries, linear_timeseries
from darts.models import RNNModel, TCNModel, TransformerModel, NBEATSModel, BlockRNNModel
from darts.metrics import mape, smape
from darts.utils.timeseries_generation import datetime_attribute_timeseries
After I tried
conda uninstall pandas
conda install pandas
Error message becomes :
Check the corresponding path, if you do not find pandas._libs.tslib module then you would have to uninstall pandas and reinstall again.
conda uninstall pandas
conda install pandas
You can also check if the version of pandas you are using is consistent with the version of python

pandas_profiling.ProfileReport(dataframe) in google colab

Why doesn't pandas_profiling.ProfileReport(dataframe) work in google colab?
Returns a type error.
TypeError: concat() got an unexpected keyword argument 'join_axes'
Just use pandas-profiling version 2.7.1 and you are good to go.Run this command in the colab !pip install pandas-profiling==2.7.1
Aishah Ismail's post on Medium may help you fix this issue.
Install the pandas-profiling package using pip.
! pip install https://github.com/pandas-profiling/pandas-profiling/archive/master.zip
Restart your kernel = Go to "Runtime" in the option menu and click "Reset All Runtimes"
Execute your code to create your dataframe and create the pandas profile.
import pandas as pd
import numpy as np
from pandas_profiling import ProfileReport
df = pd.read_excel('fileName.xlsx')
profile = ProfileReport(df)
profile.to_notebook_iframe()
You may need to pip install pandas-profiling if the import above does not work.
!pip install pandas-profiling==2.7.1 Re-execute your code after the pip install.
When you try to display the profile do not use .to_widgets()--it isn't working in Colab.
If the above doesn't work, I suggest switching to Jupyter Lab or Jupyter Notebook. The pandas profile dashboard works well in the Jupyter environment.
I hope this helps! Pandas-Profiling a wonderful EDA tool--such a time saver.

How to solve ImportError even Rasa_nlu and tensorflow are installed successfully

I faced the following error after installing Rasa_nlu and Tensorflow.
ImportError: Failed to import `tensorflow`. Please install `tensorflow`. For example with `pip install tensorflow`.
Before getting the above error message, I have successfully import the following packages as shown below.
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu import config
import tensorflow as tf
The following is the version of Anaconda3, Tensorflow, Rasa_nlu and python.
Anaconda-client: 1.6.14,
Anaconda-navigator: 1.8.7,
Anaconda-project: 0.8.2,
Python: 3.6,
Tensorflow: 1.8.0,
Could someone help me about me? Thank you so much.