# I wanna solution to this error when import tensorflow

**URL:** <https://discuss.ai.google.dev/t/i-wanna-solution-to-this-error-when-import-tensorflow/31516>\
**Category:** General Discussion\
**Tags:** install, help\_request\
**Created:** [May 12, 2023, 7:53am UTC](https://discuss.ai.google.dev/t/i-wanna-solution-to-this-error-when-import-tensorflow/31516 "2023-05-12T07:53:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Khaled](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/ahmed_khaled/32/18261_2.png) [@Ahmed\_Khaled](https://discuss.ai.google.dev/u/Ahmed_Khaled)\
**Post date:** [May 12, 2023, 7:53am UTC](https://discuss.ai.google.dev/t/i-wanna-solution-to-this-error-when-import-tensorflow/31516/1 "2023-05-12T07:53:28Z")

</div>

AttributeError Traceback (most recent call last)  
Cell In[5], line 1  
----\> 1 import tensorflow as tf

File E:\anaconda\lib\site-packages\tensorflow\__init_\_.py:37  
34 import sys as \_sys  
35 import typing as \_typing  
—\> 37 from tensorflow.python.tools import module\_util as \_module\_util  
38 from tensorflow.python.util.lazy\_loader import LazyLoader as \_LazyLoader  
40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.

File E:\anaconda\lib\site-packages\tensorflow\python\__init_\_.py:37  
29 # We aim to keep this file minimal and ideally remove completely.  
30 # If you are adding a new file with @tf\_export decorators,  
31 # import it in modules\_with\_exports.py instead.  
32  
33 # go/tf-wildcard-import  
34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top  
36 from tensorflow.python import pywrap\_tensorflow as \_pywrap\_tensorflow  
—\> 37 from tensorflow.python.eager import context  
39 # pylint: enable=wildcard-import  
40  
41 # Bring in subpackages.  
42 from tensorflow.python import data

File E:\anaconda\lib\site-packages\tensorflow\python\eager\context.py:35  
33 from tensorflow.python.client import pywrap\_tf\_session  
34 from tensorflow.python.eager import executor  
—\> 35 from tensorflow.python.eager import monitoring  
36 from tensorflow.python.framework import c\_api\_util  
37 from tensorflow.python.framework import device as pydev

File E:\anaconda\lib\site-packages\tensorflow\python\eager\monitoring.py:24  
22 from tensorflow.python import pywrap\_tfe  
23 from tensorflow.python.client import pywrap\_tf\_session  
—\> 24 from tensorflow.python.framework import c\_api\_util  
25 from tensorflow.python.util import compat  
26 from tensorflow.python.util.tf\_export import tf\_export

File E:\anaconda\lib\site-packages\tensorflow\python\framework\c\_api\_util.py:22  
20 from tensorflow.core.framework import op\_def\_pb2  
21 from tensorflow.python.client import pywrap\_tf\_session as c\_api  
—\> 22 from tensorflow.python.util import compat  
23 from tensorflow.python.util import tf\_contextlib  
26 class AlreadyGarbageCollectedError(Exception):

File E:\anaconda\lib\site-packages\tensorflow\python\util\compat.py:205  
200 return as\_bytes(path)  
203 # Numpy 1.8 scalars don’t inherit from numbers.Integral in Python 3, so we  
204 # need to check them specifically. The same goes from Real and Complex.  
 → 205 integral\_types = (\_numbers.Integral, \_np.integer)  
206 tf\_export(‘compat.integral\_types’).export\_constant( **name** , ‘integral\_types’)  
207 real\_types = (\_numbers.Real, \_np.integer, \_np.floating)

AttributeError: module ‘numpy’ has no attribute ‘integer’

---

<div class="post-metadata">

**Author:** ![chunduriv](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chunduriv](https://discuss.ai.google.dev/u/chunduriv)\
**Post date:** [May 12, 2023, 8:12am UTC](https://discuss.ai.google.dev/t/i-wanna-solution-to-this-error-when-import-tensorflow/31516/2 "2023-05-12T08:12:27Z")

</div>

@Ahmed_Khaled,

Welcome to the Tensorflow Forum!

There appears to be a mismatch in versions between Tensorflow and Numpy.

What versions of Tensorflow and Numpy are you currently using?

Thank you!
