NameError: global name 'Qobj' is not defined

163 views
Skip to first unread message

pmor...@alumnos.unex.es

unread,
Dec 31, 2016, 4:36:20 PM12/31/16
to QuTiP: Quantum Toolbox in Python
Hi,
I get a weird error that I am not able to correct. I am running the file transmon.py and I get the error
Traceback (most recent call last):
  File "/home/trasmon.py", line 80, in <module>
    energies = array([hamiltonian(Ec, Ej, N, ng).eigenenergies() for ng in ng_vec])
  File "/home/trasmon.py", line 30, in hamiltonian
    return Qobj(m)
NameError: global name 'Qobj' is not defined
However if I try copy-pasting the code to console it will return no errors.
Any ideas how to solve this?
Thanks in advance
trasmon.py

Paul Nation

unread,
Dec 31, 2016, 5:37:55 PM12/31/16
to QuTiP: Quantum Toolbox in Python, pmor...@alumnos.unex.es
Script works for me, so not sure.  If QuTiP was not installed, then it would fail at `from qutip import *`, however that is not the case. Moreover that import * loads the Qobj class so, it should be there.  Can you print the info from the qutip.about() function?

- P

Pablo Antonio Moreno Casares

unread,
Jan 1, 2017, 6:52:23 AM1/1/17
to QuTiP: Quantum Toolbox in Python

---------- Forwarded message ----------
From: Pablo Antonio Moreno Casares <pmor...@alumnos.unex.es>
Date: 2017-01-01 12:06 GMT+01:00
Subject: Re: NameError: global name 'Qobj' is not defined
To: Paul Nation <nonher...@gmail.com>


Thanks Paul,
I added the line
qutip.about()

just before  calculating the energies, and I get the same kind of error:


Traceback (most recent call last):
  File "trasmon.py", line 82, in <module>
    qutip.about()
NameError: name 'qutip' is not defined








Alex Pitchford

unread,
Jan 1, 2017, 6:58:10 AM1/1/17
to qu...@googlegroups.com
You will either have to
import qutip
qutip.about()

or just call
about()

after your 
from qutip import *

I would suggest that you install anaconda python and then install the latest qutip from:

--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages