No module named 'requests_toolbelt'

Viewed 20779

So, I'm trying to upload my python app to heroku but when I use a script with 'requests_toolbelt' it says is not found.

Here my log:

Traceback (most recent call last):
  File "girl.py", line 12, in <module>
    from Coffe import CoffeAPI
  File "/app/CoffeAPI/__init__.py", line 29, in <module>
    from requests_toolbelt import MultipartEncoder
ImportError: No module named 'requests_toolbelt'

Here my requeriments.txt:

requests-toolbelt==0.7.1
moviepy==0.2.2.11
requests==2.13.0

Do I need an specific buildpack to run 'requests_toolbelt'?

3 Answers

Try installing requests-toolbelt. Use below command to do that.

# pip install requests-toolbelt

I had the same issue, and my solution was that

the package was installed by root user

and after changing the access properties of the files, it worked fine.
The command I specifically issued (on ubuntu-like system) was:

sudo chown $USER.$USER -R ~/.local/lib/python3.7/site-packages/
Related