In this post we’ll learn to troubleshoot errors you might encounter when starting to use the Amazon Web Services s3transfer library in your Python development environment.
You will typically bump into import errors, when trying to use a 3rd party add-ons which is not part of the built-in Python standard library in your program. This error could happen in Windows 7 / 10 / 11, macOS and Linux distributions; when working on a any popular Python IDE, such as PyCharm, Spyder, Visual Studio Code or in Jupyter Notebooks or Lab and Google Colab notebooks.
Here’s a simple screenshot from VSCode:
Fixing the No module named s3transfer error
We typically use the pip utility in order to fix import errors. Pip is the acronym for the Python package utility which allows to easily install and update 3rd party packages into our Python Workspace and Environment.
Here are the steps to fix the s3transfer modulenotfound error:
- Save the code in your .py or ipynb file.
- Close your Python development environment (VSCode, PyCharm etc’).
- Open a shell window (In Windows that’s your command prompt).
- Move to the Scripts folder under your Python installation. In Windows, this can look as following :
Note that if you have already added Python to your Path environment variable, you can go ahead and call pip as shown below.
- Next, go ahead and hit Enter and call the Python Package Manager as shown below.
pip3 install s3transfer
- Hit Enter. The package will be collected and installed in your Python Workspace and available for you to use in your Python script.
S3transfer not found error in MiniConda or Anaconda
If you are using a pre-built environment that doesn’t include the s3transfer package, you can still easily install it using the Anaconda graphical install or command prompt.
- Save your Python code (into ipynb or py files).
- Close your IDE.
- Open the Anaconda prompt.
- Activate your conda environment.
- Install the package using conda install:
conda install s3transfer
- Hit Y when prompted. Once done close the Anaconda Prompt.
- Now go back to your Python environment and import s3transfer into your Python program.