adithya gopikrishnan
adithya gopikrishnan

Reputation: 133

ImportError: Missing optional dependency 'S3Fs'. The S3Fs package is required to handle S3 files. Use pip or conda to install S3Fs

I am using AWS Cloud9 as my IDE.

import boto3
import pandas as pd
# import s3fs
# s3_ob=boto3.resource('s3',aws_access_key_id="xxxxxxxxxx",aws_secret_access_key="xxxxxxxxxxxx")
client=boto3.client('s3')
path="s3://xxxxxx/FL_insurance_sample.csv"

df=pd.read_csv(path)
# df.head()
print(df)`

While I am able to get the output CSV file in Pycharm, when I use the same code in Cloud9 IDE on AWS I get the error mentioned in title.

I have installed the S3Fs using the pip install S3Fs and when I do "pip list" it does give me the list installed which contains S3Fs so I am confused, why am I getting this error when the module is already installed and it shows in the pip list, and I also tried uncommenting the import S3Fs and still the same error is there.

Please help me.

Upvotes: 13

Views: 82344

Answers (5)

Amogh Joshi
Amogh Joshi

Reputation: 55

If you are using a Jupyter Notebook enviroment, use !pip instead pip as you want to execute pip as a shell command and install s3fs directly into the kernel.

!pip install s3fs

Be sure to restart the kernel after installation.

Upvotes: 1

Hezi Zisman
Hezi Zisman

Reputation: 88

For me, the problem was missing aiobotocore package.

pip install aiobotocore

Upvotes: 0

Wei Shan Lee
Wei Shan Lee

Reputation: 480

pip3 install s3fs 

solved the issue for me.

Upvotes: 8

mike black
mike black

Reputation: 21

You just have to install the package. Open you Command Prompt and type:
pip install fsspec

Upvotes: 2

Saurabh Jain
Saurabh Jain

Reputation: 1712

Installed the s3fs package using pip. It was showing up in pip list. But it did not show up when I did: conda list.

I resolved this problem by doing the following steps:

  1. Installed the s3fs dependecy using conda install -c conda-forge s3fs
  2. Restarted kernel
  3. Imported s3fsand pandas
  4. Read the csv file which was in my s3 bucket.

PS: It was library issue.

Upvotes: 21

Related Questions