`pkg_resources.require()` doesn’t see wxPython
I'm having trouble using Distribute's pkg_resources.require(). I posted a question on StackOverflow: http://stackoverflow.com/questions/1728676/pkgresources-require-doesnt-see-w... I hope someone here has an answer. Thanks, Ram.
On Fri, Nov 13, 2009 at 9:55 PM, cool-RR <cool-rr@cool-rr.com> wrote:
I'm having trouble using Distribute's pkg_resources.require(). I posted a question on StackOverflow: http://stackoverflow.com/questions/1728676/pkgresources-require-doesnt-see-w... I hope someone here has an answer. Thanks, Ram.
If pkg_resources doesn't find it, it might be that it doesn't have somehow an egg-info folder or file in site-packages, or that the project name is not what you are expecting ('wxpython') Look for that egg-info and search for the name of the project. In *egg-info/PKG-INFO or in egg-info itself. Tarek
Tarek Ziadé <ziade.tarek <at> gmail.com> writes:
On Fri, Nov 13, 2009 at 9:55 PM, cool-RR <cool-rr <at> cool-rr.com> wrote:
I'm having trouble using Distribute's pkg_resources.require(). I posted a question on StackOverflow: http://stackoverflow.com/questions/1728676/pkgresources-require-doesnt-see-
wxpython
I hope someone here has an answer. Thanks, Ram.
If pkg_resources doesn't find it, it might be that it doesn't have somehow an egg-info folder or file in site-packages, or that the project name is not what you are expecting ('wxpython')
Look for that egg-info and search for the name of the project. In *egg-info/PKG-INFO or in egg-info itself.
Tarek _______________________________________________ Distutils-SIG maillist - Distutils-SIG <at> python.org http://mail.python.org/mailman/listinfo/distutils-sig
Well, about the unexpected name thing, I don't think so, cause I printed the entire working_set and looked at the names one-by-one, and wxPython wasn't there in any kind of different name. I haven't investigated that egg-info thing, because it doesn't matter much to me what is the technical reason for this. The fact that `require` gave a false positive, and not even under any special circumstances, just a standard Windows installation of wxPython, is reason enough not to use it in my project. Also, before I came to this conclusion I noticed the kind of error that pkg_resources raises: pkg_resources.DistributionNotFound: my-dependency That is not too helpful. Yes, I noticed you have a todo comment on that error to make it more informative: raise DistributionNotFound(req) # XXX put more info here So here's a patch for you: raise DistributionNotFound('''The distribution %s is needed for this \ program, but it was not found on this system. Please search for it on the \ internet, then download and install it, then try this program again.''' % req) Because when a potential user has just downloaded my program and he's trying it out, the last thing I want to do is scare him away with an obscure error message. Ram.
On Sat, Nov 14, 2009 at 2:46 PM, Ram Rachum <cool-rr@cool-rr.com> wrote: [..]
I haven't investigated that egg-info thing, because it doesn't matter much to me what is the technical reason for this. The fact that `require` gave a false positive, and not even under any special circumstances, just a standard Windows installation of wxPython, is reason enough not to use it in my project.
What is your Python version ? Starting at Python 2.5, all distutils-based installers add an egg-info file or folder alongside the packages it installs in your system. If it's not present it could be a partial installation, or a bug. I would be interested in your feedback if you do investigate some more.
Also, before I came to this conclusion I noticed the kind of error that pkg_resources raises:
pkg_resources.DistributionNotFound: my-dependency
That is not too helpful. Yes, I noticed you have a todo comment on that error to make it more informative:
raise DistributionNotFound(req) # XXX put more info here
So here's a patch for you:
raise DistributionNotFound('''The distribution %s is needed for this \ program, but it was not found on this system. Please search for it on the \ internet, then download and install it, then try this program again.''' % req)
Because when a potential user has just downloaded my program and he's trying it out, the last thing I want to do is scare him away with an obscure error message.
Sure, that's helpfull. I am adding this in Distribute, for the 0.6.9 upcoming release. Tarek
What is your Python version ? Starting at Python 2.5, all distutils-based installers add an egg-info file or folder alongside the packages it installs in your system.
If it's not present it could be a partial installation, or a bug. I would be interested in your feedback if you do investigate some more.
I did it on 2.6, but then I tried also on 2.5 and 2.4, and it happened the same. I looked in site-packages and didn't find a egg, but I don't know much about eggs so I don't know. The way I installed wxPython is from the standard Windows installer that I downloaded from wxpython.org. You can give it a try yourself, install using their installer (Assuming you have access to a Windows box) and do the require thing. If it works for you then there will be reason to think something is fucked up in my system, and I'll investigate.
Sure, that's helpfull. I am adding this in Distribute, for the 0.6.9 upcoming release.
Great :) Ram.
On Sat, Nov 14, 2009 at 7:10 PM, cool-RR <cool-rr@cool-rr.com> wrote: [..]
I did it on 2.6, but then I tried also on 2.5 and 2.4, and it happened the same. I looked in site-packages and didn't find a egg, but I don't know much about eggs so I don't know.
we are looking for a file or a folder named "wxPython*.egg-info" or something like that, that is added alongside a "wxpython" package I guess. If you are not sure where to look at, do this in your prompt (supposing the package is called "wxpython")
import wxpython; wxpython
You will get the path of the package, and the egg-info is supposely located alongside this package.
The way I installed wxPython is from the standard Windows installer that I downloaded from wxpython.org. You can give it a try yourself, install using their installer (Assuming you have access to a Windows box) and do the require thing. If it works for you then there will be reason to think something is fucked up in my system, and I'll investigate.
I'll try in my VM when I get a chance.
Sure, that's helpfull. I am adding this in Distribute, for the 0.6.9 upcoming release.
Great :)
Ram. _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
-- Tarek Ziadé | http://ziade.org | オープンソースはすごい! | 开源传万世,因有你参与
import wxpython; wxpython
You will get the path of the package, and the egg-info is supposely located alongside this package.
(It's actually `wx` when you use it, not `wxpython`). I did that and got the path and searched around, but didn't find any egg. Ram.
participants (3)
-
cool-RR
-
Ram Rachum
-
Tarek Ziadé