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

Ubuntu package: can't find SimpleCV logo #213

Closed
takluyver opened this issue Aug 22, 2012 · 30 comments
Closed

Ubuntu package: can't find SimpleCV logo #213

takluyver opened this issue Aug 22, 2012 · 30 comments

Comments

@takluyver
Copy link
Contributor

I don't know if this is the correct place to report this - please point me in the right direction if not.

I've just installed the .deb package for SimpleCV on Ubuntu 12.04. When I try to show any image, I get the traceback pasted below. I assume this is just trouble with the packaging, as it's not finding the logo in the directory where it expects it.

SimpleCV:10> img.show()
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
/usr/lib/pymodules/python2.7/SimpleCV/Shell/Shell.pyc in <module>()
----> 1 img.show()

/usr/lib/pymodules/python2.7/SimpleCV/ImageClass.pyc in show(self, type)
   5445               d = Display(displaytype='notebook')
   5446           else:
-> 5447               d = Display(self.size())
   5448           self.save(d)
   5449           return d

/usr/lib/pymodules/python2.7/SimpleCV/Display.pyc in __init__(self, resolution, flags, title, displaytype, headless)
    156         if not displaytype == 'notebook':
    157             self.screen = pg.display.set_mode(resolution, flags)
--> 158         scvLogo = SimpleCV.Image("simplecv").scale(32,32)
    159         pg.display.set_icon(scvLogo.getPGSurface())
    160         if flags != pg.FULLSCREEN and flags != pg.NOFRAME:

/usr/lib/pymodules/python2.7/SimpleCV/ImageClass.pyc in __init__(self, source, camera, colorSpace, verbose, sample, cv2image)
    785                     self._bitmap = cv.LoadImage(self.filename, iscolor=cv.CV_LOAD_IMAGE_COLOR)
    786                 except:
--> 787                     self._pil = pil.open(self.filename).convert("RGB")
    788                     self._bitmap = cv.CreateImageHeader(self._pil.size, cv.IPL_DEPTH_8U, 3)
    789                     cv.SetData(self._bitmap, self._pil.tostring())

/usr/lib/python2.7/dist-packages/PIL/Image.pyc in open(fp, mode)
   1950         import __builtin__
   1951         filename = fp
-> 1952         fp = __builtin__.open(fp, "rb")
   1953     else:
   1954         filename = ""

IOError: [Errno 2] No such file or directory: '/usr/lib/pymodules/python2.7/SimpleCV/sampleimages/simplecv.png'
@takluyver
Copy link
Contributor Author

To confirm, when I removed the .deb package and used pip to install it instead, it works. I have a little bit of experience with Debian packaging, so I might be able to help on this front, although not for a couple of weeks.

@vijaym123
Copy link
Contributor

Hi,
I think you can resolve this by manually copying the simplecv image (https://docs.google.com/open?id=0Bwb_Zi7_nUirRXQ5OXlVZmlQU1k) to your folder "/usr/lib/pymodules/python2.7/SimpleCV/sampleimages/" with sudo permissions. :)
Thank you

@xamox
Copy link
Contributor

xamox commented Aug 22, 2012

I will take a look and verify this, it may very well be the case.

@jahneeM3
Copy link

Copying image to said directory solved that problem for me

@zadacka
Copy link

zadacka commented Mar 24, 2013

Copying image solved for me too.

@takluyver
Copy link
Contributor Author

Digging into this, the image is looked up relative to LAUNCH_PATH, which is defined as:

LAUNCH_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__)))

The usual solution to such things is that, in building the Debian package, you install data files to a location like /usr/share/SimpleCV/, and then patch the code specifying the location of your data files, like:

LAUNCH_PATH = '/usr/share/SimpleCV'

For instance, here's a patch used in packaging IPython to achieve the same thing.

@takluyver
Copy link
Contributor Author

Did this get resolved?

@patricksnape
Copy link

I still see this issue when installing via pip on Ubuntu 12.04

