6

I'm using Python 3.3.5 with cx-freeze 4.3.3 on windows 8.1.

I'm trying to cx_freeze a program that uses pkg_resources.

I initially had it in my setup file under packages, but when I tried to freeze it the processes stopped with an error Import Error: No module named 'pkg_resources'.

enter image description here

I then moved it in the setup file from packages to includes. The cx_freeze process completed this time but when I tried to start the application I got another error message.

enter image description here

If I go to my IDE and try to import pkg_resources it works fine.

>>> import pkg_resources
>>> pkg_resources
<module 'pkg_resources' from 'C:\\Python33\\lib\\site-packages\\setuptools-18.0.1-py3.3.egg\\pkg_resources\\__init__.py'>

There's a similar question asked here, and the solution is to re-install setuptools. So I downloaded setuptools 18.0.1 and installed it via cmd, but it did not solve my problem and I'm still getting the same errors with cx_freeze.

Any help getting this to work would be greatly appreciated.

Edit: My solution (hack) has been to write the dependency out of yagmail. Yagmail's original _innit__.py...

from pkg_resources import get_distribution
__project__ = 'yagmail'
__version__ = get_distribution(__project__).version

I first put a print statement in there to get the version, and then hard coded it.

__project__ = 'yagmail'
__version__ = '0.4.84'

Though this has solved my problem it isn't really the answer, so will leave this open should someone have a solution that keeps pkg_resources.

Community
  • 1
  • 1
I_do_python
  • 1,366
  • 4
  • 16
  • 31
  • It was very difficult to find this one for me, it would have been possible to post it at [yagmail's github](https://github.com/kootenpv/yagmail). I'll make sure to hand write the version number whenever I post a "stable" version. Also, there is now a "yagmail" tag here, so that would also be easier for me to monitor :) – PascalVKooten Jul 11 '15 at 16:06
  • Is this a yagmail issue though? It looks more like a cx-freeze problem. It just so happened to be yagmail that was using the pkg_resources module. – I_do_python Jul 11 '15 at 16:26
  • My versioning is not the most standard way to do it, so I do feel responsible. But you're right, I guess it is only related. – PascalVKooten Jul 11 '15 at 23:08

0 Answers0