Python code error: No module named 'aiohttp'

Solved!
engcngn
Level 2
Python code error: No module named 'aiohttp'

Hi All, 

i tried to run python code in dataiku to collect data from API, but i got error: No module named 'aiohttp'

i tried to install aiohttp in my computer, it was successful installed, but i still got same error while running code again.

i would like to ask that how to install aiohttp library in dataiku? or how to fix the error?

Thanks in advance!

Ngoc

0 Kudos
1 Solution
JuanE
Dataiker

You need to install that package in a code environment:

https://doc.dataiku.com/dss/latest/code-envs/index.html

And then use that code environment in the Python recipe/notebook.

View solution in original post

0 Kudos
4 Replies
JuanE
Dataiker

You need to install that package in a code environment:

https://doc.dataiku.com/dss/latest/code-envs/index.html

And then use that code environment in the Python recipe/notebook.

0 Kudos
engcngn
Level 2
Author

Thanks a lot JuanE, that's helped me. 

But i got another error like this, can you give me advise on this: 

Job failed: Error in Python process: At line 77: <class 'TypeError'>: __init__() got an unexpected keyword argument 'session'

a piece of my code: 

c_session = aiohttp.ClientSession()
loop = asyncio.get_event_loop()
data_ISAT = loop.run_until_complete(set_wbsnn_df(ISAT_halaman,ISAT_kaLink,ISAT_args,c_session))
data_ISAT = data_ISAT.fillna('')

 

thanks in advance

Ngoc

0 Kudos
JuanE
Dataiker

That just means there is an error in the Python code you're writing. As the error says, in line 77 you're initializing a class by passing it a "session" keyword argument, but it was not expecting it. You will have to read the documentation of whatever library you're using to know more.

0 Kudos
engcngn
Level 2
Author

thanks bro, i solved it.

Labels

?
Labels (1)

Setup info

?
A banner prompting to get Dataiku