@takluyver
Copy link
Contributor Author

@patricksnape : I think this was something specific to the .deb package, which pip doesn't know about. If you're seeing it with a pip installation, that would probably be a separate issue.

@patricksnape
Copy link

I haven't been able to test this since I posted it, but I'll try again this
afternoon on my Ubuntu 13.04 box.

On Mon, Aug 26, 2013 at 3:34 AM, Thomas Kluyver notifications@github.comwrote:

@patricksnape https://github.com/patricksnape : I think this was
something specific to the .deb package, which pip doesn't know about. If
you're seeing it with a pip installation, that would probably be a separate
issue.


Reply to this email directly or view it on GitHubhttps://github.com//issues/213#issuecomment-23241117
.

@xamox
Copy link
Contributor

xamox commented Aug 28, 2013

It could still very well be the case, the problem is that pip is a universal installer while ubuntu is specific. Good practice is to store files in things like /usr/local/ while pip will install a python directory and everything relative to it. I spent some time a while back trying to get it to play nice with setuptools although setuptools had a really hard time copying things recursively and required explicit file names to copy over. I still have not found a perfect solution to get deployment to work correctly as I have to do different things with each OS (tell the installer how to copy the image files over).

I also at one point tried to store the image as a string in a seperate file and load it that way but was not very efficient at all.

I'm open to suggestions on how to solve the issue though.

@takluyver
Copy link
Contributor Author

The way this is often done is to define at a high level a variable like DATA_DIRECTORY, which is set to something relative to __file__. Then for Debian packaging, that variable is patched to point to /usr/share/simplecv, (and if necessary, the debian/rules file moves the data files to there).

@jianli
Copy link

jianli commented Mar 6, 2014

I am experiencing this issue in OS X when installing SimpleCV 1.3.0 using pip.

@ravikg
Copy link

ravikg commented Mar 15, 2014

this issue still exists in deb installer, need to copy the image there manually.

@noahspurrier
Copy link

This is still an issue with both the deb and the version installed by pip (Python 2.7.3). Creating the /usr/local/lib/python2.7/dist-packages/SimpleCV/sampleimages directory and copying in the image simplecv.png does seem to fix the problem for either deb or pip.

@memilanuk
Copy link

Same here. Makes you wonder why its marked as 'closed'...?

@xamox
Copy link
Contributor

xamox commented May 8, 2014

It has been resolved, and merged, the problem is a release hasn't been cut. The package is based on 1.3, there has been a lot added. Another release hasn't been cut because we are building SimpleCV 2.0 which has a lot of underlying changes and didn't want to double our work. The best bet is to just install from source (master or develop branch) and it should fix your issues.

@memilanuk
Copy link

I followed the directions on the SimpleCV github page yesterday...

sudo apt-get install ipython python-opencv python-scipy python-numpy python-pygame python-setuptools python-pip
sudo pip install https://github.com/sightmachine/SimpleCV/zipball/develop

...and it still doesn't work right (also still having problems with pygame i.e. 'video system not initialized' - another ticket marked as 'closed'). Are you suggesting something else?

@xamox
Copy link
Contributor

xamox commented May 8, 2014

Yes, pip might not work.

git clone https://github.com/sightmachine/SimpleCV.git
cd SimpleCV
sudo python setup.py install

@memilanuk
Copy link

Did a pip uninstall simplecv, then did an install straight off the web site... cloned the git repo, ran sudo pip install -r requirements (which required some more screwing around as pip couldn't find PIL, so had to follow with options --allow-external PIL, and then --allow-unverified PIL, then sudo python setup.py install.

It does take care of the SimpleCV logo issue (yay) but still doesn't address other 'closed' issues such as this one:

#74

@xamox
Copy link
Contributor

xamox commented May 8, 2014

I would verify that it did indeed uninstall:

ipython
import SimpleCV
print SimpleCV.file
exit()

Then cd to that directory and make sure images had copied correctly.

You could also just manually download the image and instead of using:
img = Image('simplecv')
you just do:
img = Image('simplecv.png')

Image can be found here:
https://github.com/sightmachine/SimpleCV/blob/master/SimpleCV/sampleimages/simplecv.png

@memilanuk
Copy link

a) been doing the manual file download for some time, as the changes in the SimpleCV 1.3 github repo haven't been promulgated to the distro packages (why? isn't that what minor release numbers i.e. 1.3.xx are for?)

