BitMEX / sample-market-maker

Sample BitMEX Market Making Bot
Apache License 2.0
1.7k stars 757 forks source link

Unable to start using pip install #64

Closed dimirey closed 6 years ago

dimirey commented 6 years ago

I've followed the instructions for installation but I am unable to run the program due to this error:

➜  bot marketmaker XBTUSD
Traceback (most recent call last):
  File "/Users/dimitri/.pyenv/versions/3.5.0/bin/marketmaker", line 9, in <module>
    load_entry_point('bitmex-market-maker==1.3', 'console_scripts', 'marketmaker')()
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/site-packages/market_maker/__init__.py", line 21, in run
    from market_maker import market_maker
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/site-packages/market_maker/market_maker.py", line 11, in <module>
    from market_maker import bitmex
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/site-packages/market_maker/bitmex.py", line 12, in <module>
    from market_maker.ws.ws_thread import BitMEXWebsocket
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/site-packages/market_maker/ws/ws_thread.py", line 10, in <module>
    from market_maker.settings import settings
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/site-packages/market_maker/settings.py", line 25, in <module>
    userSettings = import_path(os.path.join('.', 'settings'))
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/site-packages/market_maker/settings.py", line 19, in import_path
    module = importlib.import_module(filename, path)
  File "/Users/dimitri/.pyenv/versions/3.5.0/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 981, in _gcd_import
  File "<frozen importlib._bootstrap>", line 931, in _sanity_check
SystemError: Parent module '.' not loaded, cannot perform relative import
ryanfox commented 6 years ago
  1. How did you install the library?
  2. How are you starting the application?
dimirey commented 6 years ago

I installed globally via pip: pip install bitmex-market-maker

I configured the settings file as per instructions and tried runningmarketmaker XBTUSD within the created folder

I'm running OSX 10.13.3 and using python 3.5

ryanfox commented 6 years ago

Try running it from the same directory you ran marketmaker setup in.

dimirey commented 6 years ago

Doesn't work, getting this error:

marketmaker "XBTUSD" Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/bin/marketmaker", line 9, in <module> load_entry_point('bitmex-market-maker==1.3', 'console_scripts', 'marketmaker')() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/__init__.py", line 21, in run from market_maker import market_maker File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/market_maker.py", line 11, in <module> from market_maker import bitmex File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/bitmex.py", line 12, in <module> from market_maker.ws.ws_thread import BitMEXWebsocket File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/ws/ws_thread.py", line 10, in <module> from market_maker.settings import settings File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/settings.py", line 25, in <module> userSettings = import_path(os.path.join('.', 'settings')) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/settings.py", line 19, in import_path module = importlib.import_module(filename, path) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 981, in _gcd_import File "<frozen importlib._bootstrap>", line 931, in _sanity_check SystemError: Parent module '.' not loaded, cannot perform relative import

SirHodlington commented 6 years ago

I'm having the same issue on windows and on linux servers

SirHodlington commented 6 years ago

[ec2-user@ip-xxx-xx-xx-xxx ~]$ marketmaker XBTUSD Traceback (most recent call last): File "/usr/local/bin/marketmaker", line 11, in load_entry_point('bitmex-market-maker==1.3', 'console_scripts', 'marketmaker')() File "/usr/local/lib/python2.7/site-packages/market_maker/init.py", line 21, in run from market_maker import market_maker File "/usr/local/lib/python2.7/site-packages/market_maker/market_maker.py", line 11, in from market_maker import bitmex File "/usr/local/lib/python2.7/site-packages/market_maker/bitmex.py", line 12, in from market_maker.ws.ws_thread import BitMEXWebsocket File "/usr/local/lib/python2.7/site-packages/market_maker/ws/ws_thread.py", line 10, in from market_maker.settings import settings File "/usr/local/lib/python2.7/site-packages/market_maker/settings.py", line 25, in userSettings = import_path(os.path.join('.', 'settings')) File "/usr/local/lib/python2.7/site-packages/market_maker/settings.py", line 20, in import_path importlib.reload(module) # Might be out of date AttributeError: 'module' object has no attribute 'reload'

ryanfox commented 6 years ago

@SirHodlington Python 2 is not supported.

@dimirey How did you install the package? /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/__init__.py looks wrong.

dimirey commented 6 years ago

@ryanfox I installed using pip install bitmex-market-maker

ryanfox commented 6 years ago

It doesn't look like your script is using the version you pip installed, the pypi release doesn't have an egg. What results do you get if you run

which python

and launch a python console and run

>>> import marketmaker
>>> marketmaker
dimirey commented 6 years ago

@ryanfox

➜  ~ which python
python: aliased to python3

➜  ~ python
Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import marketmaker
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'marketmaker'
>>> marketmaker
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'marketmaker' is not defined
>>>
ryanfox commented 6 years ago

The python you are running doesn't have marketmaker installed. You might try uninstalling, and reinstalling. I'm not sure that will work though, that .egg file is strange, pip should not have installed that.

It's a good idea to use a virtualenv in general - it makes it easy to ensure you are getting a clean install.

fabrixpo commented 6 years ago

I'm experiencing the same issue. Tried to uninstall and reinstall the market-maker script but no success. I used a virtualenv but maybe a detailed step-by-step description could help.

ryanfox commented 6 years ago

The README has step by step instructions: https://github.com/BitMEX/sample-market-maker#getting-started

fabrixpo commented 6 years ago

Followed exactly these instructions but seems to miss some important thing. Uninstalled and reinstalled a lot of times, with and without venv. Always same (stupid) error...