Configure Python interpreter used by SeaDAS
Configure Python interpreter used by SeaDAS
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!
```
-----------------------------------------------------------
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:
-
- Subject Matter Expert
- Posts: 480
- Joined: Tue Feb 09, 2021 5:42 pm America/New_York
- Been thanked: 1 time
Re: Configure Python interpreter used by SeaDAS
If you can use /usr/local/bin/python3 for SeaDAS, it might be easier just to do .
Otherwise add
to your bash or zsh file, start a new terminal, and start SeaDAS in that terminal.
Code: Select all
/usr/local/bin/pip3 install requests
Otherwise add
Code: Select all
export PATH="/usr/local/bin:$PATH"
Re: Configure Python interpreter used by SeaDAS
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.
Re: Configure Python interpreter used by SeaDAS
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`.
```
(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.
Re: Configure Python interpreter used by SeaDAS
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.@gnwii I use Python's own venv, not conda, in case that's what you were wondering.
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.