简体   繁体   中英

Accessing netcdf4 files on Azure

I've got a python script running on Microsoft Azure Batch service in the Data Factory. I'm now testing to see whether I can load and access netcdf4 files. However, as soon as I add "import netCDF4 as nc" to the top of my.py file, the debug in my Data Factory Pipeline fails and in the stderr file I get:

Traceback (most recent call last): File "main.py", line 5, in import netCDF4 as nc ModuleNotFoundError: No module named 'netCDF4'

Is netcdf4 supported in Azure? If so, how do I install the module. I've tried adding cmd /c "pip install azure-storage-blob pandas netCDF4" to the "Start task settings" of my Batch pool, but no luck!

Thanks in advance!

I tried reproducing your error from my vscode terminal by adding below line in my imports:

import netCDF4 as nc

When I tired to do pip install and ran my.py file, Error message has been thrown as Module not found.

Now I found the problem, first we need to activate the virtual environment in python (CMD or VSCODE) Below are the commands for to activate it:

python -m venv .venv
.venv\Scripts\activate

Now I did pip install netCDF4, It got successfully installed.

Below is the screenshot for it: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM