hootnot / oandapyV20-examples

Examples demonstrating the use of oandapyV20 (oanda-api-v20)
MIT License
147 stars 65 forks source link

examples requirements #25

Closed liborty closed 5 years ago

liborty commented 5 years ago

When trying to install examples requirements.txt, with pip3, I get the following error: Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-qjxqjbw7/urwidtrees/setup.py", line 4, in import urwidtrees.version as v File "/tmp/pip-build-qjxqjbw7/urwidtrees/urwidtrees/init.py", line 6, in from .decoration import DecoratedTree, CollapsibleTree File "/tmp/pip-build-qjxqjbw7/urwidtrees/urwidtrees/decoration.py", line 4, in import urwid ModuleNotFoundError: No module named 'urwid' Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qjxqjbw7/urwidtrees/

hootnot commented 5 years ago

Hi, the only example requiring urwid is the console application. It makes use of of urwidtrees which depends on urwid. The install of that package seems to fail because it does not find urwid at time of the install.

Work around: install urwid first and then all from the requirements.txt

# pip / pip3
pip install urwid
pip install -r requirements.txt

... but having this done I noticed you will run into an issue with Geventloop. There seems to be an incompatibility with urwid > 2.0.0.

I will close this issue and make a change to the oanda_console.py application . It will only run on python 3 after that change.

See: https://github.com/hootnot/oandapyV20-examples/issues/22

liborty commented 5 years ago

I had already done what you suggest but now I get this: python3 src/oanda_console.py src/oandaconsole.py:63: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util (/home/l/.local/lib/python3.6/site-packages/urllib3/util/init.py)', 'urllib3.util.ssl (/home/l/.local/lib/python3.6/site-packages/urllib3/util/ssl_.py)']. monkey.patch_all() Traceback (most recent call last): File "src/oanda_console.py", line 370, in event_loop=GeventLoop()) File "/home/l/.local/lib/python3.6/site-packages/urwid/main_loop.py", line 136, in init self.screen.signal_handler_setter = self.event_loop.set_signal_handler AttributeError: 'GeventLoop' object has no attribute 'set_signal_handler'

hootnot commented 5 years ago

I've updated the oanda_console.py example yesterday. Under python 3.5 there seems to be no issue. The MonkeyPatchWarning does occur under python 3.6.7 .

I see you refer to "src/oanda_console.py", line 370. That means you have to update that code for the fix I did yesterday. That GeventLoop was removed, so in the new code it is impossible to have that error.

I've just applied another fix regarding the monkeypatch. If you update your examples repo or clone a new one it should work under python 3.6

liborty commented 5 years ago

Thanks, the console now works under Python 3.6.7