0

I'm trying to write a small script to manage my Binance account and I have an issue with a library.

I've installed the library "binance_f" from this repository https://github.com/Binance-docs/Binance_Futures_python

The library is correctly installed on default system env, and in the venv I created.

List from system env

List from venv

I can run my script from python3.8 (system or venv) console but I can't run it from pycharm.

From venv:

(venv) herve@neon-herve:~/PycharmProjects/Script-Discord-Futures$ python3.8
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import binance_f
>>> binance_f.__file__
'/home/herve/PycharmProjects/Script-Discord-Futures/venv/lib/python3.8/site-packages/binance_f/__init__.py'
>>>

From system env:

herve@neon-herve:/usr/lib/python3/dist-packages/Binance_Futures_python-master$ python3.8
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import binance_f
>>> binance_f.__file__
'/usr/lib/python3/dist-packages/Binance_Futures_python-master/binance_f/__init__.py'

I tried to use venv or system env with my PyCharm project but it failed.

  Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/herve/PycharmProjects/Script-Discord-Futures/binance_functions.py", line 8, in <module>
    import binance_f
  ModuleNotFoundError: No module named 'binance_f'

This is the interpreter in PyCharm:

System interpreter in PyCharm

Venv interpreter in PyCharm

In Pycharm, I tried to manually add the library but I have an error message. (I added the repository, and tried to install "binance_f".

Pycharm error

I really need to use PyCharm for the debug function !

Thanks a lot for your help.

  • 1
    Go to the pycharm settings and have a look at the interpreter. You might have picked the wrong one... – Virtuoz Oct 10 '21 at 14:54
  • @Virtuoz I added the info in the question, I tried with both – hjacquemin Oct 10 '21 at 15:20
  • 1
    Your PyCharm screenshot shows that it tried to install `binance_f` and failed. But `binance_f` is a part of `binance-futures` and *that* is what you should install. – BoarGules Oct 10 '21 at 15:26
  • Welcome to Stack Overflow. Please edit the question to remove irrelevant information. You are showing several different venvs but it's not clear which one you want to use. When you run pip if for some reason it can't be run within PyCharm run it from the terminal but remember to activate the right venv before you do. Strangely enough I couldn't find any `binance_f` package on pypi. – bad_coder Oct 10 '21 at 15:29
  • @BoarGules manually installed binance-future, binance_futures in pycharm and it's the same. – hjacquemin Oct 10 '21 at 15:31
  • @bad_coder it's not available from pip, I used the sources (for my system env, or venv. If I run my script from the venv or system env it works. Sources are available from here: "https://binance-docs.github.io/apidocs/futures/en/#general-info" In PyCharm I added the git repository as sources for my package and the error I have when I try to install it is: "ERROR: Could not find a version that satisfies the requirement Binance_Futures_python (from versions: none)" – hjacquemin Oct 10 '21 at 15:36
  • @bad_coder my bad I put a bad env screen shot. I cleaned to keep just the system one and the created venv. I used both in console (it works) but not with Pycharm – hjacquemin Oct 10 '21 at 15:48

1 Answers1

0

So as it was clear the issue came from PyCharm I started to check all option available. I found an option in the execution configuration:

Solution

I just force PyCharm to run my script in Python Console !

Thanks to all for your help.