Help importing python-binance to python

On my computer i can run just run “pip install python-binance” and I’m basically done. However I am having troubles on pipedream. Does anyone know how to import it?

Hello @jakubvazan,

First off, welcome to Pipedream! Happy to have you!

I think this article can help you to understand how Pipedream resolve Python dependencies: https://pipedream.com/docs/code/python/#if-your-package-s-import-name-differs-from-its-pypi-package-name

I paste below the important part


If your package’s import name differs from its PyPI package name

Pipedream’s package installation uses the pipreqs package (opens new window)to detect package imports and install the associated package for you. Some packages, like python-telegram-bot (opens new window), use an import name that differs from their PyPI name:

pip install python-telegram-bot

Copied

vs.

import telegram

Copied

Use the built in magic comment system to resolve these mismatches:

# pipedream add-package python-telegram-bot

import telegram

Hello,
thanks for the answer. I did see the article you included, but everything I tried hasn’t worked.
I added # pipedream add-packcage python-binance to my code but with no success.

Hello @jakubvazan,

I’ve tried it and see that the Classes are imported

Could you explain your error?

1 Like


I wrote the same code as you, and that has fixed my prior issue. I had mine a bit wrong… Problem is that I now get a different error. Thank you for your generous help.

Thank you for reporting this @jakubvazan!

I think this might be an intermittent issue, as I tried to reproduce but couldn’t

# pipedream add-package python-binance
from binance import Client

def handler(pd: "pipedream"):
  # Reference data from previous steps
  print(Client)

Hello @pierce, could you advice how to solve this when you have time?

@vunguyenhung I found the issue. I wrote packcage instead of package in the first line. Thank you for your help. It works perfectly now! I’ll read my code more carefully next time :slight_smile:

Nice! Great to hear that @jakubvazan!

1 Like