How to solve ImportError: cannot import name (most likely due to a circular import)?

Ask Questions Forum: ask Machine Learning Questions to our readersCategory: QuestionsHow to solve ImportError: cannot import name (most likely due to a circular import)?
Chris Staff asked 3 weeks ago
1 Answers
Best Answer
Chris Staff answered 3 weeks ago

Rename the file in your directory interfering with the package you’re importing.

For example, if you’re using tensorflow in your Python script, and your script is named tensorflow.py, then you’re having a circular import – because it attempts to import itself rather than the TensorFlow package.

In that case, rename tensorflow.py into something else, and try again.

Your Answer

5 + 8 =