I just bought Raspberry Pi3 B+ and camera module. I installed Python and opencv on Pi. There was no outstanding error during installation. I connected to Raspberry pi via ssh from my mac. When I run a script, I get this error.
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x15e4340 (ENOSPC) mmal: mmal_connection_enable: output port couldn't be enabled Traceback (most recent call last): File "test_image.py", line 8, in <module> camera = PiCamera() File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/picamera/camera.py", line 433, in __init__ self._init_preview() File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/picamera/camera.py", line 513, in _init_preview self, self._camera.outputs[self.CAMERA_PREVIEW_PORT]) File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/picamera/renderers.py", line 558, in __init__ self.renderer.inputs.connect(source).enable() File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/picamera/mmalobj.py", line 2212, in enable prefix="Failed to enable connection") File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/picamera/exc.py", line 184, in mmal_check raise PiCameraMMALError(status, prefix) picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources
I really have no idea whether it is the problem of connection. I enabled the camera (I also rebooted it by unplugging and plugging-in the power) and ssh by entering sudo raspi-config, did sudo apt-get update, sudo apt-get upgrade, and sudo rpi-update.
Some people suggested 'export DISPLAY=:1.0 (or 0)', and both of them bring errors saying
Unable to init server: Could not connect: Connection refused (Image:1981): Gtk-WARNING **: cannot open display: :1.0 ** (Image:2003): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
Now I am trying to replace the Pi and Camera module with others because they could be defective. However, before I try different devices, I would like to know what might cause such error.
A few more facts
** I also run it in a virtual environment. Python 3.5.3 and Opencv 3.4
** The wifi I connect via Macbook is a public one.
** Raspistill information is
raspistill Camera App v1.3.11 Width 3280, Height 2464, quality 85, filename (null) Time delay 5000, Raw no Thumbnail enabled Yes, width 64, height 48, quality 35 Link to latest frame enabled no Full resolution preview No Capture method : Single capture Preview Yes, Full screen Yes Preview window 0,0,1024,768 Opacity 255 Sharpness 0, Contrast 0, Brightness 50 Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0 Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none' Flicker Avoid Mode 'off' Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128 Rotation 0, hflip No, vflip No ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000 mmal: mmal_vc_component_enable: failed to enable component: ENOSPC mmal: camera component couldn't be enabled mmal: main: Failed to create camera component mmal: Failed to run camera app. Please check for firmware updates