Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Howto Setup Docker container to run sarpy_apps #57

Open
AshitakaLax opened this issue Dec 6, 2024 · 1 comment
Open

Howto Setup Docker container to run sarpy_apps #57

AshitakaLax opened this issue Dec 6, 2024 · 1 comment

Comments

@AshitakaLax
Copy link

Hi, I've loved using the image_viewer and have it setup for my local machine (which took a bit of messing with).
I would like to share it with others, so I'm trying to add it to a rocky85 docker image. I'm sure I have done something wrong but would like the guidance. Note: I know I can render UI elements in this docker container since I have done with other applications(x11).

I have roughly the following.

RUN dnf install -y python3-tkinter
# this is where things breakdown a bit
# I've tried
RUN pip3 install -q numpy matplotlib Pillow plotly sarpy tk_builder
# also tried without the above install the following in the sarpy_apps directory
RUN python3 -m pip install .
# and the following
RUN python3 setup.py install

Everytime i run it I still get

$ python3 sarpy_apps/apps/image_viewer.py 
Traceback (most recent call last):
  File "/bpvol/sarpy_apps-master/sarpy_apps/apps/image_viewer.py", line 11, in <module>
    import tkinter
ModuleNotFoundError: No module named 'tkinter'

Any guidance or sample dockerfile would be appreciated.
Thanks

@bombaci-vsc
Copy link
Contributor

The error suggests tkinter isn't installed in your docker image's python environment. I don't believe this is caused by anything sarpy_apps is doing.

This is likely a result of how your python environment is being constructed, either by something in your base image or elsewhere in your Dockerfile.

I was not able to reproduce your error with this Dockerfile:

FROM rockylinux:8.5

RUN dnf install -y python3 python3-tkinter python3-pip
RUN dnf install -y gcc zlib-devel libjpeg-devel python3-devel  # needed by Pillow
COPY sarpy_apps /sarpy_apps
WORKDIR /sarpy_apps
RUN pip3 install .

Then when running it I get an expected DISPLAY error, but this happens after it successfully imports tkinter.

# python3 -m sarpy_apps.apps.image_viewer                                                                                      
Traceback (most recent call last):                                                                                                                           
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/sarpy_apps/sarpy_apps/apps/image_viewer.py", line 259, in <module>
    main(reader=args.input)
  File "/sarpy_apps/sarpy_apps/apps/image_viewer.py", line 237, in main
    root = tkinter.Tk()
  File "/usr/lib64/python3.6/tkinter/__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants