Installation error

1,367 views
Skip to first unread message

sud...@gmail.com

unread,
Jul 24, 2014, 1:44:37 PM7/24/14
to qu...@googlegroups.com
I tried the installation using the guide
http://qutip.org/docs/3.0.0/installation.html

and still end up with this error.

import qutip.testing as qt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named qutip.testing


The package is installed perfectly. Please suggest alternatives.

Paul Nation

unread,
Jul 24, 2014, 9:09:31 PM7/24/14
to qu...@googlegroups.com
Can you tell us which platform you are using and how you installed Python?

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

sud...@gmail.com

unread,
Jul 25, 2014, 12:04:45 PM7/25/14
to qu...@googlegroups.com
I am using ubuntu 14.04 and I followed all the steps mentioned there in.

I hope this helps.

Jean-Luc Orgiazzi

unread,
Jul 25, 2014, 3:59:05 PM7/25/14
to qu...@googlegroups.com, sud...@gmail.com
Hello,

I also experienced the same problem when I first tried to install it using QuTiP’s PPA. 
I have a solution. First I'd like to mention I am using  Ubuntu 14.04 LTS, trusty, x64, in an "Oracle VM Virtualbox" virtual machine.
I followed all the following steps:

  1. Upgrade/update your Ubuntu system (unless you don't want to!). Use the following commands, and adapt as desired if you do not want to upgrade your distribution or do the cleaning.
    >sudo apt-get update
    >sudo apt-get upgrade
    >sudo apt-get dist-upgrade

    >sudo apt-get update
    >sudo apt-get upgrade
    >sudo apt-get autoremove
    >sudo apt-get autoclean
    >sudo apt-get check

  2. I then installed Qutip 3 using PPA. I already had Qutip 2.2.X installed manually on my system:
    >sudo add-apt-repository ppa:jrjohansson/qutip-releases
    >sudo apt-get update
    >sudo apt-get install python-qutip
    Output:
    orgiazzi@orgiazzi-VirtualBox:~$ sudo apt-get install python-qutip
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      libphonon4 libpyside1.2 libshiboken1.2 phonon phonon-backend-gstreamer
      phonon-backend-gstreamer-common python-pyside python-pyside.phonon
      python-pyside.qtcore python-pyside.qtdeclarative python-pyside.qtgui
      python-pyside.qthelp python-pyside.qtnetwork python-pyside.qtopengl
      python-pyside.qtscript python-pyside.qtsql python-pyside.qtsvg
      python-pyside.qttest python-pyside.qtuitools python-pyside.qtwebkit
      python-pyside.qtxml
    Use 'apt-get autoremove' to remove them.
    The following packages will be upgraded:
      python-qutip
    1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 2,230 B of archives.
    After this operation, 983 kB disk space will be freed.
    Get:1 http://ppa.launchpad.net/jrjohansson/qutip-releases/ubuntu/ trusty/main python-qutip amd64 3.0.0-0~2683~ubuntu14.04.1 [2,230 B]
    Fetched 2,230 B in 0s (7,221 B/s)         
    (Reading database ... 248154 files and directories currently installed.)
    Preparing to unpack .../python-qutip_3.0.0-0~2683~ubuntu14.04.1_amd64.deb ...
    Unpacking python-qutip (3.0.0-0~2683~ubuntu14.04.1) over (2.2.0-0~1922~ubuntu13.10.1) ...
    Setting up python-qutip (3.0.0-0~2683~ubuntu14.04.1) ...

  3. I tried loading Qutip in an iPython window:
    In [1]: from qutip import *
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-674d9281af88> in <module>()
    ----> 1 from qutip import *

    ImportError: No module named qutip

    In [2]: import qutip.testing as qt
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-2-ae6395ba7937> in <module>()
    ----> 1 import qutip.testing as qt

  1. ImportError: No module named qutip.testing
  1. ->too bad, let's try a manual install then.
  2. Download Qutip zip file from https://github.com/qutip/qutip/tree/qutip-3.0.X  and extract compressed file (in Home\downloads for me)
  3. Install/Upgrade all dependencies needed for Qutip as per manual (for python 2.7 in my case):
    sudo apt-get install python-dev cython python-setuptools python-nose
    sudo apt-get install python-numpy python-scipy python-matplotlib
    sudo apt-get install texlive-latex-extra
    sudo apt-get install mayavi2
    sudo apt-get install libblas-dev
    sudo apt-get install gfortran

  4. go to the extracted Qutip folder root "qutip-qutip-3.0.X" and run the install command (with Fortran in my case):
    sudo python setup.py install --with-f90mc

  5. In iPython, try loading Qutip:
    In [1]: from qutip import *
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-674d9281af88> in <module>()
    ----> 1 from qutip import *

    /usr/local/lib/python2.7/dist-packages/qutip/__init__.pyc in <module>()
        215 from qutip.tomography import *
        216 from qutip.wigner import *
    --> 217 from qutip.random_objects import *
        218 from qutip.simdiag import *
        219 from qutip.entropy import (entropy_vn, entropy_linear, entropy_mutual,

    /usr/local/lib/python2.7/dist-packages/qutip/random_objects.py in <module>()
        254 # TRAILING IMPORTS
        255 # qutip.propagator depends on rand_dm, so we need to put this import last.
    --> 256 from qutip.propagator import propagator

    /usr/local/lib/python2.7/dist-packages/qutip/propagator.py in <module>()
         45 from qutip.sesolve import sesolve
         46 from qutip.essolve import essolve
    ---> 47 from qutip.steadystate import steadystate
         48 from qutip.states import basis
         49 from qutip.states import projection

    /usr/local/lib/python2.7/dist-packages/qutip/steadystate.py in <module>()
         49 from qutip.random_objects import rand_dm
         50 from qutip.sparse import sp_permute, sp_bandwidth, sp_reshape
    ---> 51 from qutip.graph import reverse_cuthill_mckee, weighted_bipartite_matching
         52 from qutip.states import ket2dm, maximally_mixed_dm
         53 import qutip.settings as settings

    /usr/local/lib/python2.7/dist-packages/qutip/graph.py in <module>()
         38 import numpy as np
         39 import scipy.sparse as sp
    ---> 40 from qutip.cy.graph_utils import (
         41     _pseudo_peripheral_node, _breadth_first_search, _node_degrees,
         42     _reverse_cuthill_mckee, _maximum_bipartite_matching,

    ImportError: cannot import name _reverse_cuthill_mckee

    In [2]: import qutip.testing as qt
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-2-ae6395ba7937> in <module>()
    ----> 1 import qutip.testing as qt

    /usr/local/lib/python2.7/dist-packages/qutip/__init__.pyc in <module>()
        121 info = hardware_info()
        122 if 'cpus' in info:
    --> 123     qutip.settings.num_cpus = info['cpus']
        124 else:
        125     qutip.settings.num_cpus = multiprocessing.cpu_count()

    AttributeError: 'module' object has no attribute 'settings'
    -> a new problem! good news! let's fix this one now.
  6. Close the iPython window.

  7. "name _reverse_cuthill_mckee" seems to be the problem, let's recompile  graph_utils.jyx with cython.
    1. in a terminal, move your current position to the folder >qutip-qutip-3.0.X\qutip\cy\
    2. there, run the command:
      cython graph_utils.pyx
    3. A new graph_utils.c file is created

  8. Install Qutip again, go to the extracted Qutip folder root "qutip-qutip-3.0.X" and run the install command (with Fortran in my case):
    sudo python setup.py install --with-f90mc
  9. In a iPython window, try loading Qutip:
    In [1]: from qutip import *
    In [2]: about()

    QuTiP: Quantum Toolbox in Python
    Copyright (c) 2011 and later.
    Paul D. Nation & Robert J. Johansson

    QuTiP Version:       3.0.0
    Numpy Version:       1.8.1
    Scipy Version:       0.13.3
    Cython Version:      0.20.2
    Matplotlib Version:  1.3.1
    -> it works now
    In [3]: import qutip.testing as qt
    In [4]: qt.run()

  10. All the ~226 tests should now run just fine.
I hope this works for you as well. I am not sure if the cython compilation should have been done with additional arguments, to optimize the code (as in the cy folder setup.py file), but for now all seems to work for me. Paul and Robert, please advise! Thanks a lot. Let me know if you need my Qutip install log file if it can help.

Jean-Luc Orgiazzi 

jrjoh...@gmail.com

unread,
Jul 25, 2014, 7:01:47 PM7/25/14
to qutip group

Hi. Thanks for the detailed install log. I will look into this more closely asap, but I am quite sure your problems are due to issues with the qutip ppa. So please avoid the ppa until it has been fixed, and uninstall python-qutip if it is installed. Instead, for now please install from source, or install using pip.

I will post an update here when the ppa has been fixed.

Rob

Jean-Luc Orgiazzi

unread,
Jul 25, 2014, 7:14:23 PM7/25/14
to qu...@googlegroups.com
Hello Rob,

The cy\setup.py file do not recompile the pyx files into new c files when installing from source since the variable QUTIP_RELEASE is set to TRUE in this release branch 3.0.X (variable ISRELEASED  is TRUE). I guess setting this variable to False in the main Qutip install setup.py file before running the installation command would have prevented me to compile manually with cython again the graph_utils.pyx file.

Cheers,

Jean-Luc

jrjoh...@gmail.com

unread,
Jul 25, 2014, 10:12:08 PM7/25/14
to qutip group
Hi Jean-Luc

Thanks for pointing this out. Yes, in a release we do not regenerate the cython files by default, so the setup.py script will use the distributed c fles. I guess the issue C file is not up-to-date in the 3.0.X branch. Do you have the same problem with the official release source distribution?


Note that downloading the qutip-3.0.X branch from github is not the same as the official release source distribution, because it is not necessarily the case that all generated files that goes into the release distribution is included in the repository, and it is a branch that will be updated for future point releases. Better to use the source distribution file we provide on the web page and through pypi.  

Rob

Jean-Luc Orgiazzi

unread,
Jul 26, 2014, 5:27:28 PM7/26/14
to qu...@googlegroups.com
Hello Rob,

I installed Qutip 3.0.0 from http://qutip.org/downloads/3.0.0/qutip-3.0.0.tar.gz, on Ubuntu 14.04 LTS with:
sudo python setup.py install --with-f90mc
which resulted in the following install log file: see attached install_log.txt
There are a certain number of warnings during the install, but no errors with loading Qutip and no problems with the qt.run() tests. 226 tests ran and one skipped (Graph: Graph Degree ... SKIP: Networkx not installed.)

Jean-Luc
install_log.txt

jrjoh...@gmail.com

unread,
Aug 5, 2014, 3:08:46 AM8/5/14
to qutip group
The PPA with deb packages for qutip should now be working again, and there is now also a python3 version (python3-qutip) as well.

Rob

sud...@gmail.com

unread,
Aug 6, 2014, 11:05:28 PM8/6/14
to qu...@googlegroups.com
Hi

The problem is resolved and it is working fine. Thank you all for the input and the effort.

Regards

Sudhanva!

fruck...@163.com

unread,
Aug 14, 2014, 6:37:41 PM8/14/14
to qu...@googlegroups.com
Dear Sir
I have followed all the procedures but i cannot install qutip. I get AttributeError: 'module' object has no attribute 'settings'. I am using ubuntu.
An important question.
How to uninstall qutip so that I can install again?
Thanks.

fruck...@163.com

unread,
Aug 14, 2014, 6:42:44 PM8/14/14
to qu...@googlegroups.com, sud...@gmail.com
Dear Sir,
I also get another error.
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qutip.testing as qt
QuTiP warning: old version of scipy detected (0.9.0), requiring 0.11.0.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "qutip/__init__.py", line 185, in <module>
    from qutip.qobj import *
  File "qutip/qobj.py", line 56, in <module>
    from qutip.ptrace import _ptrace
  File "qutip/ptrace.py", line 37, in <module>
    from qutip.sparse import sp_reshape
  File "qutip/sparse.py", line 43, in <module>
    _dznrm2 = get_blas_funcs("znrm2")
  File "/usr/lib/python2.7/dist-packages/scipy/linalg/blas.py", line 58, in get_blas_funcs
    func = getattr(m2,func_name)
AttributeError: 'module' object has no attribute 'dz'

Thank you and I hope I can get the instruction of how to uninstall qutip in the first place.

jrjoh...@gmail.com

unread,
Aug 15, 2014, 5:57:22 AM8/15/14
to qutip group

Which version of ubuntu do you use, and how did you install qutip (apt-get, pip, or from source)?

Rob

fruck...@163.com

unread,
Aug 15, 2014, 7:25:56 AM8/15/14
to qu...@googlegroups.com
Dear Rob,
The version is ubuntu 12.04. I installed qutip from apt-get first but it did not work so I installed qutip from source again. It did not work also.   followed the instructions on the installation user guide on website. Therefore, I hope I can know how to uninstall qutip completely so that I can install qutip again. Thank you.

jrjoh...@gmail.com

unread,
Aug 15, 2014, 8:37:46 PM8/15/14
to qutip group
You can remove the qutip you installated with apt-get using

sudo apt-get remove python-qutip

ubuntu 12.04 is quite old by now and to install qutip 3.0 you will probably have to update some of the dependency packages (numpy, scipy, etc) before installing qutip from source. You can probably use pip to do that, like this

sudo pip install --upgrade cython
sudo pip install --upgrade numpy
sudo pip install --upgrade scipy
sudo pip install --upgrade matplotlib 

Then you will need to install qutip from source, because unfortunately our current PPA with ubuntu packages we only support 14.04 or later.

If you need to uninstall the qutip your installed from source you need to delete the qutip directory in 

/usr/local/lib/python2.7/site-packages/qutip

(you might need to replace 2.7 with something else if you used a different python version)

Rob

fruck...@163.com

unread,
Aug 15, 2014, 11:28:09 PM8/15/14
to qu...@googlegroups.com
Dear Rob,
Thank you. I found that I do not have the permission to delete the directory inside python2.7.
I found that after reinstallation of scipy from file. I can install the qutip3.0.1.
However there are some problems in the tests.
I have clipped the test image and also the about() image. Can you suggest why these errors occurs and the test stops? Thank you.
about.png
t1.png
t2.png
t3.png

jrjoh...@gmail.com

unread,
Aug 15, 2014, 11:32:46 PM8/15/14
to qutip group
I think you have conflicting versions of qutip installed. Use the sudo command to obtain the permissions to delete the folder I mentioned in the previous message:

sudo rm -rf /usr/local/lib/python2.7/site-packages/qutip
and then reinstall qutip.

Rob

fruck...@163.com

unread,
Aug 16, 2014, 7:52:57 PM8/16/14
to qu...@googlegroups.com
Hi Rob,
Thank you. I can now remove old qutip in python2.7 file and reinstall it. The test goes well.

jonatha...@gmail.com

unread,
Sep 3, 2014, 4:46:06 PM9/3/14
to qu...@googlegroups.com
I'm attempting to install the source from the qutip main page on a linux machine.

I use python-2.7.7 ./setup.py install --with-f90mc --prefix ~/

installation proceeds without any apparent errors.  Fortran source is compiled and  installed in mcsolve_f90.pyc and qutraj_run.so are installed in
~/lib/python2.7/site-packages/qutip/fortran/

however, the fortran mcsolver is not being found when qutip is loaded in python.

>>> from qutip import *
>>> about()

QuTiP: Quantum Toolbox in Python
Copyright (c) 2011 and later.
Paul D. Nation & Robert J. Johansson

('QuTiP Version:      ', '3.0.1')
('Numpy Version:      ', '1.8.1')
('Scipy Version:      ', '0.14.0')
('Cython Version:     ', '0.20.1')
('Matplotlib Version: ', '1.3.1')
('Fortran mcsolver:   ', 'False')
('scikits.umfpack:    ', 'False')
('Python Version:     ', '2.7.7')
('Platform Info:      ', 'Linux', '(x86_64)')
()


I tried adding ~/lib/python2.7/site-packages/qutip/fortran/ to the pythonpath but that didnt help.  any ideas?


Jonathan DuBois

unread,
Sep 4, 2014, 12:42:06 PM9/4/14
to qu...@googlegroups.com
using gfortran instead of ifort and it now works.  The problem seems to be with the linking stage in ifort.  

if compiled with ifort, when loading mcsolve_f90 there is an undefined symbol __kmpc_end.

>import mcsolve_f90
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/lib/python2.7/site-packages/qutip/fortran/mcsolve_f90.py", line 38, in <module>
    from qutip.fortran import qutraj_run as qtf90
ImportError: ~/lib/python2.7/site-packages/qutip/fortran/qutraj_run.so: undefined symbol: __kmpc_end





--
You received this message because you are subscribed to a topic in the Google Groups "qutip" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qutip/HGl8uGyJp-0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qutip+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages