0

I have a Python API that runs a Queue object defined as:

from queue import Queue    
frame_queue = Queue(maxsize = 0)

I run this on a conda environment using conda run command as :

conda run -n my_env python my_api.py

When this command is run on the host it works perfectly, but when it's run on the container (specified on the Dockerfile of the image of the container it logs the following error:

Traceback (most recent call last):
  File "queue_api.py", line 13, in <module>
    frame_queue = Queue(maxsize = 0)
NameError: name 'Queue' is not defined
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Almostapha
  • 36
  • 5

1 Answers1

0

Use anaconda docker image with python 3. continuumio/anaconda3 can be used instead of continuumio/anaconda

The error stems from difference in python version, in Python 3.x it's import Queue as queue; on the contrary in Python 2.x it's import queue.

See ImportError: No module named 'Queue'

Lesiak
  • 22,088
  • 2
  • 41
  • 65