Comments you submit will be routed for moderation. If you have an account, please log in first.
Modify

Ticket #309 (assigned defect)

Opened 2 years ago

Last modified 6 weeks ago

pycrypto on osx not working (as unpacked egg)

Reported by: mgenti Owned by: matysek
Priority: normal Milestone: PyInstaller 2.2
Component: Platform Mac Version:
Severity: normal Keywords:
Cc:

Description

I have an application that I am trying to bundle on the Mac but I can't seem to get pycrypto to work correctly. I'm using python 2.5 and pycrypto 2.0.1 with pyinstaller svn rev 1295. I tried the pycrypto test in the buidtests directory, but when I add the following to the spec file it fails:

app = BUNDLE(coll,
             name="blah",
             version="2.4.21")

Here is the error I am getting:

building BUNDLE outBUNDLE5.toc
Traceback (most recent call last):
  File "/Users/mgenti/pyinstaller/Build.py", line 1538, in <module>
    main(args[0], configfilename=opts.configfile)
  File "/Users/mgenti/pyinstaller/Build.py", line 1516, in main
    build(specfile)
  File "/Users/mgenti/pyinstaller/Build.py", line 1421, in build
    execfile(spec)
  File "test-pycrypto.spec", line 27, in <module>
    version="2.4.21")
  File "/Users/mgenti/pyinstaller/Build.py", line 1186, in __init__
    self.__postinit__()
  File "/Users/mgenti/pyinstaller/Build.py", line 298, in __postinit__
    self.assemble()
  File "/Users/mgenti/pyinstaller/Build.py", line 1252, in assemble
    shutil.copy2(fnm, tofnm)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py", line 96, in copy2
    copyfile(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py", line 51, in copyfile
    fsrc = open(src, 'rb')
IOError: [Errno 20] Not a directory: '/Library/Python/2.5/site-packages/pycrypto-2.0.1-py2.5-macosx-10.6-i386.egg/Crypto/Cipher/AES.so'

It looks to me like it is trying to copy a file out of an egg which it can't do.

Attachments

Change History

comment:1 Changed 2 years ago by matysek

  • Milestone set to PyInstaller 1.6

comment:2 Changed 2 years ago by ben@…

I'm also getting an error, although it occurs at runtime:

[...]
File "build/bdist.macosx-10.6-x86_64/egg/Crypto/Random/Fortuna/SHAd256.py", line 38, in <module>
  File "/Users/bk/Devel/pyinstaller/PyInstaller/iu.py", line 472, in importHook
    mod = self.doimport(nm, ctx, ctx+'.'+nm)
  File "/Users/bk/Devel/pyinstaller/PyInstaller/iu.py", line 516, in doimport
    exec co in mod.__dict__
  File "build/bdist.macosx-10.6-x86_64/egg/Crypto/Hash/SHA256.py", line 7, in <module>
  File "build/bdist.macosx-10.6-x86_64/egg/Crypto/Hash/SHA256.py", line 6, in __bootstrap__
ImportError: dlopen(build/bdist.macosx-10.6-x86_64/egg/Crypto/Hash/SHA256.so, 2): image not found

This is using Python 2.7.1 and recent pyinstaller SVN.

comment:3 Changed 2 years ago by anonymous

I forgot to mention that this application freezes and runs without problems on win32.

comment:4 Changed 2 years ago by matysek

Does the pycrypto test work on mac? The pycrypto test could be run by

cd PYINSTALLER_TRUNK
cd buildtests
pytho runtests.py test-pycrypto

What is the output of this command? Is there still the same error?

comment:5 Changed 2 years ago by ben@…

I get the following:

bk:~/Devel/pyinstaller/buildtests $python2.7 -OO ./runtests.py test-pycrypto

[...]

#################### EXECUTING TEST test-pycrypto ####################

RUNNING: dist/test-pycrypto/test-pycrypto.exe
Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/Users/bk/Devel/pyinstaller/PyInstaller/iu.py", line 472, in importHook
    mod = self.doimport(nm, ctx, ctx+'.'+nm)
  File "/Users/bk/Devel/pyinstaller/PyInstaller/iu.py", line 516, in doimport
    exec co in mod.__dict__
  File "build/bdist.macosx-10.6-x86_64/egg/Crypto/Cipher/AES.py", line 7, in <module>
  File "build/bdist.macosx-10.6-x86_64/egg/Crypto/Cipher/AES.py", line 3, in __bootstrap__
  File "/Users/bk/Devel/pyinstaller/PyInstaller/iu.py", line 450, in importHook
    raise ImportError, "No module named %s" % fqname
ImportError: No module named pkg_resources
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TEST test-pycrypto FAILED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{'failed': ['test-pycrypto'], 'passed': [], 'skipped': []}

However distribute is installed (via MacPorts? -- py27-distribute) and pkg_resources imports cleanly:

bk:~/Devel/pyinstaller/buildtests $python2.7
Python 2.7.1 (r271:86832, May 10 2011, 22:05:44) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> quit()

comment:6 Changed 2 years ago by matysek

This issue seems to be related to #183 (issue with pkg_resources). PyInstaller? can't work with pkg_resources.

comment:7 Changed 2 years ago by ben@…

So it turns out that the problem is that, on OS X, pycrypto installs an additional egg into site-packages which apparently confuses PyInstaller?. After removing the pycrypto egg and egg-info files the app freezes and runs correctly.

comment:8 Changed 16 months ago by htgoebel

  • Component changed from PyInstaller to Platform Mac

comment:9 Changed 13 months ago by matysek

I think this is related to the issue that PyInstaller? does not support unpacked eggs at the moment.

comment:10 Changed 13 months ago by matysek

  • Owner changed from giovannibajo to matysek
  • Status changed from new to assigned

comment:11 Changed 12 months ago by matysek

  • Milestone changed from PyInstaller 2.0 to PyInstaller 2.1

comment:12 Changed 6 weeks ago by matysek

  • Priority changed from high to normal
  • Summary changed from pycrypto not working on mac to pycrypto on osx not working (as unpacked egg)
  • Severity changed from blocker to normal
  • Milestone changed from PyInstaller 2.1 to PyInstaller 2.2
View

Add a comment

Modify Ticket

Action
as assigned
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.