[Numpy-discussion] TypeError: 'module' object is not callable
Jankins
andyjian430074 at gmail.com
Mon Jan 11 22:31:47 EST 2010
linalg has no attribute "eigen".
Are you able to use scipy.sparse.linalg.eigen?
My working dir is not inside scipy. It is 'C:\\Users\\jankins'.
I am using Python 2.6.2 and the latest version of scipy.
What should I do? And I couldn't even successfully install scipy in
Ubuntu 9.10 neither by "easy_install" or "source compilation". I am so
desperate.
I planed to use the function to calculate the eigenvalue of a graph.The
graph has about 265,214 nodes and 420,045 edges. So it's better to use
sparse matrix.
Jankins
On 1/11/2010 8:55 PM, josef.pktd at gmail.com wrote:
> On Mon, Jan 11, 2010 at 9:03 PM, Jankins<andyjian430074 at gmail.com> wrote:
>
>> Here is the command line python:
>>
>> >>> import scipy.sparse.linalg as linalg
>> >>>
>> >>> linalg.eigen()
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> TypeError: 'module' object is not callable
>> >>>
>>
> linalg.eigen.eigen ?
>
> Is your working directory inside scipy ?
>
> I have no idea, since I'm not able not to get the function, and your
> information is a bit minimal.
>
> Josef
>
>
>> It's really wired.
>>
>> Jankins
>>
>> On 1/11/2010 7:53 PM, josef.pktd at gmail.com wrote:
>>
>>> On Mon, Jan 11, 2010 at 7:16 PM, Jankins<andyjian430074 at gmail.com> wrote:
>>>
>>>
>>>> I am sorry. My bad.
>>>>
>>>> File "C:\test.py", line 7, in<module>
>>>> print linalg.eigen(M)
>>>> TypeError: 'module' object is not callable
>>>>
>>>> I installed "pythonxy". "pythonxy" has already included the scipy package.
>>>>
>>>> On 1/11/2010 6:12 PM, Robert Kern wrote:
>>>>
>>>>
>>>>> On Mon, Jan 11, 2010 at 18:03, Jankins<andyjian430074 at gmail.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> It is very simple code:
>>>>>>
>>>>>> import networkx as nx
>>>>>> import scipy.sparse.linalg as linalg
>>>>>>
>>>>>> G = nx.Graph()
>>>>>> G.add_star(range(9))
>>>>>> M= nx.to_scipy_sparse_matrix(G)
>>>>>> print linalg.eigen(M)
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>> Please post the complete traceback.
>>>>>
>>>>>
>>> eigen is both a function and a module. Normally the function shadows the module
>>>
>>>
>>>
>>>> python
>>>>
>>>>
>>> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
>>> win32
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>>>> import scipy.sparse.linalg.eigen
>>>>>> scipy.sparse.linalg.eigen
>>>>>>
>>>>>>
>>> <function eigen at 0x01541AB0>
>>>
>>> I'm not able to import the eigen module, so there is either something
>>> different with python 2.6 or networkx is doing some magic ?
>>>
>>> Can you try without networkx, try linalg.eigen.eigen ?
>>>
>>> Does
>>>
>>>
>>>>>> scipy.sparse.linalg.eigen
>>>>>>
>>>>>>
>>> show the module or the function?
>>>
>>> Josef
>>>
>>> PS: I don't like functions shadowing a module
>>>
>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> NumPy-Discussion mailing list
>>>> NumPy-Discussion at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list