SeaDAS can no longer find "requests" package

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
daurin
Posts: 50
Joined: Thu Apr 22, 2010 8:06 am America/New_York
Answers: 0
Has thanked: 1 time
Been thanked: 1 time

SeaDAS can no longer find "requests" package

by daurin » Tue Feb 11, 2025 5:25 pm America/New_York

SeaDAS 9.1.0 runs normally on my mac M3 Sonoma 14.7.2.

I recently shifted away from Anaconda to Miniforge to manage my local python packages. Now I want to update ocssw to the latest version:

Code: Select all

install_ocssw --install_dir=$HOME/Applications/ocssw/ --tag V2025.1 --seadas --oci
To which I get the error:

Code: Select all

Installing lut - oci
Traceback (most recent call last):
  File "/Users/daurin/Applications/ocssw//bin/update_luts", line 9, in <module>
    import seadasutils.LutUtils as Lut
  File "/Users/daurin/Applications/ocssw/bin/seadasutils/LutUtils.py", line 3, in <module>
    import seadasutils.JsonUtils as Session
  File "/Users/daurin/Applications/ocssw/bin/seadasutils/JsonUtils.py", line 6, in <module>
    from seadasutils.ProcUtils import getSession, httpdl
  File "/Users/daurin/Applications/ocssw/bin/seadasutils/ProcUtils.py", line 15, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
I have moved miniforge3/bin to the head of my PATH in .bashrc, a measure that has worked around this problem in the past:

Code: Select all

(base) daurin@gs616-daurinm1:~$ echo $PATH
/Users/daurin/miniforge3/bin:/Users/daurin/Applications/ocssw/ocssw_src/scripts:...etc.

And am running in the base environment. The requests package is installed:

Code: Select all

conda list requests

Code: Select all

# packages in environment at /Users/daurin/miniforge3:
#
# Name                    Version                   Build  Channel
requests                  2.32.3             pyhd8ed1ab_1    conda-forge

Filters:

OB SeaDAS - knowles
Subject Matter Expert
Subject Matter Expert
Posts: 306
Joined: Mon Apr 07, 2008 4:40 pm America/New_York
Answers: 0
Been thanked: 3 times

Re: SeaDAS can no longer find "requests" package

by OB SeaDAS - knowles » Wed Feb 12, 2025 3:56 pm America/New_York

Let us know if this tutorial video helps (it addressed both GUI and command line installations of python):

https://www.youtube.com/watch?v=bvyxNYY_C4A

daurin
Posts: 50
Joined: Thu Apr 22, 2010 8:06 am America/New_York
Answers: 0
Has thanked: 1 time
Been thanked: 1 time

Re: SeaDAS can no longer find "requests" package

by daurin » Wed Feb 12, 2025 4:18 pm America/New_York

Thanks. The issue is resolved, though it was trickier than last time.

1) Running seadas from the terminal in which a conda environment with requests does not work, despite earlier posts to the contrary (see below).
2) When I had this issue while using anaconda, I was able to install requests in the native python space by simply deactivating all conda environments and pip installing requests. However, this time, now that I have migrated to miniforge, deactivating the environment did not revert the shell to the native python (or pip). It was still using python in miniforge3/bin. I reworked my .bashrc, commenting out the miniforge setups, but then the shell was pointing to my homebrew version of python instead of the native python, so installing requests still didn't help. In fact the native python was not in my path.
3) I resolved the issue by manually adding ~/Library/Python to my path and then pip installing requests. A hack, but it worked.

Why doesn't seadas use conda environments when they are active? They are designed to get around just this sort of problem with native python installations and dependencies.

OB SeaDAS - knowles
Subject Matter Expert
Subject Matter Expert
Posts: 306
Joined: Mon Apr 07, 2008 4:40 pm America/New_York
Answers: 0
Been thanked: 3 times

Re: SeaDAS can no longer find "requests" package

by OB SeaDAS - knowles » Wed Feb 12, 2025 5:01 pm America/New_York

You need to add the python executable to your PATH environment variable. When you check out an anaconda python working environment, you then get it's path by typing "which python3". Then add that to the front of your PATH environment variable.

It also depends on whether you are running from the GUI or command line. If from the command line, make sure your shell is actually sourcing~/.bash_profile.

Depending on how the configuration file is setup, there may be a way to have it auto-figure out which working environment you are using.

You should be able to configure the shell to point SeaDAS to whichever python ___location you wish to use and not have to install a additional python where SeaDAS is looking.

OB SeaDAS - knowles
Subject Matter Expert
Subject Matter Expert
Posts: 306
Joined: Mon Apr 07, 2008 4:40 pm America/New_York
Answers: 0
Been thanked: 3 times

Re: SeaDAS can no longer find "requests" package

by OB SeaDAS - knowles » Wed Feb 12, 2025 5:07 pm America/New_York

See 6:15 of the tutorial video https://youtu.be/bvyxNYY_C4A?si=Lag_Aoru7lZ-U1QR&t=365 on how to set your conda working environment in ~/.bash_profile. (or ~/.bashrc or ~/.zshrc ... depending on your shell).

OB.DAAC - itcarroll
Subject Matter Expert
Subject Matter Expert
Posts: 10
Joined: Thu Nov 18, 2021 10:29 am America/New_York
Answers: 1
Been thanked: 1 time

Re: SeaDAS can no longer find "requests" package

by OB.DAAC - itcarroll » Fri Feb 14, 2025 11:26 am America/New_York

Can I make a feature request on this topic? It would be much better for users if they did not have to touch the PATH environment variable. It's just not part of any normal application installation process. So what are the options for SeaDAS?

1. Provide a setting option to configure the path to the python interpreter.
2. Create and prepare a python virtual environment during SeaDAS installation.

Please let us know whether you would implement one of those two options (or a third, so long as it does not involve setting environment variables). Thanks!

Post Reply