guner
guner

Reputation: 91

No module named ‘picamera'

I followed this website (https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/) to set my picamera, but I have a problem with the picamera module. I did install the picamera module, and this picture is from pip freeze.

https://i.sstatic.net/Jpqtr.jpg

You can see I have picamera 1.13 already, but when I try test_image.py, it says "No module named ‘picamera'".

https://i.sstatic.net/oEwPB.jpg

I have uninstalled and installed many times, but the error still exist. How do I fix this?

test_image.py

# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2

# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
rawCapture = PiRGBArray(camera)

# allow the camera to warmup
time.sleep(0.1)

# grab an image from the camera
camera.capture(rawCapture, format="bgr")
image = rawCapture.array

# display the image on screen and wait for a keypress
cv2.imshow("Image", image)
cv2.waitKey(0)

Upvotes: 9

Views: 38568

Answers (7)

When I had a file named picamera.py, I had the same problem so I renamed it and since more problem. I hope it's the same for you, otherwise it's above my skills.

Upvotes: -1

jself970
jself970

Reputation: 36

Try the following commands from: https://www.raspberrypi.org/documentation/linux/software/python.md

I'm assuming the path for the picamera module is messed up for some reason, so try purging it and reinstalling it.

Purge using:

sudo apt purge python3-picamera

First make sure everything is up to date:

sudo apt update

Then:

sudo apt install python3-picamera

Upvotes: 1

Virat Gupta
Virat Gupta

Reputation: 1

Pi camera may not work on windows try following commands, it will resolve issue

execute:

set READTHEDOCS=True

Now execute:

pip install picamera

Upvotes: -1

salman
salman

Reputation: 11

I faced the same problem until I noticed that I didn't capitalized c in PiCamera

Upvotes: 1

Yakshkumar Thakar
Yakshkumar Thakar

Reputation: 228

for python3 you have to just try this below commands.keep in mind that you need to open terminal in home directory.

sudo -H apt install python3-picamera
sudo -H pip3 install --upgrade picamera[array]

let me know if it works!

Upvotes: 5

arpit1714
arpit1714

Reputation: 569

Install the picamera Module using the steps below

1.On Windows, execute: set READTHEDOCS=True

1'.On Unix based systems, execute: export READTHEDOCS=True

2.Now execute: pip install picamera

Upvotes: -3

Padma Kannan
Padma Kannan

Reputation: 21

When you run the command pip3 install picamera, it will show that the requirement is already satisfied followed by a path, provided if you have already installed picamera. Now copy that path and include it in your program as follows:

    import sys
    sys.path.append('paste the copied path here')
    from picamera.array import PiRGBArray
    from picamera import PiCamera

Upvotes: 2

Related Questions