OpenBB icon indicating copy to clipboard operation
OpenBB copied to clipboard

[Bug] Docker Mac M1 - Getting started

Open justinlevi opened this issue 2 years ago โ€ข 7 comments

Describe the bug Just getting started with OpenBB terminal using Docker on my M1 Mac and I get the following Error

/home/python/openbb_terminal/helper_classes.py:361: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()

To Reproduce Followed the documentation installation steps and tried running the following

2023 Jan 08, 17:31 (๐Ÿฆ‹) /stocks/ $ load AMZN

Loading Daily data for AMZN with starting period 2020-01-06.

Company: Amazon.com, Inc. Exchange: NASDAQ/NMS (GLOBAL MARKET) Currency: USD

                                    AMZN Performance

โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“ โ”ƒ 1 Day โ”ƒ 1 Week โ”ƒ 1 Month โ”ƒ 1 Year โ”ƒ YTD โ”ƒ Volatility (1Y) โ”ƒ Volume (10D avg) โ”ƒ Last Price โ”ƒ โ”กโ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ โ”‚ 1.1 % โ”‚ 2.26 % โ”‚ -2.46 % โ”‚ -47.63 % โ”‚ 0.3 % โ”‚ 50.22 % โ”‚ 65.09 M โ”‚ 86.08 โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

2023 Jan 08, 17:31 (๐Ÿฆ‹) /stocks/ $ candle

/home/python/openbb_terminal/helper_classes.py:361: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. plt.show()

2023 Jan 08, 17:31 (๐Ÿฆ‹) /stocks/ $ /home/python/openbb_terminal/menu.py:43: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. pyplot.pause(0.1)

Desktop (please complete the following information):

  • OS: Ventura
  • Python version - docker image so should be whatever ghcr.io/openbb-finance/openbbterminal/openbb:2.1.0 comes with

Additional context XQuartz is installed and running

justinlevi avatar Jan 08 '23 22:01 justinlevi

You can change this in the terminal,

/settings/backend MacOSX

or you can add this to your .env file:

OPENBB_BACKEND='MacOSX'

deeleeramone avatar Jan 09 '23 02:01 deeleeramone

Unfortunately I'm now seeing this error:

โžœ  openbb xhost +$IP; docker compose run -e DISPLAY=$IP:0 openbb
access control disabled, clients can connect from any host

<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
Traceback (most recent call last):
  File "/home/python/terminal.py", line 2, in <module>
    from openbb_terminal import terminal_controller
  File "/home/python/openbb_terminal/terminal_controller.py", line 27, in <module>
    from openbb_terminal.terminal_helper import is_packaged_application
  File "/home/python/openbb_terminal/terminal_helper.py", line 22, in <module>
    from openbb_terminal import thought_of_the_day as thought
  File "/home/python/openbb_terminal/thought_of_the_day.py", line 11, in <module>
    from openbb_terminal.helper_funcs import get_user_agent
  File "/home/python/openbb_terminal/helper_funcs.py", line 55, in <module>
    matplotlib.use(cfgPlot.BACKEND)
  File "/home/python/.cache/pypoetry/virtualenvs/openbb-K8M3siuK-py3.10/lib/python3.10/site-packages/matplotlib/__init__.py", line 1129, in use
    name = validate_backend(backend)
  File "/home/python/.cache/pypoetry/virtualenvs/openbb-K8M3siuK-py3.10/lib/python3.10/site-packages/matplotlib/rcsetup.py", line 255, in validate_backend
    else _validate_standard_backends(s))
  File "/home/python/.cache/pypoetry/virtualenvs/openbb-K8M3siuK-py3.10/lib/python3.10/site-packages/matplotlib/rcsetup.py", line 82, in __call__
    raise ValueError(msg)
ValueError: "'macosx'" is not a valid value for backend; supported values are ['GTK3Agg', 'GTK3Cairo', 'GTK4Agg', 'GTK4Cairo', 'MacOSX', 'nbAgg', 'QtAgg', 'QtCairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']; remove quotes surrounding your string

Here's what I've tried:

I have a .env file next to my docker-compose.yaml with the following set:

OPENBB_BACKEND='MacOSX'

Tried adding the env directly to the docker-compose.yml file

version: '3.8'
services:
  openbb:
    environment:
      - DISPLAY=host.docker.internal:0.0
      - OPENBB_BACKEND='MacOSX'
    volumes:
      - ~/OpenBBUserData:/home/python/OpenBBUserData
      - ~/.openbb_terminal:/home/python/.openbb_terminal
    platform: linux/amd64
    image: ghcr.io/openbb-finance/openbbterminal/openbb:2.1.0
    stdin_open: true # docker run -i
    tty: true # docker run -t

