# Problem with the numpy module

**URL:** <https://discuss.python.org/t/problem-with-the-numpy-module/49170>\
**Category:** Python Help\
**Created:** [March 22, 2024, 3:15am UTC](https://discuss.python.org/t/problem-with-the-numpy-module/49170 "2024-03-22T03:15:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![klander](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@klander](https://discuss.python.org/u/klander)\
**Post date:** [March 22, 2024, 3:15am UTC](https://discuss.python.org/t/problem-with-the-numpy-module/49170/1 "2024-03-22T03:15:35Z")

</div>

I’m Kent Anderson, learning python for the first time.  
I was attempting to practice a sample with numpy, and ran into these problems.

import numpy as np

A = np.array([[1, 2, 5], [2, -3, 2], [3, 1, -1]])  
B = np.array([[-17], [-16], [3]])

P = np.linalg.solve(A, B)  
print(P)

C:\Users\kland\PycharmProjects\pythonProject\venv\Scripts\python.exe C:\Users\kland\PycharmProjects\pythonProject\ftest.py  
0.18741221507637917  
3  
Traceback (most recent call last):  
File “C:\Users\kland\PycharmProjects\pythonProject\ftest.py”, line 4, in   
import numpy as np  
File “C:\Users\kland\PycharmProjects\pythonProject\venv\lib\site-packages\numpy\__init_\_.py”, line 144, in   
from numpy. **config** import show as show\_config  
File “C:\Users\kland\PycharmProjects\pythonProject\venv\lib\site-packages\numpy\__config_\_.py”, line 4, in   
from numpy.core._multiarray\_umath import (  
File "C:\Users\kland\PycharmProjects\pythonProject\venv\lib\site-packages\numpy\core\_init_.py", line 72, in   
from . import numerictypes as nt  
File “C:\Users\kland\PycharmProjects\pythonProject\venv\lib\site-packages\numpy\core\numerictypes.py”, line 595, in   
\_register\_types()  
File “C:\Users\kland\PycharmProjects\pythonProject\venv\lib\site-packages\numpy\core\numerictypes.py”, line 590, in \_register\_types  
numbers.Integral.register(integer)  
AttributeError: module ‘numbers’ has no attribute ‘Integral’

Process finished with exit code 1

Looks like the module that I was trying to import has the bugs rather than my main module. Can anyone figure what’s going on here?

---

<div class="post-metadata">

**Author:** ![MRAB](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@MRAB](https://discuss.python.org/u/MRAB)\
**Post date:** [March 22, 2024, 3:41am UTC](https://discuss.python.org/t/problem-with-the-numpy-module/49170/2 "2024-03-22T03:41:53Z")

</div>

I get this result:

```python
[[-1.]
 [2.]
 [-4.]]

```

and no error.

[Edit]

An online search suggests that it’s caused by a filename conflict.

Is one of your files called `numbers.py`? It might be finding that one instead of numpy’s `numbers.py`.

---

<div class="post-metadata">

**Author:** ![kknechtel](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kknechtel](https://discuss.python.org/u/kknechtel)\
**Post date:** [March 22, 2024, 3:45am UTC](https://discuss.python.org/t/problem-with-the-numpy-module/49170/3 "2024-03-22T03:45:19Z")

</div>

Please start by [reading the pinned thread](https://discuss.python.org/t/about-the-python-help-category/42) in order to understand how to format the code and diagnostic messages clearly. (Error output from Python is usually designed to be viewed in a terminal window, so it should be formatted the same way as the code). It will also be helpful to write some prose in between in order to walk us through what you are actually doing, what you expect to happen when you do that, what happens instead, and why you are confused by that result.

If you think the problem is with someone else’s code, or with the installation of that code, you should start by trying to create as simple of an example as possible that reproduces the problem - even if that means you only `import` something and see what happens. If you’re running into a problem with third-party code that you installed, it’s also helpful to explain how you installed the code, what version of the library you have, what version of Python is being used, or anything else that seems suspicious.

It looks like you are using PyCharm to run the code? It would be better to explain this up front; and if you used PyCharm to set up Numpy etc., explain what steps you took here.

* * *

All of that said, from what I can read and make out from what you have so far, this is my best guess: you have a file called `numbers.py` in your own code, which conflicts with the standard library (which Numpy is trying to use here). Please read this for reference:

> <https://stackoverflow.com/questions/36250353/importing-a-library-from-or-near-a-script-with-the-same-name-raises-attribute>

---

<div class="post-metadata">

**Author:** ![klander](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@klander](https://discuss.python.org/u/klander)\
**Post date:** [March 26, 2024, 1:40am UTC](https://discuss.python.org/t/problem-with-the-numpy-module/49170/4 "2024-03-26T01:40:29Z")

</div>

Yes, I wrote a practice file and named it numbers a while back. Thank you for that
