Skip to content
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

Commands running in 3.7.6 Shell, but failing as script #84156

Closed
rosarion mannequin opened this issue Mar 16, 2020 · 2 comments
Closed

Commands running in 3.7.6 Shell, but failing as script #84156

rosarion mannequin opened this issue Mar 16, 2020 · 2 comments
Labels
3.7 (EOL) end of life

Comments

@rosarion
Copy link
Mannequin

rosarion mannequin commented Mar 16, 2020

BPO 39975
Nosy @terryjreedy, @rosarion

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2020-03-20.20:03:14.048>
created_at = <Date 2020-03-16.07:18:39.579>
labels = ['3.7', 'invalid']
title = 'Commands running in 3.7.6 Shell, but failing as script'
updated_at = <Date 2020-03-20.20:03:14.047>
user = 'https://github.com/rosarion'

bugs.python.org fields:

activity = <Date 2020-03-20.20:03:14.047>
actor = 'terry.reedy'
assignee = 'none'
closed = True
closed_date = <Date 2020-03-20.20:03:14.048>
closer = 'terry.reedy'
components = []
creation = <Date 2020-03-16.07:18:39.579>
creator = 'rosarion'
dependencies = []
files = []
hgrepos = []
issue_num = 39975
keywords = []
message_count = 2.0
messages = ['364293', '364712']
nosy_count = 2.0
nosy_names = ['terry.reedy', 'rosarion']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue39975'
versions = ['Python 3.7']

@rosarion
Copy link
Mannequin Author

rosarion mannequin commented Mar 16, 2020

Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

from future import absolute_import, division, print_function, unicode_literals
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
print(tf.version)
2.1.0

BUT IF I RUN THESE COMMANDS as a PYTHON SCRIPT FILE iy FAILS.
======================== RESTART: D:\PythonCode-1\tmp.py =======================

Traceback (most recent call last):
File "D:\PythonCode-1\tmp.py", line 7, in
import tensorflow as tf
File "C:\Python37\lib\site-packages\tensorflow_init_.py", line 101, in
from tensorflow_core import *
File "C:\Python37\lib\site-packages\tensorflow_core_init_.py", line 40, in
from tensorflow.python.tools import module_util as _module_util
ModuleNotFoundError: No module named 'tensorflow.python.tools'; 'tensorflow.python' is not a package

Why is it failing as a Script file ?
Is there something wrong in my Procedure ?

Hope to teceive your reply and Thanks in Advanced.

@rosarion rosarion mannequin added 3.7 (EOL) end of life labels Mar 16, 2020
@terryjreedy
Copy link
Member

This tracker is for improving future versions of python. Questions about using current python belong on python-list or other help forums, such as stackoverflow. Reading the following will help you ask good questions.
https://stackoverflow.com/help/minimal-reproducible-example

A few notes:

  1. The minimal example is likely 'import tensorflow as tf'.
  2. The 'shell' part of your post is not copied from an interactive session (IDLE?), as there are no prompts.
  3. The typical reason for the same import working and then not working is running the import with two different python binaries with different installed 3rd-party packages. If you ran twice in the same IDLE, once interactively and once from an editor, that would not be an issue, and I would not know why the difference.
  4. Tensorflow keras assumes that it is outputting to a text terminal, which IDLE is not, so there may be glitches in output formatting.

@terryjreedy terryjreedy changed the title Group of commands running in Python 3.7.6 Shell, but failing as Script file. Commands running in 3.7.6 Shell, but failing as script Mar 20, 2020
@terryjreedy terryjreedy changed the title Group of commands running in Python 3.7.6 Shell, but failing as Script file. Commands running in 3.7.6 Shell, but failing as script Mar 20, 2020
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life
Projects
None yet
Development

No branches or pull requests

1 participant