justinlevi avatar Jan 09 '23 16:01 justinlevi

I've also tried making the change in the terminal with the same result as before

image

justinlevi avatar Jan 09 '23 16:01 justinlevi

you will need to exit and restart the terminal before the changes take place. also something else which may be contributing is that your docker compose file is requesting Linux/AMD64 for the platform, which is not MacOSX, Darwin/AMD64

deeleeramone avatar Jan 09 '23 16:01 deeleeramone

Thanks for the feedback. I'm just following along with the installation instructions here:

https://docs.openbb.co/terminal/quickstart/installation?tab=docker#14-pull-and-run-the-container

I was wondering about the platform property but didn't see anything in the docs. Unfortunately, when I try to change that to Darwin/amd64 I'm now seeing this error:

โžœ openbb xhost +$IP; docker compose run -e DISPLAY=$IP:0 openbb

access control disabled, clients can connect from any host Error response from daemon: image with reference ghcr.io/openbb-finance/openbbterminal/openbb:2.1.0 was found but does not match the specified platform: wanted darwin/amd64, actual: linux/amd64

When testing the env settings, I definitely killed the container and recreated it.

Any other ideas?

justinlevi avatar Jan 09 '23 17:01 justinlevi

@Chavithra might have some wisdom to share.

If it is a Linux environment, try adding this to the docker compose file:

extra_hosts:
      - "host.docker.internal:host-gateway"

Then running with this instead :

xhost +local:
docker compose run openbb

deeleeramone avatar Jan 09 '23 22:01 deeleeramone

Sorry, I'm confused by your comment.

Per the installation instructions, I'm downloading the docker-compose.yml file here: https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml

The platform is set as platform: linux/amd64

I'm unsure what you mean by: If it is a Linux environment..."

The docker image that is referenced in the instructions is a linux environment. The platform that you mentioned, Darwin/amd64 doesn't seem to exist.

Do you know if the docker instructions were tested on Mac? My docker-compose file now looks like this:

version: '3.8'
services:
  openbb:
    environment:
      - DISPLAY=host.docker.internal:0.0
      - OPENBB_BACKEND='MacOSX'
    volumes:
      - ~/OpenBBUserData:/home/python/OpenBBUserData
      - ~/.openbb_terminal:/home/python/.openbb_terminal
    platform: linux/amd64
    image: ghcr.io/openbb-finance/openbbterminal/openbb:2.1.0
    stdin_open: true # docker run -i
    tty: true # docker run -t
    extra_hosts:
        - "host.docker.internal:host-gateway"

And running

โžœ  openbb xhost +local:
docker compose run openbb

returns:

non-network local connections being added to access control list
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
Traceback (most recent call last):
  File "/home/python/terminal.py", line 2, in <module>
    from openbb_terminal import terminal_controller
  File "/home/python/openbb_terminal/terminal_controller.py", line 27, in <module>
    from openbb_terminal.terminal_helper import is_packaged_application
  File "/home/python/openbb_terminal/terminal_helper.py", line 22, in <module>
    from openbb_terminal import thought_of_the_day as thought
  File "/home/python/openbb_terminal/thought_of_the_day.py", line 11, in <module>
    from openbb_terminal.helper_funcs import get_user_agent
  File "/home/python/openbb_terminal/helper_funcs.py", line 55, in <module>
    matplotlib.use(cfgPlot.BACKEND)
  File "/home/python/.cache/pypoetry/virtualenvs/openbb-K8M3siuK-py3.10/lib/python3.10/site-packages/matplotlib/__init__.py", line 1129, in use
    name = validate_backend(backend)
  File "/home/python/.cache/pypoetry/virtualenvs/openbb-K8M3siuK-py3.10/lib/python3.10/site-packages/matplotlib/rcsetup.py", line 255, in validate_backend
    else _validate_standard_backends(s))
  File "/home/python/.cache/pypoetry/virtualenvs/openbb-K8M3siuK-py3.10/lib/python3.10/site-packages/matplotlib/rcsetup.py", line 82, in __call__
    raise ValueError(msg)
ValueError: "'macosx'" is not a valid value for backend; supported values are ['GTK3Agg', 'GTK3Cairo', 'GTK4Agg', 'GTK4Cairo', 'MacOSX', 'nbAgg', 'QtAgg', 'QtCairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']; remove quotes surrounding your string
โžœ  openbb 

justinlevi avatar Jan 16 '23 21:01 justinlevi

We have moved to plolty on develop!

colin99d avatar Mar 17 '23 13:03 colin99d