No module named 'tensorflow.tsl' - python

I'm trying to install Tensorflow. I did the installation using the cmd.exe prompt and the installation was a success. But when I try to import TensorFlow appear the following error
ModuleNotFoundError: No module named 'tensorflow.tsl'
I follow this steps to install tensorflow:
$ pip install -U pip
$ pip install tensorflow
How can I solve the issue?

Check the version of tensorflow-serving-api and update it with
$ pip install tensorflow-serving-api==X.Y.0
X and Y should match your TensorFlow version. You can determine your TensorFlow version with
$ pip freeze | grep tensorflow

Related

How can I solve this Tensorflow using and installing Error?

I had used tensorflow before this time.Now,tensorflow is installed but it cannot be imported.Moreover,it cannot be installed again.What happened in tensorflow?I searched many solutions for this error but I cannot find.When tensorflow is installed with pip,this error appears.
Unable to create process using 'C:\Users\hp\Anaconda3\envs\tf-gpu\python.exe C:\Users\hp\Anaconda3\envs\tf-gpu\Scripts\pip-script.py install tensorfow'
And when it is installed with anaconda,it can be installed,but cannot be imported,"ModuleNotFoundError: No module named 'tensorflow'".How can I solve this trouble to reuse tensorflow without reinstalling anaconda ,please help me.Thanks a lot in advance!!
You can uninstall and reinstall the pip:
python -m pip uninstall pip
python -m pip install --upgrade pip
or update pip:
python -m pip install -upgrade pip

How do I install the shap module on Mac?

I am trying to install the shap package and keep getting the following error
ModuleNotFoundError: No module named 'shap'
I have typed the following into my notebook as well as terminal
!conda install -c conda-forge shap
!conda install shap --yes
Here are the lines of the that are erroring out
!pip install shap
import shap
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X)
I am currently on a Mac
I got same issue using pip install shap command. However, conda install worked. I use Mac.
conda install -c conda-forge shap
I am on Mac OS Big Sur with pip 21.2.4 and Python 3.8.9. I am able to install shap with the following command.
ARCHFLAGS="-arch x86_64" pip3 install shap
This about a similar issue.It may help you.
Modules are installed using pip on OSX but not found when importing
If the above doesn't work, Try this:
uninstall and reinstall SHAP
Update Numpy to the latest version, then:
pip install git+https://github.com/slundberg/shap.git
if the above doesn't work, then maybe this:
To install shapely (https://pypi.org/project/Shapely/)? In python, you can install shapely by doing
pip install shapely
For windows shapley can be installed by downloading .whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely and do
pip install <name of whl file>
or if you are using anaconda you can use conda-forge to get shapely
conda config --add channels conda-forge
conda install shapely

i can't import tensorflow in python

I had install TensorFlow using pip and it has been installed successfully but when I am trying to import it is giving me an error "ImportError: No module named '_pywrap_tensorflow_internal" Failed to load the native TensorFlow runtime.
How can I fix it?
Error Screenshot here
Use python version Python 3.8.8 or above :
pip install --user virtualenv
Activate your virtual enviroment and type the command in your console
pip install tensorflow
pip3 install tensorflow
Tensorflow package is of something around 200mb or above so be patient and let it to be install

ModuleNotFoundError: No module named 'tensorflow_docs' when creating TensorFlow docs

I'm trying to follow the contribution guide for documentation. The required steps are:
git clone https://github.com/tensorflow/tensorflow tensorflow
cd tensorflow/tensorflow/tools/docs
pip install tensorflow==2.0.0-alpha0
python generate2.py --output_dir=/tmp/out
But the last command gives me:
Traceback (most recent call last): File "generate2.py", line 36, in
from tensorflow_docs.api_generator import doc_controls ModuleNotFoundError: No module named 'tensorflow_docs'
This is in line 36 of generate2.py:
from tensorflow_docs.api_generator import doc_controls
I haven't found a pip package containing tensorflow_docs. Any ideas?
First install tensorflow_docs using this command:
pip install git+https://github.com/tensorflow/docs
first, you need to install git.
install git by using this command conda install git in anaconda prompt. then run the following command
!pip install -q git+https://github.com/tensorflow/docs
in jupyter notebook
OR
pip install -q git+https://github.com/tensorflow/docs
in anaconda prompt.
I have a try and figure out how to solve the problem. Since I have multuple Python versions by checking "conda list" and "pip list", either the Jupyter or IDE installation method could not install tensorflow_docs into the correct directory.
1.For Jupyter
$ conda install git
$ !pip install -q git+https://github.com/tensorflow/docs
2.For IDE
$ conda install git
$ pip install -q git+https://github.com/tensorflow/docs
The problem is that pip has installed tensorflow_docs into the default directory of Python 3.6 with the following path: /home/user/local/lib/python3.6/site-packages. However, I use Python 3.9 in the conda environment in the most of the time.
3.Copy tensorflow_docs into Python 3.9 site-packages
It is applicable after putting tensorflow_docs to the designated directory of Python 3.9. So I can use tensorflow_docs after the following operations:
First.Download tensorflow_docs
https://github.com/tensorflow/docs/tree/master/tools/tensorflow_docs
Second.Save tensorflow_docs in Python 3.9 directory
/home/user/miniconda3/lib/python3.9/site-packages/tensorflow_docs

Install TensorFlow & Tensorboard from source

I want to install Tensorflow (CPU)(py 3.6) for windows, my company uses a proxy, so i can't install through pip, i have to build it from source.
I unzipped tensorflow/tensorboard/protobuf.tar.gz in my Anaconda3 folders.
When i use the setup.py files, it occurs that i need tensorboard for installing tensorflow, and i need tensorflow for installing tensorboard.
So i don't know how to proceed for installing Tensorflow without using dependencies from pypi.org.
Thanks
You can use pip with proxy. I was struggling with company proxy too and that was the solution for me:
Run a command prompt as administrator and type the following:
pip install --proxy http://username:password#proxy_url:port tensorflow
(this will install the latest CPU version of tensorflow)
This should work.
Installing with Anaconda
follow steps to install TensorFlow in an Anaconda environment:
Download and install Anaconda.
Create a conda environment named tensorflow to run a version of Python by invoking the following command:
$ conda create -n tensorflow
Activate the conda environment by issuing the following command:
$ source activate tensorflow
(tensorflow)$ # Your prompt should change
(tensorflow)$ pip install --ignore-installed --upgrade tfBinaryURL
where tfBinaryURL is the URL of the TensorFlow Python package. For example, the following command installs the CPU-only version of TensorFlow for Python 2.7:
(tensorflow)$ pip install --ignore-installed --upgrade \ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp34-cp34m-linux_x86_64.whl
For detail offical link

Categories