Configure Python interpreter used by SeaDAS

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
icarroll
Posts: 1
Joined: Mon Feb 06, 2023 3:09 pm America/New_York
Answers: 0

Configure Python interpreter used by SeaDAS

by icarroll » Mon Feb 06, 2023 3:24 pm America/New_York

How do I configure SeaDAS to use a particular Python interpreter? Currently the "SeaDAS-Toolbox" > "Software & System Info..." window shows:

```
-----------------------------------------------------------
Main Application Platform:
-----------------------------------------------------------
Application Version: SeaDAS 8.3.0
SNAP Engine Version: 9.0.3* (SeaDAS Platform modified)
SNAP Desktop Version: 9.0.3* (SeaDAS Platform modified)
SNAP Engine Build Date: 202212081832
SNAP Desktop Build Date: 202212081837
...snipped...
Python3 Directory: /usr/local/bin/python3
```
I need to SeaDAS to use a different Python3 Directory. I have an existing Python virtual environment that has the requests package needed by SeaDAS, but I can't find documentation on how to point SeaDAS to a different Python3 Directory.

Thanks!

Tags:

OB SeaDAS - xuanyang02
Subject Matter Expert
Subject Matter Expert
Posts: 480
Joined: Tue Feb 09, 2021 5:42 pm America/New_York
Answers: 1
Been thanked: 1 time

Re: Configure Python interpreter used by SeaDAS

by OB SeaDAS - xuanyang02 » Tue Feb 07, 2023 12:18 pm America/New_York

If you can use /usr/local/bin/python3 for SeaDAS, it might be easier just to do

Code: Select all

/usr/local/bin/pip3 install requests
.
Otherwise add

Code: Select all

export PATH="/usr/local/bin:$PATH"
to your bash or zsh file, start a new terminal, and start SeaDAS in that terminal.

gnwiii
Posts: 700
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2

Re: Configure Python interpreter used by SeaDAS

by gnwiii » Tue Feb 07, 2023 1:01 pm America/New_York

icarroll wrote: Mon Feb 06, 2023 3:24 pm America/New_York I have an existing Python virtual environment that has the requests package needed by SeaDAS, but I can't find documentation on how to point SeaDAS to a different Python3 Directory.
You didn't mention which of the many virtual environments you use, but just run SeaDAS from the shell prompt in a terminal with the Python environment that provides the requests package, see: https://realpython.com/python-virtual-environments-a-primer/#activate-it.

icarroll
Posts: 1
Joined: Mon Feb 06, 2023 3:09 pm America/New_York
Answers: 0

Re: Configure Python interpreter used by SeaDAS

by icarroll » Tue Feb 07, 2023 2:59 pm America/New_York

The $PATH set by the Python virtual environment does not appear to affect SeaDAS. After the following, the "Python3 Directory" has not changed from what I posted above.

```
(venv-py3.10) $ which python
/path/to/venv-py3.10/bin/python
(venv-py3.10) $ which python3
/path/to/venv-py3.10/bin/python3
(venv-py3.10) $ ~/Applications/SeaDAS/bin/seadas
```

The answers indicate there is not a way to configure SeaDAS. I'll keep trying ways to make it recognize the PATH variable set by the virtual environment.

@gnwii I use Python's own venv, not conda, in case that's what you were wondering.
@OB SeaDAS - xuanyang02 I do not mess with /usr/local/bin. I only let Homebrew do that. As a fallback though, I will `/usr/local/bin/python3 -m pip install --user requests`.
Last edited by icarroll on Tue Feb 07, 2023 3:05 pm America/New_York, edited 2 times in total.

gnwiii
Posts: 700
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2

Re: Configure Python interpreter used by SeaDAS

by gnwiii » Mon Feb 13, 2023 11:24 am America/New_York

@gnwii I use Python's own venv, not conda, in case that's what you were wondering.
See: https://whiteboxml.com/blog/the-definitive-guide-to-python-virtual-environments-with-conda. I'm currently using Fedora Linux, which provides an immutable conda base environment, no connection to Anaconda Python.

Starting SeaDAS 8 from the command line in a terminal with a conda env active "works for me", but macOS has been messing with the way the PATH is set for Finder Applications:
https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications has examples for many macOS versions. It seems the easy solution is to have a python in the default path with requests, so the suggestion to install requests for your /usr/local/bin/python3 should work.

Post Reply