From 1ac21de182de1ce957d89481ad0a57045e5604ac Mon Sep 17 00:00:00 2001 From: Padraic Shafer <76011594+padraic-shafer@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:02:12 -0700 Subject: [PATCH 1/3] Find valid CuPy on PyPI * Newer versions of CuPy are published as `cupy-cuda11x`, `cupy-cuda12x`, etc for versions `11.x`, `12.x`, etc. * Older versions of CuPy are published as `cupy-cuda80`, `cupy-cuda102`, etc for versions `8.0`, `10.2`, etc. --- setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f4b1109..d296851 100644 --- a/setup.py +++ b/setup.py @@ -47,8 +47,14 @@ # skip depending CuPy on OS X as the wheel is not provided if not bcs.PLATFORM_DARWIN: cuda_ver = str(bcs._cuda_version) - major = str(int(cuda_ver[:-2])//10) - minor = str(int(cuda_ver[-2:])//10) + major = int(cuda_ver[:-2])//10 + minor = int(cuda_ver[-2:])//10 + if major > 10: + # Newer versions of CuPy are published as cupy-cuda11x, cupy-cuda12x, etc + minor = "x" + # Older versions of CuPy are published as cupy-cuda80, cupy-cuda102, etc + major = str(major) + minor = str(minor) try: import cupy except ImportError: From 954d242584732521d2932e07522440c29fa7c087 Mon Sep 17 00:00:00 2001 From: Padraic Shafer <76011594+padraic-shafer@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:04:07 -0700 Subject: [PATCH 2/3] run-ptycho uses active conda env `run-ptycho` should use the entrypoint for the active conda environment, and not assume where it was installed. --- run-ptycho | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-ptycho b/run-ptycho index bb41770..ddac8e1 100755 --- a/run-ptycho +++ b/run-ptycho @@ -20,4 +20,4 @@ if [ ! -d $PTYCHO_HOME ]; then fi # use the script installed by pip -/opt/conda_envs/ptycho_production/bin/run-ptycho +$CONDA_PREFIX/bin/run-ptycho From 54d38cee3cb2875dfd91b438b82003ca4dce4a84 Mon Sep 17 00:00:00 2001 From: Padraic Shafer <76011594+padraic-shafer@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:11:03 -0700 Subject: [PATCH 3/3] Update installation instructions * Do not upgrade to numpy v2 or databroker v2 unknowingly. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 219529a..bdc7a8c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The conda environment `ptycho_production` is activated under the hood using the To update the software, simple do `sudo conda update -n ptycho_production nsls2ptycho` #### Manual Installation -1. Create a new conda environment named `ptycho_production`: `sudo conda create -n ptycho_production -c conda-forge python=3.9 pyfftw pyqt=5 numpy scipy matplotlib pillow h5py databroker openmpi mpi4py cython`. If you need beamline-specific packages, such as `hxntools` for HXN, append the package names in the `conda create` command. This helps resolve possible conflict/downgrade issues. +1. Create a new conda environment named `ptycho_production`: `sudo conda create -n ptycho_production -c conda-forge python=3.9 pyfftw pyqt=5 'numpy<2' scipy matplotlib pillow h5py 'databroker<=1.999' openmpi mpi4py cython`. If you need beamline-specific packages, such as `hxntools` for HXN, append the package names in the `conda create` command. This helps resolve possible conflict/downgrade issues. The conda environment `ptycho_production` is activated under the hood using the `run-ptycho` script to be installed in Step 9. 2. Activate the environment: `conda activate ptycho_production`. 3. Install additional packages using pip: `pip install posix_ipc`.