mathworks / climatedatastore

Climate Data Store Toolbox for MATLAB
Other
37 stars 10 forks source link

Incorrectly erroring with "Could not use PIP3 to install CDSAPI" #10

Closed rpurser47 closed 1 year ago

rpurser47 commented 2 years ago

zhiling liao reported on File Exchange

Hi Rob, Thanks for this great toolbox! I am using MATLAB R2021b and at first i just could not run the example normally, it kept reporting "Could not use PIP3 to install CDSAPI", which i have actually installed. Then i changed "if result ~= 0" in line 19 of the file "setupCDSAPIIfNeeded.m" to "if result ~= 1", it finally worked. I hope this helps. Cheers

Appears need to look at potential return codes from PIP3 -- may need to accept more values as success.

rpurser47 commented 1 year ago

I think this is resolved. If other people see this issue, please reopen this issue.

Rafnuss commented 2 weeks ago

Hi, Looks like I have the same problem:

>> pyenv

ans = 

  PythonEnvironment with properties:

          Version: "3.9"
       Executable: "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
          Library: "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib"
             Home: "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9"
           Status: NotLoaded
    ExecutionMode: InProcess

So that

>> system(fullfile(pythonInfo.Home,"Scripts","pip3")+" install cdsapi")
zsh:1: no such file or directory: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Scripts/pip3

ans =

   127

In my console, it works well:

(base) rafnuss@Raphaels-MacBook-Pro ~ % pip3 show cdsapi
Name: cdsapi
Version: 0.7.3
Summary: Climate Data Store API
Home-page: https://github.com/ecmwf/cdsapi
Author: ECMWF
Author-email: software.support@ecmwf.int
License: Apache 2.0
Location: /Users/rafnuss/anaconda3/lib/python3.11/site-packages
Requires: cads-api-client, requests, tqdm
Required-by: 
Rafnuss commented 2 weeks ago

See potential fix : https://github.com/mathworks/climatedatastore/pull/22/commits/97078cf591afd1eec14e59924eb3f1da2713fbfc

only tested on macos