You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To avoid adding the variables in the environment of every single command while
314
+
maintaining a clean shell environment, an alias can be defined as follows.
315
+
316
+
```shell
317
+
alias eb_devel='PYTHONPATH="${EB_DEVEL_ROOT}/easybuild-framework:${EB_DEVEL_ROOT}/easybuild-easyblocks:${PYTHONPATH}" EASYBUILD_ROBOT_PATHS="${EB_DEVEL_ROOT}/easybuild-easyconfigs/easybuild/easyconfigs" ${EB_DEVEL_ROOT}/easybuild-framework/eb'
318
+
```
319
+
320
+
With the alias defined, the command to install `ReFrame-4.3.3.eb` and its
321
+
dependencies now becomes the following:
322
+
323
+
```shell
324
+
eb_devel --robot ReFrame-4.3.3.eb
325
+
```
326
+
327
+
??? note "Controlling the robot search path in development instances"
328
+
329
+
There is no default value for the [robot search
330
+
path](/using-easybuild/#controlling_robot_search_path) in the development
331
+
instance. The robot search path is set explicitly using the
332
+
`EASYBUILD_ROBOT_PATHS` environment variable. As a result, expect that some
333
+
features of the `EASYBUILD_ROBOT_PATHS` and its accompanying command line
334
+
option, `--robot-paths` will not work with `eb_devel`, the alias for the
335
+
EasyBuild development version.
336
+
337
+
For instance,
338
+
339
+
- you cannot use `EASYBUILD_ROBOT_PATHS` to set the robot path as it is
340
+
overridden in the alias `eb_devel`, and
341
+
- you cannot append to the default robot search path, with `--robot-paths`,
342
+
as it overrides the `EASYBUILD_ROBOT_PATHS` environment option.
343
+
344
+
As a workaround,
345
+
346
+
- use `--robot-paths` to override the robot search path set via the alias, and
347
+
- use the environment variable `EASYBUILD_ROBOT_PATHS` to access the
348
+
the robot search path set by the alias so that you can append to it.
349
+
350
+
For instance to append to the development robot search path, use the
In order to locate Python packages in modules, before v5.0.0, EasyBuild conventionally used the `PYTHONPATH` environment variable. However, this has several issues:
4
+
5
+
1.`PYTHONPATH` has highest priority; it prevents users from making a custom virtual environment on top of modules and shadowing packages.
6
+
2. Packages are picked up even for incompatible python versions, e.g. an OS installed old python 3.6 will break if packages from 3.12 exists in `PYTHONPATH`.
7
+
3. Modules can't have optional dependencies on different Python versions, as PYTHONPATH points directly to the `site-packages` subdirectory.
8
+
4. Packages with `pth` files can't work with PYTHONPATH and requires being added to the site dir.
9
+
10
+
Unfortunately, Python offers no environment variables to do the correct thing here.
11
+
To solve this (initially for Python `multi_deps`) EasyBuild has for a long time supported the use of the custom `EBPYTHONPREFIXES` via a `sitecustomize.py` script for the Python modules we build.
12
+
It is included in standard Python installations made with EasyBuild. You can opt out of using `sitecustomize.py` if you have strong technical reasons to avoid it.
13
+
14
+
The `sitecustomize.py` script does the correct thing by only considering the correct Python version, and puts Python packages provided by the environment module at the lowest priority, allowing a user venv to override them.
15
+
16
+
## Using `--prefer-python-search-path`
17
+
18
+
Since v5.0.0 the new global configuration option `--prefer-python-search-path` can be used for EasyBuild to prefer the use of either `PYTHONPATH` or `EBPYTHONPREFIXES`.
19
+
For backwards compatibility with existing modules, EasyBuild was unfortunately required to keep `PYTHONPATH` as the default.
20
+
Note that the option is just the preferred option, if the package path doesn't follow the standard `lib/pythonY.X/site-packages` format then `PYTHONPATH` must be used. If multi-deps is used, then `EBPYTHONPREFIXES` is required.
21
+
22
+
If you wish to switch to `EBPYTHONPREFIXES`, you should also traverse the existing Python bundles you have installed and make sure to rebuild the modules.
23
+
Failure to do so might leave you with a few easyconfigs that require shadowing of older package versions not working correctly due to the import priority changing.
24
+
25
+
If you are building a new software stack from scratch, you can safely switch this option to `EBPYTHONPREFIXES` and enjoy the benefits.
26
+
27
+
## Fixing existing modules
28
+
29
+
You can convert existing modules by rebuilding them with `eb --module-only --rebuild ...`.
30
+
You can find the modules that use `PYTHONPATH` by e.g. grepping through your modules:
0 commit comments