Forums

pip3 install tensorflow on pythonanywhere

This exceeds the "disc quota". Nevertheless, is there any way to run my script (which needs tensorflow)?

tensorflow 1.10 is already installed on pythonanywhere, so you could just use that preinstalled version instead

see this help page for tips to free up space

this is an example of a script you can set as a scheduled task to automatically delete unneeded files every night

Thanks for the info, but when I run my script, it says tensorflow isn't installed...what could be the problem here?

tensor is preinstalled for python 3.6, 3.5, 3.4, and 2.7. if you are using python 3.7, you will either have to use python 3.6 or install it yourself (which might not be possible if tensorflow is too faaat)

also u should check out my website

tensorflow*

interesting website. I looked at your github. Maybe I'll see if I can contribute to your shellP shell. How do you change the default python version for my script to run in a python 3.6 environment instead of 3.7?

I used python 3.6 to run my script, but unfortunately, it still says that there is no module named Tensorflow.

https://imgur.com/Eg7mXxe

You use python3.6 to run your script.py but it looks like somewhere inside it's calling tensorflow_chessbot.py using a different version of python that has no tensorflow available.

finally someone cares about ShellP

https://www.pythonanywhere.com/user/rayorayoray/shares/6099c08e3948464cae4f2ab328dd7dd8/

This is the file "tensorflow_chessbot.py". How can I tell what version of Python this file uses? Thanks.

use sys.version to detect the version

thanks for all the help. terrific, I've confirmed that my ./tensorflow_chessbot.py file is in version 3.7.0, which doesn't have tensorflow pre-installed...How can I change this (and other files) to version 3.6? It seems that for all my .py files, pythonanywhere has them automatically in version 3.7.0

Change the shebang in your file to:

1
#!/usr/bin/env python3.6

Maybe I'll see if I can contribute to your shellP shell.

feature suggestions would be very helpful, but you should not contribute any actual code yet since i'm currently rewriting the entire project to support things such as a shell script interpreter

Hi, I've changed the shebang in my file: https://imgur.com/Kh99AJf However, as you can see in the traceback, it still prints that my python version is 3.7.0! What could I be doing wrong here? :(

how are you running the script?

I just pressed the blue >>>run button at the top of my ./tensorflow_chessbot.py file to see if

import sys
print(sys.version)

would give me 3.6 since I put the shebang at the top asking for it to use 3.6

Can you try killing the console that you had originally started in python3.7?

From a new console it should follow the hashbang.

I have killed both the previous two consoles that I had, and created a new one in script.py and ran script.py, but the same problem of tensorflow not being found still happens. Do you have ideas on why this happens even though I have hashbangs telling python to use 3.6 on the files that import tensorflow? Here is a link to script.py so you can try running it. https://www.pythonanywhere.com/user/rayorayoray/shares/6099c08e3948464cae4f2ab328dd7dd8/

Right now it looks like both of your running consoles are using Python 3.6. What errors are you getting in them?

Hi...i can't install modules using pip either. Even after importing pip as import pip3 nor import pip3.6 neither works when working with the bash python 3.6 script in pythonanywhere.com . After importing, I try to do installations such as pip3.6 install --user pythonanywhere as shown in the photo below but yet it does not work.

See our help page here: http://help.pythonanywhere.com/pages/InstallingNewModules/

hi everyone, is it a problem if some of my .py files have that shebang using python 3.6 and others use the default 3.7? Could that be what is causing my errors?

Yes. The version being used to run the main file is used on all .py files. For example:

test_a.py

#!/usr/bin/env python3.7
import sys
print(sys.version)

import test_b
print(test_b.get_version())

test_b.py

#!/usr/bin/env python3.6
def get_version():
    import sys
    return sys.version

Running test_a.py shows this output:

3.7.0 (default, Aug 22 2018, 20:50:05) 
[GCC 5.4.0 20160609]
3.7.0 (default, Aug 22 2018, 20:50:05) 
[GCC 5.4.0 20160609]

Both scripts are running under version 3.7. You should also note that the shebang is ignored when you run the file through the python command.

@rayorayoray It could be a problem or not depending on how you are running them. As dull mentioned above shebang could be ignored in some cases and honored in others.

Basically, @fjl is repeating what I said to make himself look smart

Thanks for the help. What if I have a shebang making my main file python 3.6 but i dont have any shebangs in any of my other files? Will everything now run 3.6? I did this and there's still that "tensorflow not found" error.

Any shebangs in scripts other than the main one do not make a difference.

even if the main script calls the other scripts via command line? Or is the shebang ignored when the file is called via command line? I put the python 3.6 shebang on the top of every single one of my files and the main file still says the tensorflow module is not found :(

If it's all python files importing each other, then only one python version is used. But if say you are doing a subprocess.call, or you have a shell script calling multiple python processes, then it may run different versions of python.

What is the full traceback that you see, and how did you install tensorflow?

This is the traceback: https://imgur.com/a/T1Ul6rL It's just "No module named tensorflow" over and over again. I didn't install tensorflow. I'm trying to use the one that's already installed in Python 3.6 on pythonanywhere and I've put shebangs on top of all my .py files telling them to use python3.6 but it still can't find the module tensorflow!

I don't see anything about your account that would prevent tensorflow from importing. In a new Bash console, try

python3.6 -c "import tensorflow"

to see whether that works. It should just give you your Bash prompt back without an error. If that works, I would suspect that something in your script is messing with sys.path, so print sys.path in your script just before you try to import tensorflow and compare it to the output you get when you run

python3.6 -c "import sys; print sys.path"

The first command works for me without an error. The output of print(sys.path) in my script right before importing tensorflow is the exact same as python3.6 -c "import sys; print sys.path", with the exception of '.' and '/bin' being in the array in the bash output and not the script output...

If that's the case, then I would think that tensorflow would be working. Are you sure that you're not doing anything else between the start of the script and the import that may be interfering with the tensorflow import? Move the tensorflow import to immediately after the printing of sys.path (if it isn't already there) and make sure that your exception is still the same.

I have an import os thing between the start of the script and the tensorflow import as you can see here: https://imgur.com/a/RGlZanK. Does this cause a problem?

No, importing os shouldn't affect it.

https://www.pythonanywhere.com/user/rayorayoray/shares/6099c08e3948464cae4f2ab328dd7dd8/

Here's a share link to the file. Hopefully you can find out why this annoying tensorflow bug is happening. Thanks.

Are you running tensorflow_chessbot.py directly from the command line (if so, show the command) or is it the other script that is calling it as a subprocess (if so, show that other script)?

I know this post is a little old, but I ran into the same problem. In addition to including the shebang in your app file, don't forget to set the configuration of the actual server to Python 3.6 (web)

hi, why i don't have and can't install tensorflow?

You have tensorflow for python 3.8 but not for 3.9. See https://www.pythonanywhere.com/batteries_included/