Closed The-Real-Thisas closed 2 years ago
Thanks for the report. Ideally this is something you'd take up with tweedledum rather than us, but as far as I know, Bruno (the maintainer) has been rather busy recently, so you might not get a very prompt response. If we can't work out a solution, we might need to consider making tweedledum an optional dependency instead - we don't use it too much internally.
On a brief glance on its PyPI page, it looks like tweedledum has wheels released for M1 Mac for tweedledum 1.1.0, but not 1.1.1. Unfortunately, the changelog for 1.1.1 just says "fix wheels on macOS", so I'm guessing 1.1.0 is broken. Still, you could try pip install tweedledum==1.1.0 qiskit
, and see if it works.
Paul (@nonhermitian): I don't have an M1 - do you know any more about what's necessary here, since I'd thought we'd solved the M1 issues?
I tried installing it in a new conda env with --no-cache-dir
and the 1.1.1
wheel built fine. This is on Py310
To be clear, I have not had any M1 problems outside of openblas+scipy
issues in recent memory.
@jakelishman Thanks for the prompt response. I can confirm that pip install tweedledum==1.1.0 qiskit
installs on my machine. I agree and I'll start an issue on the tweedledum repo but for documentation purposes I recommend keeping this issue active until it gets resolved just so anyone trying to just pip install qiskit
like I did will know what to do till a fix is implemented. I also suggest changing the tag from feature request to something more appropriate as I don't think I can change it myself. Thanks again for the quick response, appreciate it.
It's quite possible that the build requires having specific C compiler tooling and potentially various header files of C/Fortran libraries available on your system, which may be why you're struggling while other people haven't been. There's also the chance that a recent update to macOS broke stuff - I saw you're on the macOS-12.3 SDK - as Apple have a very annoying tendency to remove stuff from their header files.
Either way, as long as it's working for now, that's good. Hopefully tweedledum can take a look, and if not, we'll have to make a bigger plan on the Qiskit side.
@jakelishman You reckon it might be feasible to change the requirements to use tweedledum==1.1.0
specifically until the problem gets resolved on tweedledum's end. I assume that won't break anything for people on x86 and would mean new users on m1 can just use pip install qiskit
without having to look up the issue. It's a bit of a hack but wondering if thats a possibility. If so I can start a pull just making that switch.
PS: Totally agree with you on the possible cause, in fact there are some known issues with certain macos versions where it's recommended just to build from source https://github.com/boschmitt/tweedledum#known-issues
It is a fair question to ask why is it a requirement in the first place?
@nonhermitian I believe this may answer your question.
We rely on tweedledum to synthesize phase oracles which is commonly used functionality and several issues have been opened. This use of tweedledum will likely continue to grow so we should just list it as a requirement moving forward.
Source: https://github.com/Qiskit/qiskit-terra/commit/927fd0226bf7c7e4e4cd9434d612bd7bb4b05ecc
Yeah I know the backstory, but disagree with that decision as I do not think that that functionality is used by many people at all. I personally have never had to use it, but have run into similar issues as this previously with the builds of tweedledum. There is no tutorial, and no demonstration of usage beyond a single code block in the documentation (the supp mat does not open for me). So I push back on the fact that this should be a requirement at all. If it is a hard requirement then I would expect more demonstrations of value than a single snippet.
From a Terra dev meeting today: we made the decision to move tweedledum to being an optional dependency. Terra 0.22, which will release in about a month, will still have it as a core requirement because we need to issue deprecation warnings, but it will be removed in 0.23.
In the mean time, I'll see if we can do anything about getting a macOS ARM wheel for tweedledum 1.1.1, and if not, I might be able to tweak the requirement so that only 1.1.0 is permitted for ARM macs.
FWIW, my normal suggestion in this case is to do something like pip install --prefer-binary tweedledum qiskit-terra
which should install tweedledum from a precompiled binary along with terra.
@jakelishman environment markers are gonna be a bit tricky here, the easiest way would probably to have 2 entries in the requirements list something like:
tweedledum>=1.1,<2.0;platform_machine != 'arm64' or sys_platform != 'darwin'
tweedledum>=1.1,<2.0,!=1.1.1;platform_machine == 'arm64' and sys_platform == 'darwin'
Thanks @jakelishman , do let me know how I could help.
Hello, This is my setup:
Python 3.8.10 (default, Sep 30 2022, 09:53:07)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
~ % uname -a
Darwin mprox 21.5.0 Darwin Kernel Version 21.5.0: root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64
% ARCHFLAGS="-arch arm64" pip install tweedledum==1.0.0 qiskit --compile --no-cache-dir
I was able to install tweedledum for arm64, but none of the suggestions above worked for me regarding qiskit.
Qiskit needs tweedledum 1.1+, and your install line there has 1.0, which might be the issue, but without a full error message, I can't be sure. If you change that to 1.1.0 you might have some success. In the interim, while we need to wait for Terra 0.23 to remove the requirement entirely, I've made #8818 that will add the required constraint to Terra's install requirements, and should go out with Terra 0.22 early/mid next week.
Has this been taken care of already? I am having the same issue.
% uname -a
Darwin interstellar 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
% python3 --version
Python 3.10.7
% python3 -m pip install qiskit --no-cache --upgrade --force-reinstall
Collecting qiskit
Downloading qiskit-0.38.0.tar.gz (13 kB)
Preparing metadata (setup.py) ... done
Collecting qiskit-terra==0.21.2
Downloading qiskit_terra-0.21.2-cp310-cp310-macosx_11_0_arm64.whl (6.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 7.6 MB/s eta 0:00:00
Collecting qiskit-aer==0.11.0
Downloading qiskit_aer-0.11.0-cp310-cp310-macosx_11_0_arm64.whl (8.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.5/8.5 MB 7.5 MB/s eta 0:00:00
Collecting qiskit-ibmq-provider==0.19.2
Downloading qiskit_ibmq_provider-0.19.2-py3-none-any.whl (240 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.4/240.4 kB 7.7 MB/s eta 0:00:00
Collecting numpy>=1.16.3
Downloading numpy-1.23.3-cp310-cp310-macosx_11_0_arm64.whl (13.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.3/13.3 MB 7.1 MB/s eta 0:00:00
Collecting scipy>=1.0
Downloading scipy-1.9.1-cp310-cp310-macosx_12_0_arm64.whl (29.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 29.9/29.9 MB 7.7 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.0
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 8.5 MB/s eta 0:00:00
Collecting websocket-client>=1.0.1
Downloading websocket_client-1.4.1-py3-none-any.whl (55 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.0/55.0 kB 235.7 MB/s eta 0:00:00
Collecting urllib3>=1.21.1
Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.4/140.4 kB 8.5 MB/s eta 0:00:00
Collecting websockets>=10.0
Downloading websockets-10.3-cp310-cp310-macosx_11_0_arm64.whl (97 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.3/97.3 kB 5.4 MB/s eta 0:00:00
Collecting requests>=2.19
Downloading requests-2.28.1-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 12.9 MB/s eta 0:00:00
Collecting requests-ntlm>=1.1.0
Downloading requests_ntlm-1.1.0-py2.py3-none-any.whl (5.7 kB)
Collecting symengine>=0.9
Downloading symengine-0.9.2-cp310-cp310-macosx_11_0_arm64.whl (14.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.9/14.9 MB 7.8 MB/s eta 0:00:00
Collecting retworkx>=0.11.0
Downloading retworkx-0.11.0-cp310-cp310-macosx_11_0_arm64.whl (1.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 7.4 MB/s eta 0:00:00
Collecting psutil>=5
Downloading psutil-5.9.2.tar.gz (479 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.8/479.8 kB 9.1 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting ply>=3.10
Downloading ply-3.11-py2.py3-none-any.whl (49 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.6/49.6 kB 23.9 MB/s eta 0:00:00
Collecting stevedore>=3.0.0
Downloading stevedore-4.0.0-py3-none-any.whl (49 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.5/49.5 kB 34.2 MB/s eta 0:00:00
Collecting dill>=0.3
Downloading dill-0.3.5.1-py2.py3-none-any.whl (95 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.8/95.8 kB 11.6 MB/s eta 0:00:00
Collecting sympy>=1.3
Downloading sympy-1.11.1-py3-none-any.whl (6.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.5/6.5 MB 7.3 MB/s eta 0:00:00
Collecting tweedledum<2.0,>=1.1
Downloading tweedledum-1.1.1.tar.gz (4.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 8.1 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting six>=1.5
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2022.9.24-py3-none-any.whl (161 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 161.1/161.1 kB 8.1 MB/s eta 0:00:00
Collecting charset-normalizer<3,>=2
Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
Downloading idna-3.4-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 16.0 MB/s eta 0:00:00
Collecting ntlm-auth>=1.0.2
Downloading ntlm_auth-1.5.0-py2.py3-none-any.whl (29 kB)
Collecting cryptography>=1.3
Downloading cryptography-38.0.1-cp36-abi3-macosx_10_10_universal2.whl (5.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.3/5.3 MB 7.9 MB/s eta 0:00:00
Collecting pbr!=2.1.0,>=2.0.0
Downloading pbr-5.10.0-py2.py3-none-any.whl (112 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 112.4/112.4 kB 8.4 MB/s eta 0:00:00
Collecting mpmath>=0.19
Downloading mpmath-1.2.1-py3-none-any.whl (532 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 532.6/532.6 kB 11.0 MB/s eta 0:00:00
Collecting cffi>=1.12
Downloading cffi-1.15.1-cp310-cp310-macosx_11_0_arm64.whl (174 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.3/174.3 kB 10.3 MB/s eta 0:00:00
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 13.0 MB/s eta 0:00:00
Building wheels for collected packages: qiskit, psutil, tweedledum
Building wheel for qiskit (setup.py) ... done
Created wheel for qiskit: filename=qiskit-0.38.0-py3-none-any.whl size=12128 sha256=db0fdf505f1a0cee6067402c2679cf3e01ed6efa122bd3f74ecd266bda6bf642
Stored in directory: /private/var/folders/_1/4k7sz2vd2l909b7tzkgr78_40000gp/T/pip-ephem-wheel-cache-zso7ijky/wheels/9c/b0/59/d6281e20610c76a5f88c9b931c6b338410f70b4ba6561453bc
Building wheel for psutil (setup.py) ... done
Created wheel for psutil: filename=psutil-5.9.2-cp310-cp310-macosx_12_0_arm64.whl size=239036 sha256=47f594c85dff23c0dc2860a24818c51ef9cef3c103b92e5552928674e3ee8591
Stored in directory: /private/var/folders/_1/4k7sz2vd2l909b7tzkgr78_40000gp/T/pip-ephem-wheel-cache-zso7ijky/wheels/07/2e/76/ef443614edb2bc1fd8d89ef3ec9d292b274a5745403f8c66f9
Building wheel for tweedledum (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for tweedledum (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AssertionError:
/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:129: _InvalidFile: The given `pyproject.toml` file is invalid and would be ignored.
!!
############################
# Invalid `pyproject.toml` #
############################
Any configurations in `pyproject.toml` will be ignored.
Please note that future releases of setuptools will halt the build process
if an invalid file is given.
To prevent setuptools from considering `pyproject.toml` please
DO NOT include the `[project]` or `[tool.setuptools]` tables in your file.
!!
if _skip_bad_config(project_table, orig_setuptools_table, dist):
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AssertionError:
Traceback (most recent call last):
File "/private/var/folders/_1/4k7sz2vd2l909b7tzkgr78_40000gp/T/pip-build-env-6qyr1hkq/overlay/bin/cmake", line 5, in <module>
from cmake import cmake
ModuleNotFoundError: No module named 'cmake'
File "/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/skbuild/cmaker.py", line 141, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/skbuild/cmaker.py", line 95, in get_cmake_version
raise SKBuildError(
Traceback (most recent call last):
Problem with the CMake installation, aborting build. CMake executable is cmake
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tweedledum
Successfully built qiskit psutil
Failed to build tweedledum
% python3
Python 3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import qiskit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'qiskit'
>>>
I also tried installation using
% python3 -m pip install qiskit tweedledum==1.1.0 --no-cache --upgrade --force-reinstall
but that didn't work either.
I found this thread, but I don't know if the changes are in the current release, hence the options --upgrade
and --force-reinstall
.
@croquemadame I was not able to install it with my current python env:
Python 3.8.10 (default, Sep 30 2022, 09:53:07)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Of course, the problem is that tweedledum (c++) fails to compile, and even with the pre-compiled binary it does not install properly. The only option would be to install a fresh Python env with x86 instead of ARM and I am not going to do so.
We've modified the install requirements for the upcoming Terra 0.22, which is what triggered the issue to be closed, but that's not actually released yet - it's due on the 11th of October.
I'm not sure what might be happening if the pre-built binary for tweedledum 1.1.0 doesn't work on M1 Mac - I hadn't heard of any problems with that before now (as best as I remember).
@jakelishman
Main issue with tweedledum: have 'x86_64', need 'arm64e'
Python 3.9.7 (default, Oct 6 2022, 11:51:04)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import qiskit
......
ImportError: dlopen(/Users/.pyenv/versions/3.9.7/lib/python3.9/site-packages/tweedledum/_tweedledum.cpython-39-darwin.so, 0x0002): tried: '/Users/.pyenv/versions/3.9.7/lib/python3.9/site-packages/tweedledum/_tweedledum.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
>>>
Yeah, the "ARM" wheels uploaded by tweedledum actually appear to have x86_64 headers and be named incorrectly. I have no idea how that's happened, but I don't have control of tweedledum
to attempt to fix it. We're moving to remove tweedledum
as a core requirement in Terra - we are starting the process in 0.22, but it isn't planned to become fully optional until 0.23.
In the near term, you might be best attempting to build tweedledum
from source using the instructions on their GitHub, or by using an x86 version of Python through Rosetta. Sorry I can't offer more than that.
From Terra 0.22 the problem will be masked, at the very least, because tweedledum
won't be imported by import qiskit
(it currently is) - you'd need to try and import the tweedledum
-specific parts of Terra before it appeared. Terra 0.22 is due on the 11th of October.
This works: https://github.com/boschmitt/tweedledum/issues/179#issuecomment-1360285778
installing collected packages: qiskit
Successfully installed qiskit-0.39.4
sol@mprox dev % python
Python 3.9.12 (main, Dec 2 2022, 15:48:07)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import qiskit
>>>
What is the expected behaviour?
Should install qiskit but instead currently fails while trying to build tweedledum.
I'm hoping there could maybe be a m1 wheel available that circumvents this issue.