shmn shmn - 3 years ago 214
Python Question

Error while importing matplotlib.pyplot with Geany IDE

im trying to import matplotlib.pyplot, here is my code:

import matplotlib.pyplot as plt

squares = [1, 4, 9, 16, 25]
plt.plot(squares)
plt.show()


I'm using the Geany IDE under Ubuntu 16.04.03, and i'm getting the
following errormessage

[1, 2, 3, 4, 5]
Traceback (most recent call last):
File "mpl_squares.py", line 1, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python3.5/dist-packages/matplotlib/__init__.py", line 122, in <module>
from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
File "/usr/local/lib/python3.5/dist-packages/matplotlib/cbook.py", line 32, in <module>
import numpy as np
File "/usr/local/lib/python3.5/dist-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/local/lib/python3.5/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python3.5/dist-packages/numpy/core/__init__.py", line 35, in <module>
from . import _internal # for freeze programs
File "/usr/local/lib/python3.5/dist-packages/numpy/core/_internal.py", line 18, in <module>
from .numerictypes import object_
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numerictypes.py", line 962, in <module>
_register_types()
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numerictypes.py", line 958, in _register_types
numbers.Integral.register(integer)
AttributeError: module 'numbers' has no attribute 'Integral'


This error occurs only when i'm using the Geany IDE, when i'm running the
code in the terminal it works fine.

Has somebody an idea what's wrong with Geany?

Thanks in advance!

Answer Source

With Geany your working directory is different. I'm thinking it's the same as here:

https://www.reddit.com/r/learnpython/comments/5pvdjk/module_object_has_no_attribute_integral/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download