2016-07-18 116 views
13

quando corro import theano in Python, ricevo il seguente messaggio di errore:Importazione Theano: AttributeError: 'modulo' oggetto non ha attributo 'find_graphviz'

Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import theano 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 74, in <module> 
    from theano.printing import pprint, pp 
    File "/usr/local/lib/python2.7/dist-packages/theano/printing.py", line 35, in <module> 
    if pd.find_graphviz(): 
AttributeError: 'module' object has no attribute 'find_graphviz' 

Quale potrebbe essere il problema e come risolverlo ?

Uso Theano 0.8.2 su Ubuntu 14.04.4 LTS x64 con Python 2.7.6 x64.


ho provato senza successo:

  • sudo apt-get install -y graphviz libgraphviz-dev

risposta

21

In pydot versione 1.2.x, find_graphviz funzione sono stati deprecated. Per risolvere questo problema, è necessario installare la versione 1.1.0 di pydot qui https://github.com/erocarrera/pydot/tree/v1.1.0. Ed è lavoro per me. Posso aiutare.

+1

Grazie, vedo che alcune persone [raccomandano] (https://github.com/Theano/Theano/commit/8d4e0fd0053496ccfed002ea2898a09627443e4e) 'pydot-ng' –

+7

Se hai bisogno di una versione precedente di un pacchetto python come pydot, specificalo durante l'installazione o nel tuo 'requirements.txt', come questo:' pip installa pydot == 1.1.0' – hobs

4

Per qualche ragione, il modulo Python pydot stava creando il problema:

Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 
>>> import pydot 
>>> pydot.find_graphviz() 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
AttributeError: 'module' object has no attribute 'find_graphviz' 

stavo usando pydot 1.2. 2.

L'ho disinstallato utilizzando sudo pip uninstall -y pydot e sono riuscito a eseguire correttamente import theano.

Bug report: https://github.com/Theano/Theano/issues/4759

11

ho risolto installando pydot-ng ->$ pip install pydot-ng

2

ho risolto utilizzando

sudo pip install graphviz 
sudo apt-get install graphviz 

con la versione 1.2.3 funziona bene pydot

Problemi correlati