awslabs / aws-glue-libs

AWS Glue Libraries are additions and enhancements to Spark for ETL operations.
Other
635 stars 299 forks source link

Glue Interactive Session / Jupyter Notebook setup failing on Windows #160

Open dmschauer opened 1 year ago

dmschauer commented 1 year ago

Hi, there seems to be a bug in the current version of the library. Someone else already descibed it on Stackoverflow:

Using interactive Glue Sessions in a Jupyter Notebook was working correctly with the aws-glue-sessions package version 0.32 installed. After upgrading with pip3 install --upgrade jupyter boto3 aws-glue-sessions to version 0.35, the kernel would not start. Gave an error message in GlueKernel.py line 443 in set_glue_version Exception: Valid Glue versions are {'3.0', '2,0} and the Kernel won't start.

Reverting to version 0.32 resolves the issue. Tried installing 0.35, 0.34, 0.33 and get the error, which makes me think it's something I'm doing wrong or don't understand and not something in the product. Is there anything additional I need to do to upgrade the version of the aws-glue-sessions? https://stackoverflow.com/questions/73778325/set-glue-version-exception-after-upgrading-aws-glue-sessions

I had the same problem on Windows 10 and of course I also took care to do the usual .aws configuration beforehand. There were two ways to fix this problem for me:

For fixing it

The problem is with this piece of code:

def _retrieve_os_env_variable(self, key):
    _, output = subprocess.getstatusoutput(f"echo ${key}")
    return os.getenv(key, output)

Manually changing the code to the way it was implemented in the 0.32 version solved the problem:

def _retrieve_os_env_variable(self, key):
    return os.environ.get(key)