Facing an Error while trying to Import ModelStep - amazon-web-services

I am trying to import ModelStep using the code
from sagemaker.workflow.model_step import ModelStep
But it is throwing the error
ModuleNotFoundError: No module named 'sagemaker.workflow.model_step'
How can I resolve this issue?

This feature, in sagemaker-python-sdk, was introduced starting with release 2.90.0 (16 May 2022).
I suggest always keeping sagemaker updated, they come out with updates very frequently and quite important:
pip install -U sagemaker

Related

Python3: AttributeError: module 'boto' has no attribute 'plugin'

I am running some code on a Google Platform Compute Engine VM and I get an error when I imported Python boto library.
The first time if I run 'import boto', the error message would be:
ModuleNotFoundError: No module named 'urllib2'
Then I ran it again, a different error message came out:
AttributeError: module 'boto' has no attribute 'plugin'
I tried installing google-compute-engine but it didn't work. I also tried different versions of boto but failed as well.
As it is suggested by user10360186 in AttributeError: module 'boto' has no attribute 'plugin' answer. You have to execute
$ pip install google-compute-engine
and restart the VM.
Problem solved. Not sure why but when you try to use boto on a google platform engine. There will be a file /usr/share/google/boto/boto_plugins/compute_auth.py, you need to modify the line from 'import urllib2' to 'import urllib.request as urllib2' to fit Python3. Then it is all good.

Cannot import sklearn_pandas in Google AI Platform Notebook after pip install

I am playing around with Google's AI Platform Notebook (which is still in beta at the moment). I uploaded a python script that has dependency on sklearn_pandas and I am getting this error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-24f79569b871> in <module>
----> 1 from sklearn_pandas import DataFrameMapper
ImportError: No module named 'sklearn_pandas'
I then try to pip install it:
!pip install sklearn-pandas
I restarted the kernel but it is still getting same ImportError. I did this to confirm sklearn pandas is really installed:
!pip list |grep -i sklearn
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
sklearn-pandas (1.8.0)
Anyone has tried this? I used google colab before this, and I never have such difficulty. It will be great if Google colab level of user experience can be ported into this beta product. I think this could be a general python module importing issue than just sklearn_pandas in particular.
i think it may be
%pip install sklearn-pandas
instead of "!pip".

python shell import pandas

I have been using pandas and numpy in the iPython Notebook for Python 2.7 and 3.5 without problems for some time.
Now I am switching to the Python Shell for some tasks, but when I type import pandas in the shell, I receive the following error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pandas
ImportError: No module named 'pandas'
What is going wrong?
For some reason your python shell is using different environment variables that your ipython notebook. Could be due to various reasons, maybe you've installed python from the official website, and another distribution such as anaconda (happenned to me for this reason).
To check if that interpretation is correct, look ar the result of the following in both environment (shell & notebook)
import sys
print(sys.path)
Most likely you will find different folders. Python can only import for subfolders of those folders. I guess some will be missing in your shell.
You have 3 approaches :
The easiest way out is to also use ipython for your default shell. It should have the same environment than the notebook.
If you really need python shell to use pandas (but there shouldnt a need), you'll have to add the missing python related folders to the PYTHONPATH environment variable (how to do exactly depends on your OS, you should find easily by googling around). But it may be a pain.
Alternatively, you can start using virtual environments. You can use either conda or virtualenv. They allow you to create have different environements using different python libraries. It's a very useful skill to have with python. I suggest you to check this.
If you're doing data analytics / data science, use conda. Else use virtualenv.
starting with conda
virtualenv

why I am Getting Import error for eve.io.SQLAlchemy?

I am running the demo script available at
https://gist.github.com/Tefnet/5430309
I am getting following error, despite having all libraries
flask sqlalchemy validate SQL
File demo.py in line 2 , in <module>
from eve.io.sqlalchemy import SQLAlchemy, Validator
ImportError no module named sqlalchemy
Not sure why is it giving ? even though I have installed EVE, SQLAlchemy, flask
The SQLAlchemy branch is a work in progress. It has evolved quite a bit from the fork linked by codegeek and now is almost on par (feature-wise) with v0.4dev.
Eve-SQLAlchemy branch
So if you want to play around with it, make sure to pull that branch. Also, one thing it's not been done yet is update requirements.txt and setup.py, so you will want to pip install sqlalchemy on your own.
You can find a rather complete Eve-SQL log by checking out this very long lived ticket.
There is no eve.io.sqlalchemy by looking at the official source code of eve. The Gist that you are looking at is a fork from eve but the changes are not pulled in yet officially.
See the commit changes here.

Installing Celery with Django

I'm trying to install celery with django and I'm get the following error:
from celery.task import sets
ImportError: cannot import name sets
How can I fix that?
Installing a newer version of celery might work. Or your install might not be complete.
But sets should be a part of celery.task.
Atleast, the latest docs indicate that this should be the case: http://ask.github.com/celery/reference/celery.task.sets.html
https://github.com/ask/celery/issues#issue/315
looks like an issue that has been reported.
You might be interested in these 2 pages of the #celery irc log
http://botland.oebfare.com/logger/celery/2011/3/4/2/
http://botland.oebfare.com/logger/celery/2011/3/4/3/