I have installed tensorflow (1.6.0) in Visual Studio 2017, but I get the following error when I run the code:
No module named tensorflow
Any help?
Check that you installed it in the same runtime that Visual studio is using for the code i.e. Visual studio may be pointing to one python installation, but you installed tf on a different python installation.
you must install it on Python 64bit version n
example: python3.6 on Windows
1.1. on cmd cd C:\Users\<user_name>\AppData\Local\Programs\Python\Python36\Scripts
1.2. execute this commande pip install tensorflow
then in the IDE you must select the right version of Python (ex: the version when you install tensorflow python3.6 64bit)
check this doc maybe help you
Related
My PC is 64 bit and python version is 3.7.9. I installed tensorflow as following. Does anyone know how to solve it? Let me know if further information is needed.
Edit:
I also tried anaconda as follow:
https://www.tutorialspoint.com/tensorflow/tensorflow_installation.htm
But the problem is that in anaconda prompt, I can import tensorflow. I use python in visual studio 2017. When I open python file in VS, it seems different with anaconda prompt. Do you know how to make it also work in VS?
The version of Python your using is too new for the version of TensorFlow your using.
If you go here: https://pypi.org/project/tensorflow/1.13.1/, and look on the left hand side and scroll down to "Programming Language", you will see the latest python version on that list is Python 3.6.
That is the cause of error your getting. You can either:
Switch to Python 3.6 or
Use TensorFlow 1.14.0 or above which supports Python 3.7
Also make sure your using the 64-bit version of Python. TensorFlow will not install if you have the 32-bit version of Python installed.
Could you try:
pip install --upgrade tensorflow
I am running on windows 10. I am having problems with importing TensorFlow. I am in Vs code. I installed tensorflow using pip3. And here is the error:
Traceback (most recent call last):
File "c:/Users/USER/PycharmProjects/tt/main.py", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
I created my project in pycharm.
I am using python 3.7.5 and TensorFlow 2.0.0. This is how I installed TF:
pip3 install tensorflow==2.0.0
please help I was having this problem for a week.
Thanks , In Advance
For your work/project, please try to create a new virtual environment and then install all your required packages.
Like this:
$ python3 -m venv env
Activate it:
$ source env/bin/activate
and then install the tensorflow package inside your virtual environment:
pip3 install tensorflow
I think you need to create environment separate
and then install tensorflow..
for more information regarding envirnoment Link
Do you have several different python environments on your pc? Which python interpreter are you using when you install tensorflow?
The Status Bar will show you the current interpreter in the lower left corner. Check whether it is the same with the one you use when you install tensorflow.
enter image description here
I was getting your exact error, but this worked for me:
File->settings
Workspace tab
Search for "interpreter"
Put the complete path to the python.exe you want to execute under "default interpreter path"
It seems VSCode either found (or included) an older version of python that couldn't find the things I installed with pip.
I am a bit of a python newb and I'm guessing the venv approach is superior, but I couldn't get that cooperating with VSCode on windows.
I have python 3.7 installed on a Windows 10 machine, no custom stuff at all, to install tensorflow I used:
pip3 install --user --upgrade tensorflow
but when I try importing it using:
import tensorflow
in a python script or shell it gives me the following error:
ImportError: DLL load failed: The specified module could not be found.
Am I doing something wrong?
edit: By the way pip version is 20.0.2, I precedently tried with pip 10.x and got the same result.
Regarding https://github.com/tensorflow/tensorflow/issues/35749 or https://github.com/tensorflow/tensorflow/issues/36859 (and the amount of same duplicate issues) there are some recents problems with tensorflow 2.1 for some windows computers.
A fix so far, is to use tensorflow 2.0 on windows :
pip install tensorflow==2.0
For more details, this is quite detailed : https://github.com/tensorflow/tensorflow/issues/36167#issuecomment-577886156
Before:
Install VS2015.
Install opencv 3.2.0.
Now, i install VS2017 and create python project with the following code:
import cv2
When I run it, compiler show the error: "ImportError: No module named cv2"
How to update some libraries - which i installed before - as opencv, numpy,... for VS2017?
Thanks!
UPDATE 1
I knew the reason. Because when i installed VS2017, i also installed other version of Python. VS2017 used the wrong version (it does not have opencv library). And then i created new universal windows python project, VS2017 auto generate PythonUwpIoT (python 3.5 - i don't know and how to have it).
I try to install opencv for python. I use windows x64. I install numpy1.6 and python2.7. I have installed opencv2.4.9. I install them succesfully. I guide from this page. It says that
Now open your "Python IDLE" ( from Start > All Programs > Python 2.7 > Python IDLE ) and just type following :
import cv2
When I run import cv2, I get below error :
module compiled against API version 9 but this version of numpy is 6.
How can I know compatible version?
I know this question enter link description here. But I installed latest numpy version, it didn't solve my problem.
Use https://www.scivision.co/install-opencv-3-0-x-for-python-on-windows/
It's going to lead you to http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv where you can download a .whl installer. After you download it, you can run it using
pip install some-file.whl
assuming you have pip installed. After that you should be able to import cv2.
I had the same problem and I did a ton of research but this is the only one that worked.