Ml-agents: E0611:No name 'python' in module 'tensorflow'

Created on 8 Nov 2018  路  5Comments  路  Source: Unity-Technologies/ml-agents

Hello all,

Problem description
I have followed the guide on ml-agent's installation guide (windows via Anaconda):

  1. conda create -n ml-agents python=3.6
  2. activate ml-agents
  3. pip install tensorflow==1.7.1
  4. cd to the mlagent folder and "pip install ."

However, when I opened trainer_controller.py in vscode, I keep getting the following error: E0611:No name 'python' in module 'tensorflow' because of this code:
from tensorflow.python.tools import freeze_graph

Observations

  1. import tensorflow as tf works fine
  2. tensorflow.python.tools doesnt work
  3. I don't understand why a sub_module of tensorflow couldn't get imported

image

Please Help Me~

help-wanted

Most helpful comment

It might be a bug in pylint. This page could help.
https://medium.com/@haominnn/how-to-deal-with-python-not-finding-tensor-flow-module-under-anaconda-3aefa8ffae11

All 5 comments

It might be a bug in pylint. This page could help.
https://medium.com/@haominnn/how-to-deal-with-python-not-finding-tensor-flow-module-under-anaconda-3aefa8ffae11

Hi @ManaAura , does the training work when calling mlagents-learn from the console ? You should be able to run the training without having to edit any Python code at all. If the training does not start, could you post the error here ?
@zongjingyao Thank you for your message.

Thank you all, mlagents-learn works from the console! :) .

It might be a bug in pylint. This page could help.
https://medium.com/@haominnn/how-to-deal-with-python-not-finding-tensor-flow-module-under-anaconda-3aefa8ffae11

Helped a lot! Just Ctrl+Shift+P and searched for linter. And changed to PEP8. All good now! :smile:

It might be a bug in pylint. This page could help.
https://medium.com/@haominnn/how-to-deal-with-python-not-finding-tensor-flow-module-under-anaconda-3aefa8ffae11

This is NOT a solution. Simply disabling a tool because of an error doesn't fix the error.

Now to the bug:

Why: Then TF package is just a proxy that redirects stuff to the internal package called tensorflow_core as can be verified by importing that. The problem: You are not allowed to do that as it is an internal package.

Solution: Tell pylint about this. This can be done via pylint plugins although I'm currently not aware if there are already some that do that.

Note: Yes everything does work even though there are linter errors. You may ignore them or switch to another linter as described in the link. But it would be great if someone finds a solution for pylint as that is way more powerful than pep8, which is mostly a style-checker.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rodnyy picture Rodnyy  路  3Comments

GeriBP picture GeriBP  路  3Comments

Sohojoe picture Sohojoe  路  3Comments

MarkTension picture MarkTension  路  3Comments

mattinjersey picture mattinjersey  路  3Comments