ModuleNotFoundError: No module named '_pywrap_tensorflow' erro windows 10 - python

I am trying to install Keras with Tensorflow. I have followed all steps from
here
I have installed CUDA 9 . cuDNN 7.i had problems intalling it with command provided on the site so i used
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
which i have found here on SO. Installation went fine, however when i tried test script ( provided on the tensorflow site ) i recieved error:
No module named '_pywrap_tensorflow
I have tried to check SO for answer but found nothing usefull, how can fix this?
thanks for help.

Regarding your issues you are installing cpu only and old MAC version of tensorflow which shouldn't work on windows.
You could try using the following command
python3 -m pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0-cp35-cp35m-win_amd64.whl
But I suggest you use Anaconda for the windows to install tensorflow and keras it has much less errors on windows, you can find a guide for it here https://github.com/antoniosehk/keras-tensorflow-windows-installation.

Related

Importing does not seem to work python and returns "ModuleNotFoundError" even though module is installed

Currently I'm trying to install tensorflow with pip, I've used the following command to install it with:
pip3 install --user --upgrade tensorflow which after installing returns Successfully installed tensorflow-2.5.0. But when I install I get a lot of notices "Requirement already satisfied" but I'm unsure if this is normal or not.
I have a following local python file on my Windows 10 computer called test.py and inside is a simple import
test.py
import tensorflow as tf
When I run python I get the following error:
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
When I run pip3 list I can see that the module tensorflow is there, but importing it does give the error. It seems to happen with other modules too, as I've tried installing pymongo and it gave me the same error.
What I've tried
Uninstalling, re-installing python
Uninstalling and re-installing tensorflow
Python3 version: 3.9.5
Pip3 version: 21.1.1
I would try python3 -m pip install tensorflow. Running pip as a module ensures the versions are the same and can help with compatibility.
Most probably you have installed tensorflow on python3(guessing after seeing pip3 command) but you are running script on python2 (guessing after seeing "When I run python").
Assuming you aren't using virtualenv
Try running
python3 test.py
If this didnt help then try below command.
python3.x test.py # where x could be your minor version Ex: python3.6/python3.7

unable to import tensorflow after I pip install in a virtual environment in python

my python version is 3.7.5.
In vscode, I created my virtual environment
python -m venv myProj
Then I switch my python interpreter to: python3.7.5 64bit ('myProj':venv)
I install tensorflow as below:
pip install tensorflow
I can see tensorflow appear in the myProj/lib-sitePackages
Then I tried to run python file in which there is one line 'import tensorflow'
The prompt became like below:
(myProj) C:\Users\xxx\Documents\My_Document\myname\myProj>
I got error like below:
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.........
Interestingly, when I did pip install tensorflow outside of virtual environment, I was able to run python3.7.5 and import tensorflow.
I spend hours try this and that. But got no success.
Do anyone know why it happens?
Run tensorflow in anaconda.
Delete and unistall all existing python software and download anaconda.then view tutorials of how to install tensorflow and keras in anaconda. It takes about 20 mins with goodnet speed.
I used to get the same dll error load module not found error when tried without anaconda.these are compatibility issues

I installed TensorFlow and found no modules found

I downloaded it by pip install tensorflow in cmd
The installation is fine and I have tensorflow when I pip list and look at the list.
in Python,
import tensorflow
but can't find the module.
I can't install it with pip3.
What should I do?
I think you have multiple python versions installed.You can use cmd
'where python' on windows to find which python you are running and also verify where you have install tenserflow module using pip.

Why ImportError: No module named lightgbm

My OS is Ubuntu, and I've followed the official installation guide to install lightgbm. However, when I import it, this error is raised:
ImportError: No module named lightgbm
How can I solve this?
Do I also need to go to /python-package folder to run setup.py after running those linux commandlines?
I had the same problem, and solved running the installation directly on the notebook
!pip install lightgbm
Besides running those linux command lines. I also need to go to /python-package then run 'python setup.py install'.
conda install -c conda-forge lightgbm solved the problem for me
you need just run in a notebook cell before importing
For Windows users, VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572> is needed if Visual Studio (2015 or 2017) is not installed.
Install wheel <http://pythonwheels.com> via pip install wheel first. After that download the wheel file and install from it:
pip install lightgbm
The following should do the trick:
export PATH=/usr/local/bin/anaconda3/bin${PATH:+:${PATH}}
PYTHONPATH=$PYTHONPATH:/usr/local/bin/anaconda3/lib/python3.6/site-packages
Note that you might need to change the paths if you are using a different Python version.
Thank you for above question and answers, had a similar issue.
Problem:
After successfull install of lightgbm, I was getting the error ImportError: No module named 'lightgbm' (in Jupyter Notebook on Google Cloud's Notebook Instance in AI Platform project).
Issue:
Realized that the install of lightgbm was in Python 2.7 even when the notebook was running in Python 3 (path: './.local/lib/python2.7/site-packages').
Solution:
The error was gone after the Jupyter Notebook was set to run on Python 2 instead of Python 3.
within Jupyter Notebook cell is: try running
import sys
!{sys.executable} -m pip install lightgbm
With python try, from pypi.org, this line
pip install lightgbm
or
pip3 install lightgbm
Also, you can try this one if you use anaconda
conda install lightgbm

TensorFlow installation results in ImportError: No module named tensorflow

I'm trying to get TensorFlow to work on my Mac (OSX El Capitan 10.11.2). I tried the pip install from the setup guide and also followed the instructions in the accepted answer here.
In both cases I am able to successfully activate the virtualenv and my prompt changes to tensorflow. Python works fine, I'm able to do simple computations on the command line. But when I try to import tensorflow:
import tensorflow as tf
I repeatedly get this error:
ImportError: No module named tensorflow
Any help would be appreciated.
I had the issue reported in the original question. Python worked fine, I followed the installation steps on the Tensforflow website, and got "No module named tensorflow."
Re-installing python via brew, and re-installing pip as a result, fixed it. I didn't need to uninstall anything, just the line below along with the normal pip install from the tensorflow installation document afterwards:
brew install python

Categories

Resources