MIDASverse / MIDASpy

Python package for missing-data imputation with deep learning
Apache License 2.0
128 stars 36 forks source link

MIDASpy some times get error #32

Closed AZFARHAD24511 closed 4 months ago

AZFARHAD24511 commented 11 months ago

As recommended , I have installed all the packages, but I sometimes get an error message. the interesting point is that When I ran exactly this code on another account of Google Colab, I got no errors !pip install numpy pandas matplotlib statsmodels scipy !pip install tensorflow==2.11 !pip install tensorflow-addons<0.20 !pip install MIDASpy

import numpy as np import pandas as pd import tensorflow as tf from sklearn.preprocessing import MinMaxScaler import sys import MIDASpy as md

/usr/local/lib/python3.10/dist-packages/tensorflow_addons/utils/ensure_tf_install.py:53: UserWarning: Tensorflow Addons supports using Python ops for all Tensorflow versions above or equal to 2.9.0 and strictly below 2.12.0 (nightly versions are not supported). The versions of TensorFlow you are currently using is 2.13.0 and is not supported. Some things might work, some things might not. If you were to encounter a bug, do not file an issue. If you want to make sure you're using a tested and supported configuration, either change the TensorFlow version or the TensorFlow Addons's version. You can find the compatibility matrix in TensorFlow Addon's readme: https://github.com/tensorflow/addons warnings.warn(

ImportError Traceback (most recent call last) in <cell line: 6>() 4 from sklearn.preprocessing import MinMaxScaler 5 import sys ----> 6 import MIDASpy as md

14 frames /usr/local/lib/python3.10/dist-packages/keras/engine/base_layer_utils.py in 22 23 from keras import backend ---> 24 from keras.dtensor import dtensor_api as dtensor 25 from keras.utils import control_flow_util 26 from keras.utils import tf_inspect

ImportError: cannot import name 'dtensor_api' from 'keras.dtensor' (/usr/local/lib/python3.10/dist-packages/keras/dtensor/init.py)

edvinskis commented 11 months ago

Hi @AZFARHAD24511,

From what I can gather, the error you are experiencing is due to the fact that TensorFlow version 2.13 is being initiated, whereas version <2.12 is required for MIDASpy. Google Colab does come with TensorFlow preinstalled, and by default, it is set to use the latest available version at the time of the Colab environment's setup. This default setup can potentially lead to version mismatches when working with other libraries or frameworks that require a specific TensorFlow version.

After running pip install MIDASpy, you might see a warning like this:


WARNING: The following packages were previously imported in this runtime:
[tensorflow]
You must restart the runtime in order to use newly installed versions.

Restart the runtime and continue your project. You can also check the TensorFlow version currently in use by executing print(tf.__version__) in a code block.

AZFARHAD24511 commented 11 months ago

Hi @AZFARHAD24511,

From what I can gather, the error you are experiencing is due to the fact that TensorFlow version 2.13 is being initiated, whereas version <2.12 is required for MIDASpy. Google Colab does come with TensorFlow preinstalled, and by default, it is set to use the latest available version at the time of the Colab environment's setup. This default setup can potentially lead to version mismatches when working with other libraries or frameworks that require a specific TensorFlow version.

After running pip install MIDASpy, you might see a warning like this:


WARNING: The following packages were previously imported in this runtime:
[tensorflow]
You must restart the runtime in order to use newly installed versions.

Restart the runtime and continue your project. You can also check the TensorFlow version currently in use by executing print(tf.__version__) in a code block.

actually before going to the process i run this code to ensure noting error (!pip uninstall TensorFlow) but some time i get error

edvinskis commented 4 months ago

I am closing this issue now. Please feel free to open a new one if you have any other questions.