-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'module' object has no attribute 'constant' #3369
Comments
I'm also running into this problem, after having followed the instructions for installing TensorFlow via pip on www.tensorflow.org, under Python 3.5.2 in Debian unstable. Here's what
Edit: I note that I mistakenly installed TensorFlow for GPU processing, using the URL with |
I just tried to follow the Anaconda 64-bit Python 3.4 on my Ubuntu, and it worked fine. One thing to check: if you used Did you use the GPU version or CPU-only version? |
It looks like |
Actually, as per http://caligari.treboada.net/2014/09/23/python-pip-and-the-staff-group/, it should be sufficient to add your user to the group |
Since I'm using OSX, the binary provided is CPU-only therefore I'm not having any problem with GPU vs CPU version. Ok, so far I got python 3.5 working by installing TF via pip. Which means it has something to do with the conda package manager maybe...? It works with python 2.7 so I'm not sure. Tried sudo python3, nothing worked. |
Looks like it has been workaround-ed. Closing for now. |
In case this helps others: Related: I had an issue (tensorflow 0.9), in that scripts stopped working: " AttributeError: 'module' object has no attribute 'constant' ". Thanks to this answer [http://stackoverflow.com/questions/37383812/tensorflow-module-object-has-no-attribute-placeholder], I looked and noticed that I had a folder named "tensorflow". I renamed that folder, and my scripts are working again. |
In my case i had named the file as "tensorflow.py" which was the cause of above Error. I changed the file name which fixed the problem. Also deleted mt script file "tensorflow.py". |
i have the same issue and I am not using a file name and nor am i under a source tree. problem goes away if i install tensorflow-gpu but comes back when i install native build from source using bazel. I also notice that https://www.tensorflow.org/install/install_linux#InstallingAnaconda had a LOT more files than local pip package create from bazel. issue
The directory permissions look ok as well where this package was distributed. Am i missing something? |
Same thing. Simple direct install.
as that didn't work, I went back and did the optional step 2, getting the storage file from the link as suggested:
So what does this mean? Is Tensorflow installed? How should I proceed?? |
@antigonus, you're misspelling the command. You have tensoflow instead of tensorflow. It should be; If you get another, similar error, attempt to install from a different package.
|
@faullath, thank you! I suspect the first problem was something about permissions having run pip3 as root. (Other posts have noted such problems with pip3.) That misspelling is incredible as that command was cut and paste from the dialog to the shell then to here. Somehow a character was deleted, or wasn't there in the first place. I didn't think to examine it closely. I ended up replacing Ubuntu 17 with a Debian Stretch, ran pip3 as a user on the new system using a direct install by the first step (not the optional 2nd step), and everything went smoothly. |
After directly installing with pip3 install tensorflow, I am struggling with the same problem. |
Run into the same error. |
I installed tensorflow from Source had the same problem. I noticed that while executing the command "sudo pip install /tmp/tensorflow_pkg/tensorflow-1.5.0-py2-none-any.whl", I was executing it by copying and pasting it directly which was wrong because the term "tensorflow-1.5.0-py2-none-any.whl" need to be replaced with the right name of the .whl file. First time running it gave some error but when I ran it again, it worked like a charm. You can find it in location /tmp/tensorflow_pkg. Just putting it here hoping it would save someone else's load of time. |
@concretevitamin sudo python helps!! I had an error
Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace |
Hi everyone, I tried to run Tensorflow 0.9.0 with Python 3.4 but I've received this error:
Python 3.4.5 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:47:57)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'constant'
Steps to reproduce
What have you tried?
Tried with Python 3.5 but no luck as well. Version 2.7 works fine but I need to use version 3.x as part of my coursework requirement.
Environment info
Operating System: OSX 10.11.1
The text was updated successfully, but these errors were encountered: