# Unable to load weather forecasts from Open weather when replicating the lab on GCP

**URL:** <https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687>\
**Category:** AI and Climate Change\
**Tags:** week-module-2\
**Created:** [September 6, 2023, 8:57pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687 "2023-09-06T20:57:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vkbalasub](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/vkbalasub/32/144068_2.png) [@vkbalasub](https://community.deeplearning.ai/u/vkbalasub)\
**Post date:** [September 6, 2023, 8:57pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/1 "2023-09-06T20:57:16Z")

</div>

I get a file not found error when trying to load weather forecasts from the open weather API. Is there a restriction on using it on GCP? I can use some guidance.

My file does exist in the URI shown below as part of the error.

My error below:

* * *

FileNotFoundError Traceback (most recent call last)  
 in \<cell line: 2\>()  
1 # Load the data  
----\> 2 weather\_forecasts = load\_weather\_forecast()  
3  
4 # Plot measured wind speed and forecasts for different periods into the future  
5 plot\_forecast(weather\_forecasts)

in load\_weather\_forecast()  
871 “”“Loads the wind data and forecast for three locations and returns it in a form of dictionary.  
872 “””  
 → 873 with open(“gs://acai\_testdata/Climate Change/Wind Power Forecasting/Design/forecasting/work/data/weather\_forecast.pkl”, “rb”) as f:  
874 weather\_forecasts = pickle.load(f)  
875 return weather\_forecasts

FileNotFoundError: [Errno 2] No such file or directory: ‘gs://acai\_testdata/Climate Change/Wind Power Forecasting/Design/forecasting/work/data/weather\_forecast.pkl’

---

<div class="post-metadata">

**Author:** ![Mubsi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mubsi/32/94983_2.png) [@Mubsi](https://community.deeplearning.ai/u/Mubsi)\
**Post date:** [September 7, 2023, 7:52am UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/2 "2023-09-07T07:52:45Z")

</div>

Hi @vkbalasub,

Could you mention the name of the notebook so that I’m able to understand better and, if possible, help you ?

Best,  
Mubsi

---

<div class="post-metadata">

**Author:** ![vkbalasub](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/vkbalasub/32/144068_2.png) [@vkbalasub](https://community.deeplearning.ai/u/vkbalasub)\
**Post date:** [September 7, 2023, 1:21pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/3 "2023-09-07T13:21:35Z")

</div>

The notebook is C2\_W2\_Lab3\_Wind\_Energy\_Design\_2.ipynb ( Wind Power Forecasting: Design Phase (Part 2)). The error is generated in the utils.py provided for the lab that calls the function (Load weather forecasts).

---

<div class="post-metadata">

**Author:** ![Mubsi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mubsi/32/94983_2.png) [@Mubsi](https://community.deeplearning.ai/u/Mubsi)\
**Post date:** [September 7, 2023, 4:06pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/4 "2023-09-07T16:06:00Z")

</div>

Hi @vkbalasub,

Thanks for sharing the information.

This is the function, right ?

```auto
def load_weather_forecast() -> Dict[str, Dict[List[datetime], List[float]]]:
    """Loads the wind data and forecast for three locations and returns it in a form of dictionary.
    """
    with open("data/weather_forecast.pkl", "rb") as f:
        weather_forecasts = pickle.load(f)
    return weather_forecasts

```

It is loading the data from the “data” folder. Are you sure you have downloaded this folder as well, in order for the notebook to run locally ?  
 ![Screenshot 2023-09-07 at 9.04.23 PM](https://global.discourse-cdn.com/dlai/original/3X/8/b/8ba1ed23df7eb0c6b228962c012f1925349f0809.png)

Best,  
Mubsi

---

<div class="post-metadata">

**Author:** ![Mubsi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mubsi/32/94983_2.png) [@Mubsi](https://community.deeplearning.ai/u/Mubsi)\
**Post date:** [September 8, 2023, 6:33pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/5 "2023-09-08T18:33:32Z")

</div>

Hi @vkbalasub,

Please look at my reply above.

---

<div class="post-metadata">

**Author:** ![Mubsi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mubsi/32/94983_2.png) [@Mubsi](https://community.deeplearning.ai/u/Mubsi)\
**Post date:** [September 8, 2023, 6:34pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/6 "2023-09-08T18:34:48Z")

</div>

In order to get faster replies from me, I’d recommend to tag me every time your replies are directed towards me.

---

<div class="post-metadata">

**Author:** ![a-zarta](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/a-zarta/32/162492_2.png) [@a-zarta](https://community.deeplearning.ai/u/a-zarta)\
**Post date:** [September 8, 2023, 7:01pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/7 "2023-09-08T19:01:23Z")

</div>

Hi @vkbalasub, there is no restriction on running this lab or loading any of its parts in GCP. Looks like the utils is not able to locate the pkl file that contains the data, make sure that all the files are in the correct paths. I would recommend not using spaces in your directories (such as Climate Change, Wind Power) as this can sometimes cause issues. Also maybe its better to use the relative path to the weather\_forecast.pkl instead of the full URI (I don’t know how these work in GCP)

---

<div class="post-metadata">

**Author:** ![vkbalasub](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/vkbalasub/32/144068_2.png) [@vkbalasub](https://community.deeplearning.ai/u/vkbalasub)\
**Post date:** [September 11, 2023, 4:25pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/8 "2023-09-11T16:25:31Z")

</div>

It is pointed to the right directory and file is present there - (“gs://acai\_testdata/Climate Change/Wind Power Forecasting/Design/forecasting/work/data/weather\_forecast.pkl”, “rb”).

The other files are accessible with the URI as provided except the pickle file. I have tried removing the spaces as suggested in the directory names but didn’t help either. It seems to be very specific to reading the pickle file.

code is as below:

def load\_weather\_forecast() → Dict[str, Dict[List[datetime], List[float]]]:  
“”“Loads the wind data and forecast for three locations and returns it in a form of dictionary.  
“””  
with open(“gs://acai\_testdata/Climate Change/Wind Power Forecasting/Design/forecasting/work/data/weather\_forecast.pkl”, “rb”) as f:  
weather\_forecasts = pickle.load(f)  
return weather\_forecasts

---

<div class="post-metadata">

**Author:** ![Mubsi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mubsi/32/94983_2.png) [@Mubsi](https://community.deeplearning.ai/u/Mubsi)\
**Post date:** [September 12, 2023, 2:09pm UTC](https://community.deeplearning.ai/t/unable-to-load-weather-forecasts-from-open-weather-when-replicating-the-lab-on-gcp/438687/9 "2023-09-12T14:09:10Z")

</div>

> [@vkbalasub](#):
>
> FileNotFoundError: [Errno 2] No such file or directory: ‘gs://acai\_testdata/Climate Change/Wind Power Forecasting/Design/forecasting/work/data/weather\_forecast.pkl’

Hi @vkbalasub,

With everything you said above and your original error, maybe check using `!ls` command what you see when you put the same file path, do you see the pkl file or not
