ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
340 stars 36 forks source link

psutil error: ImportError: No module named _psutil_osx #45

Closed ronaldoussoren closed 11 years ago

ronaldoussoren commented 12 years ago

Original report by Arturo Filastò (Bitbucket: hellais, GitHub: hellais).


There are problems in building psutil on OSX 10.7. It appears to copy the dynlibs to the appropriate directory, but it then fails to import it.

This is the script I am trying to build:

$ cat helloworld.py

import psutil
print psutil.cpu_times()

This is my setup.py:

$ cat setup.py

from distutils.core import setup
import py2app

setup(
      app=["helloworld.py"],
     )

$ python setup.py py2app

$ ./dist/helloworld.app/Contents/MacOS/helloworld

Traceback (most recent call last):
  File "/Users/y/Documents/code/building/osx/dist/helloworld.app/Contents/Resources/__boot__.py", line 50, in <module>
    _run('helloworld.py')
  File "/Users/y/Documents/code/building/osx/dist/helloworld.app/Contents/Resources/__boot__.py", line 47, in _run
    execfile(path, globals(), globals())
  File "/Users/y/Documents/code/building/osx/dist/helloworld.app/Contents/Resources/helloworld.py", line 9, in <module>
    import psutil
  File "psutil/__init__.pyc", line 77, in <module>
  File "psutil/_psosx.pyc", line 14, in <module>
ImportError: No module named _psutil_osx

If I look inside of the lib-dynload directory I see it there though:

$ ls dist/helloworld.app/Contents/Resources/lib/python2.7/lib-dynload/
_psutil_osx.so   _psutil_posix.so

cc @maker

ronaldoussoren commented 12 years ago

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


That's annoying. I've downloaded psutils and will try to reproduce the issue (and fix it) later this week.

ronaldoussoren commented 12 years ago

Original comment by Michele Orrù (Bitbucket: maker, GitHub: maker).


Thanks, Ronald!

ronaldoussoren commented 11 years ago

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


Could you test with the current repository version?

It works fine with psutil 0.6.1 on my machine (OSX 10.8, custom python 2.7 framework)