F Baig
F Baig

Reputation: 357

Python 3.10 QuTip: AttributeError: can't set attribute 'format'

I'm trying to setup a simple docker container to make my code portable. Following is the docker container setup that I start with

docker run -it --name qutip_portble python:3.10.9-slim bash

Once the docker container starts, I install some packages as follows

pip install qutip
pip install matplotlib

Both of these install succesfully without any error. However, when I try to run the following import in python

import qutip

I get the following error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/qutip/__init__.py", line 106, in <module>
    from qutip.qobj import *
  File "/usr/local/lib/python3.10/site-packages/qutip/qobj.py", line 2526, in <module>
    import qutip.superop_reps as sr
  File "/usr/local/lib/python3.10/site-packages/qutip/superop_reps.py", line 74, in <module>
    _SINGLE_QUBIT_PAULI_BASIS = (identity(2), sigmax(), sigmay(), sigmaz())
  File "/usr/local/lib/python3.10/site-packages/qutip/operators.py", line 508, in identity
    return qeye(dims)
  File "/usr/local/lib/python3.10/site-packages/qutip/operators.py", line 488, in qeye
    return Qobj(fast_identity(size),
  File "/usr/local/lib/python3.10/site-packages/qutip/fastsparse.py", line 389, in fast_identity
    return fast_csr_matrix((data,ind,ptr),shape=(N,N))
  File "/usr/local/lib/python3.10/site-packages/qutip/fastsparse.py", line 55, in __init__
    self.format = 'csr'
AttributeError: can't set attribute 'format'

I get this error at the import stage before even writing any code of mine. Therefore, I'm assuming this is because of some setup issue. Any help will be appreciated.

Upvotes: 0

Views: 559

Answers (1)

F Baig
F Baig

Reputation: 357

Solution (thanks to liginity): Use following commands while setting up the packages to explicitly install scipy version 1.10.1

pip install scipy==1.10.1
pip install qutip
pip install matplotlib

Upvotes: 1

Related Questions