2

I am working with python3 and Ubuntu 18.04 and trying to install a python package named "pyimagesearch". it is not possible to install using pip command or apt-get install. I Googled to see how to install it but all the hits showed this link:

https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

I followed all the steps without any error. to test that as mentioned in this link, I did :

import cv2

and it worked. then I tried:

import pyimagesearch

but still I am getting this error:

>>> import pyimagesearch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyimagesearch'

Do you know how to install this package?

elly
  • 317
  • 1
  • 2
  • 11

6 Answers6

5

"pyimagesearch" is not any package that you can import. It's a folder in the source code (you need to download the source code from pyimageseach's tutorial page). That folder has a file.py which contains a well-defined class of your interest.

from pyimageseach.file import class

"import pyimagesearch" won't work.

Importing class from another file

The ReBel
  • 61
  • 1
  • 4
2

Just take a look on the source from where you are taking the help to create your this project. Because there is no any library called pyimagesearch. If you are taking the help from pyimagesearch.com then this python library is not a prebuilt library but this is a manual library that you will have to create by yourself, for the creation of which there must be a guide over there.

In short, you will have to create it by your self. Read your source very carefully, there must be any hint for creating that library. Probably.

1

I was also having same problem, unable to import packages from folder in my spyder and jupyter note book. But then I ran the code in anaonda prompt it ran successfully.

Simply download zip file of code extract it and run on anaconda prompt. It will run. It worked for me.

0

Are you sure 'pyimagesearch' is what you need? pyimagesearch.com usually uses the library 'imutils'. Maybe 'imutils' is the library you need? If so, try 'pip install imutils'.

Robin Alvarenga
  • 321
  • 2
  • 14
0

As it is a library from the project https://www.pyimagesearch.com you need to download it from there and put it to the folder with your code. Note they ask you to provide an email which they send the source code on. That what they said:

You need to download the source code to this blog post using the “Downloads” section of this tutorial. You are likely forgetting to create the pyimagesearch directory and put a init.py file inside of it.

Klim
  • 142
  • 2
  • 9
0

When you sign up with www.pyimagesearch.com he'll send you a zip file. Once you unzip it you'll see models.py in this file you have all the necessary functions. I signed up after reading this article: https://www.pyimagesearch.com/2019/01/28/keras-regression-and-cnns/

I basically copied the whole models.py into my Jupyter notebook and it worked