Sagemaker python sdk installation troubles

0

Hi,

I've tried following a tutorial to use AWS sagemaker in script mode from my local linux VM, but I can't even get the basics working.

Steps:

  • ➜ ~> python3 --version
    Python 3.6.9

  • ➜ ~> pip3 install sagemaker
    ...
    Successfully installed boto3-1.14.42 botocore-1.17.42 importlib-metadata-1.7.0 packaging-20.4 protobuf3-to
    -dict-0.1.5 s3transfer-0.3.3 sagemaker-2.3.0 smdebug-rulesconfig-0.1.4 zipp-3.1.0

➜ ~> cat sagemaker.py
import sagemaker
import boto3

sess = sagemaker.Session()

> python3 sagemaker.py
Traceback (most recent call last):
File "sagemaker.py", line 1, in <module>
import sagemaker
File "
/sagemaker.py", line 4, in <module>
sess = sagemaker.Session()
AttributeError: module 'sagemaker' has no attribute 'Session'

I also have the aws cli (version 2) installed, and configured using IAM credentials that have full rights, so that's not related.

What is the problem with my python sdk install? TIA

TomTSK
gefragt vor 4 Jahren743 Aufrufe
2 Antworten
0
Akzeptierte Antwort

You should name your script something else than sagemaker.py, since python will look in the current directory first for a module when doing an import, so the import sagemaker will not import the Sagemaker SDK, but your script.

beantwortet vor 4 Jahren
0

Well, that one is for my list of top 10 most stupid programming things I've ever done... Thanks!

TomTSK
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen