question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Qutip fails to install on Python 3.11.0

See original GitHub issue

Bug Description

Installing qutip with pip on Python 3.11 fails at the “Getting the requirements to build the wheel” stage.

Potentially related to these changes in packaging, introduced in the latest update to 22.0.

Code to Reproduce the Bug

pip install qutip --no-cache-dir

Code Output

Collecting qutip
  Downloading qutip-4.7.0.tar.gz (3.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 18.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/Users/hsilver/opt/miniconda3/envs/py311/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/Users/hsilver/opt/miniconda3/envs/py311/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/hsilver/opt/miniconda3/envs/py311/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/h9/04p7x4ds0hvfmd80jt8gx3kc0000gn/T/pip-build-env-dzdmg7x6/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/h9/04p7x4ds0hvfmd80jt8gx3kc0000gn/T/pip-build-env-dzdmg7x6/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/h9/04p7x4ds0hvfmd80jt8gx3kc0000gn/T/pip-build-env-dzdmg7x6/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 247, in <module>
        File "<string>", line 46, in process_options
        File "<string>", line 130, in _determine_version
      AttributeError: module 'packaging.version' has no attribute 'LegacyVersion'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Expected Behaviour

Should install qutip without errors.

Your Environment

QuTip Version: 4.7.0
Python version: 3.11.0
`packaging` version: 22.0
`pip` version: 22.3.1

Additional Context

I explicitly mention Python 3.11 because I failed to replicate the issue on a fresh Python 3.10 environment.

EDIT: Looking deeper into the qutip built distributions, the reason why this is failing only for Python 3.11 is because earlier versions of Python have built distributions, unlike Python 3.11.

This indicates that building the wheel from source is generally broken, which I confirmed by forcing an installation from source on Python 3.10 with

pip install qutip --no-cache-dir --no-binary :all:

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
hodgestarcommented, Dec 12, 2022

QuTiP 4.7.1 has been released to PyPI – https://pypi.org/project/qutip/4.7.1/ – and pip install qutip now works for me on Python 3.11.

2reactions
hodgestarcommented, Dec 12, 2022

I’m busy checking builds in #2046, and hopefully once those are running successfully, we can release. It’s the usual dance of figuring out which versions of SciPy and numpy to build for.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Qutip fails to install on Python 3.11.0 - PullAnswer
note: This error originates from a subprocess, and is likely not a problem with pip. Expected Behaviour. Should install qutip without errors.
Read more >
Installation — QuTiP 4.7 Documentation
The rest of this page covers installation directly from conda, installation from source, and additional considerations when working on Windows. General ...
Read more >
I am getting an error on Python 3.11.0 : r/learnpython - Reddit
Hello, I have recently installed python on my mac. It is version 3.11.0 I keep getting this error: Error processing line 1 of…...
Read more >
BUG: Failed building wheel for numpy in Python 3.10 #20039
Describe the issue: I have download the new Python 3.10 and tried to run some code. ... Python 3.10 breaks qutip install qutip/qutip#1732....
Read more >
Error while installing QuTiP - Google Groups
I did install Anaconda 4.3.0 for Windows (Python 3.6 version 64 bit). I tried installing QuTiP from source the way it is shown...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found