gedaskir / qmeq

QmeQ: an open-source Python package for calculations of transport through quantum dot devices.
Other
27 stars 14 forks source link

Installation/build issues #6

Open j-beda opened 6 months ago

j-beda commented 6 months ago

I'm trying to assist a researcher setting up a macOS system with QmeQ in an Anaconda installation. In May of 2023 everything went pretty much as expected, but now we get an error when installing QmeQ either via pip or the setup.py script.

We installed Anaconda from the latest installer (which puts it into /opt/anaconda3 whereas I think it used to get installed into ~/anaconda3 so maybe I'll try that), then invoked

conda install --channel conda-forge cython numpy scipy matplotlib jupyter pytest sphinx sphinx-rtd-theme

At this point in 2023 we just installed QmeQ using

pip install qmeq

and then ran the tests and built the documentation with "pytest tests" and "make html".

Unfortunately doing the "pip install qmeq" action results in the error messages attached at the end of this post.

Updating "setuptools" to the latest version (69.5.1) did not change the error message. Updating all packages to the latest versions did not change the error message.

I think one of the researcher's past students might have an Anaconda installation in their directory that has a working QmeQ installation, so maybe I can figure out all this "virtual environment" stuff and clone that environment for new installations, but it would be nice if I could get QmeQ installed with the latest versions of Python and other packages.

https://www.geeksforgeeks.org/set-up-virtual-environment-for-python-using-anaconda/

Does anyone have any idea how to address the following error(s) on installation?

Collecting qmeq Using cached qmeq-1.1.tar.gz (2.2 MB) 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 ╰─> [33 lines of output] Traceback (most recent call last): File "/opt/anaconda3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/opt/anaconda3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 87, in File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/init.py", line 104, in setup return distutils.core.setup(attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 158, in setup dist.parse_config_files() File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 631, in parse_config_files pyprojecttoml.apply_configuration(self, filename, ignore_option_errors) File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 68, in apply_configuration config = read_configuration(filepath, True, ignore_option_errors, dist) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 129, in read_configuration validate(subset, filepath) File "/private/var/folders/4s/d7lfjsgj5995x1tw0kf99n4r0000gt/T/pip-build-env-vuz9grbb/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 57, in validate raise ValueError(f"{error}\n{summary}") from None ValueError: invalid pyproject.toml config: project. configuration error: project must contain ['name'] properties [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.

gedaskir commented 6 months ago

Hi @j-beda, these error messages show that the build configuration for QmeQ is a bit outdated (done in 2021):

What is your environment you try to install QmeQ , i.e., versions of:

I gave a shot to update the build to a more recent standard and produced test wheels for currently officially supported Python versions 3.8 to 3.12: https://devguide.python.org/versions/

Try to take a look at the artifacts in https://github.com/gedaskir/qmeq/actions/runs/8961131215 and try to find a relevant version for you. Note that cibw-wheels-macos-12-2 has builds for x86_64 architecture and cibw-wheels-macos-14-3 for arm64 architecture. Let me know if this helps and if I can go and update the build configuration on main branch..

j-beda commented 6 months ago

Thank you for the response.

Right now we are trying to get it onto an Intel (x86_64) machine running maOS 12 Monterey, but we also intend to install onto both Intel (x86_64) and Apple Silicone (arm64) machines running macOS 14 Sonoma.

I just sshed into the machine in question and logged in as the user in question and "conda list" for the "base" environment gives me:

python 3.11.7 hf27a42d_0
setuptools 69.5.1 pypi_0 pypi wheel 0.43.0 pypi_0 pypi

And for the environment we tried to clone from the user who had it working last year:

python 3.10.9 h218abb5_1
setuptools 65.6.3 py310hecd8cb5_0
wheel 0.38.4 py310hecd8cb5_0

"Try to take a look at the artifacts..." - I'll try to get to that tomorrow or maybe later in the week.

j-beda commented 6 months ago

Just to complicate things, "Python 3.12.3" is installed as part of the MacPorts Python installation inside /opt/local/bin/ rather than the /opt/anaconda3/ installation. The user has /opt/anaconda3/ earlier in their path than /opt/local/bin, so presumably the MacPorts stuff is unimportant, by my understanding of "how things work".

j-beda commented 5 months ago

OK, I just got back from out of town and looked up what a .whl file was and how to install it using pip via https://realpython.com/python-wheels/ and https://www.geeksforgeeks.org/python-add-packages-to-anaconda-environment/ (I include the links for information when I can't remember what I did in the future!).

I downloaded and unzipped the cibw-wheels-macos-12-2.zip file on the macOS 12.7.4 machine, then on in the user's account from the "base" environment, invoked "pip install qmeq-1.1-cp311-cp311-macosx_10_9_x86_64.whl" since "python -V" reveals the user is running "Python 3.11.7" and the magic happened: Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.11/site-packages (from qmeq==1.1) (1.26.4) Collecting scipy<=1.11.4 (from qmeq==1.1) Downloading scipy-1.11.4-cp311-cp311-macosx_10_9_x86_64.whl.metadata (60 kB) Downloading scipy-1.11.4-cp311-cp311-macosx_10_9_x86_64.whl (37.2 MB) Installing collected packages: scipy, qmeq Attempting uninstall: scipy Found existing installation: scipy 1.13.0 Uninstalling scipy-1.13.0: Successfully uninstalled scipy-1.13.0 Successfully installed qmeq-1.1 scipy-1.11.4

I changed to the other environment which has Python 3.10.9 and invoked "pip install qmeq-1.1-cp310-cp310-macosx_10_9_x86_64.whl" and got: Requirement already satisfied: scipy<=1.11.4 in /opt/anaconda3/envs/qmeq-env/lib/python3.10/site-packages (from qmeq==1.1) (1.10.1) Requirement already satisfied: numpy in /opt/anaconda3/envs/qmeq-env/lib/python3.10/site-packages (from qmeq==1.1) (1.23.5) Installing collected packages: qmeq Successfully installed qmeq-1.1

I'll let you know if the user reports any issues with actually using the package!

Thank you very much!

j-beda commented 5 months ago

On the macOS 14.4.1 Apple Silicon M2 laptop with Python 3.11.8, invoking "pip install qmeq-1.1-cp311-cp311-macosx_11_0_arm64.whl" successfully gives:

Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.11/site-packages (from qmeq==1.1) (1.26.4) Collecting scipy<=1.11.4 (from qmeq==1.1) Downloading scipy-1.11.4-cp311-cp311-macosx_12_0_arm64.whl.metadata (165 kB) Downloading scipy-1.11.4-cp311-cp311-macosx_12_0_arm64.whl (29.7 MB) Installing collected packages: scipy, qmeq Attempting uninstall: scipy Found existing installation: scipy 1.13.0 Uninstalling scipy-1.13.0: Successfully uninstalled scipy-1.13.0 Successfully installed qmeq-1.1 scipy-1.11.4

gedaskir commented 5 months ago

Hi @j-beda. Thanks for info. So far it looks like good news :-). When I will find the time I will go ahead and update the code and make an official release with newer builds.

j-beda commented 5 months ago

More complications: I've got another macOS 14.4.1 user but they are on Intel and all the whl files for 14 all seem to be for ARM. Should I try one of them or one of the Intel macOS 12 files?

gedaskir commented 5 months ago

Yes, just try to use wheel files built on macOS 12, because it is for x86_64 architecture. It should not matter, which actual macOS Intel version it is.