Add env files to run sim#145
Conversation
|
I ended up installing micromamba on my Mac (M2 Pro). FYI I got this: ...
Transaction finished
To activate this environment, use:
micromamba activate mfx-opt-env
Or to execute a single command in this environment, use:
micromamba run -n mfx-opt-env mycommand
warning libmamba You are using 'pip' as an additional package manager.
Be aware that packages installed with 'pip' are managed independently from 'conda-forge' channel.
Installing pip packages: lcls-tools @ git+https://github.com/slaclab/lcls-tools.git, pcdsdevices @ git+https://github.com/pcdshub/pcdsdevices.git
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sirepo-bluesky 0.4.0 requires inflection, which is not installed.
sirepo-bluesky 0.4.0 requires pyqt5<5.12,>=5.9, which is not installed.
sirepo-bluesky 0.4.0 requires scikit-image, which is not installed.
bloptools 0.1.0 requires ortools, which is not installed.Working on a fix but adding Updating pip packages: inflection, ortools, pyqt5<5.12,>=5.9, lcls-tools @ git+https://github.com/slaclab/lcls-tools.git, pcdsdevices @ git+https://github.com/pcdshub/pcdsdevices.git
/Users/fpoitevi/micromamba/envs/mfx-opt-env/etc/conda/deactivate.d/happi.sh: line 13: complete: happi: no completion specification
ERROR: Could not find a version that satisfies the requirement pyqt5<5.12,>=5.9 (from versions: 5.14.0, 5.14.1, 5.14.2, 5.15.0, 5.15.1, 5.15.2, 5.15.3, 5.15.4, 5.15.5, 5.15.6, 5.15.7, 5.15.8, 5.15.9, 5.15.10, 5.15.11)
ERROR: No matching distribution found for pyqt5<5.12,>=5.9
critical libmamba pip failed to update packages |
|
@fredericpoitevin I just tried it on my new Mac with M3, and I had no issues. I used Conda version 25.1.1. I am not familiar with Micromamba so I won't try to debug that for you, but I suggested you try using Conda version 23.10 and up which ships with the libmamba solver as the default (or, more ideally, the latest one) and let me know how that goes. |
fredericpoitevin
left a comment
There was a problem hiding this comment.
Thanks @pluflou ! It's great to be able to do this on my laptop!

The reason I went to micromamba initially was that updating my miniconda from 23.7 to above 23.10 was taking too long so I looked for another option and picked that one. In the end, I just reinstalled miniconda3 from scratch and it worked, thanks for the advice.
I did not try pixi yet. Maybe another day.
A few observations that are not related to this PR directly but that I don't want to forget:
python -m mfx.optimize.xopt_scansworked for me but the plots were not displayed.ipython -i mfx/optimize/xopt_scans.pydid not work for me:
(mfx-opt-env) [fpoitevi@PC101094 mfx]$ ipython -i mfx/optimize/xopt_scans.py
Python 3.12.9 | packaged by conda-forge | (main, Mar 4 2025, 22:44:42) [Clang 18.1.8 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.1.0 -- An enhanced Interactive Python. Type '?' for help.
Tip: You can find how to type a Unicode symbol by back-completing it, eg `\Ⅷ<tab>` will expand to `\ROMAN NUMERAL EIGHT`.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
File ~/Projects/mfx/mfx/optimize/xopt_scans.py:15
12 from lcls_tools.common.frontend.plotting.image import plot_image_projection_fit
13 from lcls_tools.common.image.fit import ImageProjectionFit
---> 15 from .mirror_hw import (
16 XCS_YAG_XPOS,
17 DG1_WAVE8_XPOS,
18 DG1_YAG_XPOS,
19 DG2_WAVE8_XPOS,
20 DG2_YAG_XPOS,
21 IP_YAG_XPOS,
22 MIRROR_NOMINAL,
23 init_devices,
24 sim_devices,
25 YAG_CENTROID_X_MIN_MAX,
26 YAG_CENTROID_Y_MIN_MAX,
27 WAVE8_CENTROID_X_MIN_MAX,
28 WAVE8_CENTROID_Y_MIN_MAX
29 )
32 def get_vocs(
33 mirror_nominal: float = MIRROR_NOMINAL,
34 search_delta: float = 5,
(...) 43 centroid_y_max: float = None,
44 ) -> VOCS:
45 constrants = {}
ImportError: attempted relative import with no known parent package|
Great that it worked! Yes I noticed those things too. I think those are more of a local setup thing, but we can change some things in the code to make it less work for users to set up and run if that's desired. @fredericpoitevin should we create an issue for those two things? maybe even just updating the docs on how to run is enough. |
|
I think reporting this "bug" as an issue would be useful. |
thopkins32
left a comment
There was a problem hiding this comment.
Pixi worked for me after adding the platforms. Although I had to be at the root of the repository and do
pixi run --manifest-path mfx/optimize/pixi.toml python -m mfx.optimize.xopt_scans
Since this is meant to be run from the root of the repository, I think the pixi.toml file should be there instead of in mfx/optimize. You can set up Pixi environments that have specific dependencies as described here: https://pixi.sh/latest/workspace/multi_environment/
For example, the default environment you have set up currently could be the "optimize" environment in the repo-wide Pixi configuration. With the environment configured, the command (I think) would be
pixi run -e optimize python -m mfx.optimize.xopt_scans
Co-authored-by: Thomas Hopkins <thomashopkins000@gmail.com>
|
I had the same issues as Fred, otherwise looks great to me! |
|
@fredericpoitevin @thomashopkins32 I updated the |
Yes I think documenting this briefly in the main README.md would be good and then we can merge? |
|
@fredericpoitevin sure, that works for me. |
Description
This PR adds environment files for conda and pixi to allow devs to easily set up the packages needed to run the beam alignment optimization simulation. The
pixi.tomlfile is at the root of the repo and has a "optimize" environment (that's also currently the default since we have no other "base" env for the repo).To run
You can create a conda environment from this file with
conda env create -f /path/to/environment.ymlthen run the sim withpython -m mfx.optimize.xopt_scans. Or you can run directly using the pixi environment, e.g.pixi run -e optimize python -m mfx.optimize.xopt_scans.