problems when importing tensorflow in Jupiter Notebook - tensorflow

I am using Jupiter Notebook installed with Anaconda distribution and I want to install Tensorflow.
I wrote
!pip install tensorflow
it installed it, but now when I want to import tensorflow, when I type
import tensorflow as tf
it gives me an error:
ImportError: DLL load failed with error code -1073741795
I searched for answers and questions related to this issue but nothing helped me. The most weird is that I managed to install and import tensorflow on another computer like this. I can`t find out what I am missing.

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__

How to fix problem installing tensorflow 1.5?

I am working in Kaggle's notebook on an image segmentation problem. So far I did not have a problem installing TensorFlow 1.5 and Keras 2.1.5 so I can work with the Mask R-CNN model. But now I am getting this error:
I would appreciate the help. I just don't understand how to fix it.
I install Tensorflow and Keras as I have always done:
!pip install tensorflow==1.5
!pip install keras==2.1.5
import tensorflow
import keras
Until yesterday it worked!
Check Settings in your Kaggle notebook. Internet must be set to - On.

error message of No module named 'tensorflow' in GCP AI Platform Notebook

I launched a notebook with GCP AI Platform. Then, I tried to install tensorflow by:
import tensorflow as tf
There is an error message of
No module named 'tensorflow'
I tried to install it by:
!pip install -U --user tensorflow==1.14.0
But the same error message appeared. As it is a GCP platform, I wonder why I need to install tensorflow. During Coursera training, I can import tensorflow directly without installation. I wonder if I missed anything.
Grateful if you can help.
Thank you
You have probably selected an instance type that doesn't have tensorflow pre-installed.
After you install a Python dependency you will have to restart the Python Kernel for updates to take effect by clicking on Kernel->Restart Kernel....

import tensorflow as tf error occur in Anaconda Navigator

while importing tenserflow module in anaconda notebook I'm facing this error numpy.core.multiarray failed to import
Welcome to StackOverflow.
Please consider reviewing "How do i ask a good question" guidelines to provide more context.
With your question, it is likely you have an older version of numpy installed in Anaconda through pip. Try using anaconda environments and install tensorflow directly via this guide.
The commands you should run are to install the current release of CPU-only TensorFlow, recommended for beginners are:
conda create -n tf tensorflow
conda activate tf