equinor / komodoenv

Komodoenv is the virtualenv of the Komodo world
GNU General Public License v3.0
1 stars 3 forks source link

Detect the komodo root from PATH #50

Open kwinkunks opened 1 year ago

kwinkunks commented 1 year ago

If Komodo releases are not located in /prog/res/komodo then trying to automatically use an env for a new komodoenv results in an error like:

/prog/res/komodo/2023.02.b3-py38-rhel7' is not a valid komodo release

In my case, the root is /prog/komodo/2023.02.b3-py38-rhel7.

Perhaps it's best to keep things super explicit, but it might be nice to try detecting the komodo root from the combination of KOMODO_RELEASE and PATH.

For reference, here's how we do this in komodo. (It would be even nicer if Komodo set an environment variable with the path to the root -- see linked issue.)

pinkwah commented 1 year ago

I agree.

kwinkunks commented 11 months ago

Making this a bug because the error you get on Azure (root is /prog/komodo) is so obscure

(2023.06.03-py38) [mtha@s034-rgs0002 ert-internal-examples]$ komodoenv --no-update ~/kenv-ert
Traceback (most recent call last):
  File "/prog/komodo/2023.06.03-py38-rhel7/root/bin/komodoenv", line 8, in <module>
    sys.exit(main())
  File "/prog/komodo/2023.06.03-py38-rhel7/root/lib/python3.8/site-packages/komodoenv/__main__.py", line 195, in main
    args = parse_args(args)
  File "/prog/komodo/2023.06.03-py38-rhel7/root/lib/python3.8/site-packages/komodoenv/__main__.py", line 153, in parse_args
    assert args.root.is_dir()
AssertionError

PAssing --root /prog/komodo is the workaround.

larsevj commented 1 month ago

As of #68 komodoenv first checks for the existence of /prog/komodo before defaulting to /prog/res/komodo, so should now be easier to use on Azure. Although this is not as robust as the suggestions in this issue.