py2app - ImportError using pycrypto

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

py2app - ImportError using pycrypto

Terry Simons
Hi,

I'm using py2applet to build a tool that uses paramiko/pycrypto.

Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found.

It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly.

I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place?

The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches.

Here's the error that I'm seeing:

4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py", line 69, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/transport.py", line 32, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/util.py", line 32, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/common.py", line 98, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py", line 29, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py", line 35, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py", line 30, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 18, in <module>
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 15, in __load
4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found

Thanks for any suggestions.

- Terry
_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: py2app - ImportError using pycrypto

Ronald Oussoren
Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use?

Ronald

On 11 Apr, 2012, at 10:51, Terry Simons wrote:

> Hi,
>
> I'm using py2applet to build a tool that uses paramiko/pycrypto.
>
> Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found.
>
> It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly.
>
> I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place?
>
> The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches.
>
> Here's the error that I'm seeing:
>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py", line 69, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/transport.py", line 32, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/util.py", line 32, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/common.py", line 98, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py", line 29, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py", line 35, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py", line 30, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 18, in <module>
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 15, in __load
> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found
>
> Thanks for any suggestions.
>
> - Terry
> _______________________________________________
> Pythonmac-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: py2app - ImportError using pycrypto

Terry Simons
I'm using py2app 0.6.4 with the system python 2.7.1 on Mac OS X 10.7.3.

- Terry

On Apr 11, 2012, at 2:17 AM, Ronald Oussoren wrote:

> Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use?
>
> Ronald
>
> On 11 Apr, 2012, at 10:51, Terry Simons wrote:
>
>> Hi,
>>
>> I'm using py2applet to build a tool that uses paramiko/pycrypto.
>>
>> Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found.
>>
>> It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly.
>>
>> I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place?
>>
>> The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches.
>>
>> Here's the error that I'm seeing:
>>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py", line 69, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/transport.py", line 32, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/util.py", line 32, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/common.py", line 98, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py", line 29, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py", line 35, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py", line 30, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 18, in <module>
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 15, in __load
>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found
>>
>> Thanks for any suggestions.
>>
>> - Terry
>> _______________________________________________
>> Pythonmac-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: py2app - ImportError using pycrypto

Terry Simons
I found a way to solve my issue.

I was poking around with pygame, which has the same shared object load problems.

I stumbled across this:  http://www.rkblog.rk.edu.pl/w/p/building-mac-os-x-applications-py2app/

And something in there fixed my problem... specifically this:

        You have to edit Contents/Resources/__boot__.py and add in function def _run(*scripts): (near end of file) and add after imports this line:

        sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.5', 'lib-dynload')] + sys.path


I added that, but changed "python2.5" to "python2.7" and it fixed the issue.

I think clearly this isn't the right fix, but it does seem to get my shared objects loading.  Is there any way to get this to happen automatically?

Any idea what's actually going on here?  Why does this fix the issue, and what are possible solutions other than hand-editing the __boot__.py?

Thanks!

- Terry

On Apr 11, 2012, at 9:13 AM, Terry Simons wrote:

> I'm using py2app 0.6.4 with the system python 2.7.1 on Mac OS X 10.7.3.
>
> - Terry
>
> On Apr 11, 2012, at 2:17 AM, Ronald Oussoren wrote:
>
>> Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use?
>>
>> Ronald
>>
>> On 11 Apr, 2012, at 10:51, Terry Simons wrote:
>>
>>> Hi,
>>>
>>> I'm using py2applet to build a tool that uses paramiko/pycrypto.
>>>
>>> Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found.
>>>
>>> It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly.
>>>
>>> I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place?
>>>
>>> The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches.
>>>
>>> Here's the error that I'm seeing:
>>>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py", line 69, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/transport.py", line 32, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/util.py", line 32, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/common.py", line 98, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py", line 29, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py", line 35, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py", line 30, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 18, in <module>
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 15, in __load
>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found
>>>
>>> Thanks for any suggestions.
>>>
>>> - Terry
>>> _______________________________________________
>>> Pythonmac-SIG maillist  -  [hidden email]
>>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>>
>

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: py2app - ImportError using pycrypto

Ronald Oussoren

On 12 Apr, 2012, at 8:59, Terry Simons wrote:

> I found a way to solve my issue.
>
> I was poking around with pygame, which has the same shared object load problems.
>
> I stumbled across this:  http://www.rkblog.rk.edu.pl/w/p/building-mac-os-x-applications-py2app/
>
> And something in there fixed my problem... specifically this:
>
> You have to edit Contents/Resources/__boot__.py and add in function def _run(*scripts): (near end of file) and add after imports this line:
>
> sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.5', 'lib-dynload')] + sys.path
>
>
> I added that, but changed "python2.5" to "python2.7" and it fixed the issue.
>
> I think clearly this isn't the right fix, but it does seem to get my shared objects loading.  Is there any way to get this to happen automatically?
>
> Any idea what's actually going on here?  Why does this fix the issue, and what are possible solutions other than hand-editing the __boot__.py?
I haven't had time to look into this yet, py2app should have generated a correct sys.path this definitely looks like a bug on my end. There have been changes in py2app in the last couple of releases to deal with simular problems, but those changes obviously didn't fix the real issue.

Ronald

>
> Thanks!
>
> - Terry
>
> On Apr 11, 2012, at 9:13 AM, Terry Simons wrote:
>
>> I'm using py2app 0.6.4 with the system python 2.7.1 on Mac OS X 10.7.3.
>>
>> - Terry
>>
>> On Apr 11, 2012, at 2:17 AM, Ronald Oussoren wrote:
>>
>>> Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use?
>>>
>>> Ronald
>>>
>>> On 11 Apr, 2012, at 10:51, Terry Simons wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm using py2applet to build a tool that uses paramiko/pycrypto.
>>>>
>>>> Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found.
>>>>
>>>> It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly.
>>>>
>>>> I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place?
>>>>
>>>> The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches.
>>>>
>>>> Here's the error that I'm seeing:
>>>>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py", line 69, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/transport.py", line 32, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/util.py", line 32, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/paramiko/common.py", line 98, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py", line 29, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py", line 35, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py", line 30, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 18, in <module>
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example:   File "Crypto/Util/_counter.pyc", line 15, in __load
>>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found
>>>>
>>>> Thanks for any suggestions.
>>>>
>>>> - Terry
>>>> _______________________________________________
>>>> Pythonmac-SIG maillist  -  [hidden email]
>>>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>>>
>>
>

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

smime.p7s (6K) Download Attachment