b) see above where I said it worked - when pulled directly from the repo.

@Petertoo
Copy link

I have just installed ubuntu and simpleCV today. I am having the same problem. In fact, if I try to view any image it gives me this error, irrispective of the location of the image. Why it is looking in this directory I do not know. It doesn't even exist. It SEEMS to me that there is a big chunk of simpleCV that just doesn't work.

@kumarankit2594
Copy link

Could you upload your code?

@Petertoo
Copy link

Hi Ankit

So, in simplecv, Ubuntu running in VirtualBox. I find it cannot find an image that is not in the current directory, so I change directory first. Also, it needs the file type to see an image (so, mark.png, not just mark). Not a problem, just explaining why I have done certain things.

cd /home/peter/Downloads

testimage = Image(“mark.png”)

testimage.show()

Then I get the error message, see attached screen capture (I also attach mark.png for you to see). Out of curiosity, if I navigate to the file referred to in the error, I find the containing directory is not there. Anyway, why is it trying to see the simplecv.png logo when I am looking at mark.png in the current directory. By the way, I can save testimage and view it with a normal picture viewer.

Thanks

Peter

From: ANKIT KUMAR [mailto:notifications@github.com]
Sent: 11 September 2015 17:21
To: sightmachine/SimpleCV SimpleCV@noreply.github.com
Cc: Petertoo peter.sladen@btconnect.com
Subject: Re: [SimpleCV] Ubuntu package: can't find SimpleCV logo (#213)

Could you upload your code?


Reply to this email directly or view it on GitHub #213 (comment) .

@kumarankit2594
Copy link

Hi Peter

Just try to give full path of your mark.png(something like:- "G:/images/mark.png"). If this does not work than there must be something wrong with your Ubuntu or SimpleCV installation, i am not sure because i am running SimpleCV in my 64 bit windows 10 system and giving full path of any image works fine in my system. So, i would suggest you to first go for above mentioned full path of your image.

@hedingjie
Copy link

I use Ubuntu15. And i just 'mkdir' the /usr/lib/pymodules/python2.7/SimpleCV/sampleimages/, and copy the 'simplecv.png' to it. It works!

@checor
Copy link

checor commented Mar 16, 2016

I use Manjaro (Arch fork). Oddly enough, I installed from AUR and this issue was present.
Copying the image also solves the problem.

Thanks!

@Petertoo
Copy link

I Gave up. I used numpy and did a least mean square error. Takes longer, but gives a more reliable result so I am told. Obviously doesn’t work in real world photos (perspective…).

From: Sergio Urbina [mailto:notifications@github.com]
Sent: 16 March 2016 21:12
To: sightmachine/SimpleCV SimpleCV@noreply.github.com
Cc: Petertoo peter.sladen@btconnect.com
Subject: Re: [SimpleCV] Ubuntu package: can't find SimpleCV logo (#213)

I use Manjaro (Arch fork). Oddly enough, I installed from AUR and this issue was present.
Copying the image also solves the problem.

Thanks!


You are receiving this because you commented.
Reply to this email directly or view it on GitHub #213 (comment)


No virus found in this message.
Checked by AVG - www.avg.com http://www.avg.com
Version: 2016.0.7442 / Virus Database: 4542/11819 - Release Date: 03/15/16

@checor
Copy link

checor commented Mar 17, 2016

Hi Petertoo, I had the same problem, try to do the same that vijaym123. Copy the sample picture to that directory with root parameters.

I still wonder why looks for that photo even if you tell the program to load another picture.

Cheers.

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

No branches or pull requests