Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.2.0 Fails to install on Ubuntu 14.04 with easy_install #677

Closed
nickveenhof opened this issue Sep 3, 2015 · 7 comments
Closed

3.2.0 Fails to install on Ubuntu 14.04 with easy_install #677

nickveenhof opened this issue Sep 3, 2015 · 7 comments

Comments

@nickveenhof
Copy link

3.1.1 installs just fine.

root@ip-10-0-2-186:/home/ubuntu# easy_install psutil=3.1.1
error: Not a URL, existing file, or requirement spec: 'psutil=3.1.1'
root@ip-10-0-2-186:/home/ubuntu# easy_install psutil==3.1.1
Searching for psutil==3.1.1
Reading https://pypi.python.org/simple/psutil/
Best match: psutil 3.1.1
Downloading https://pypi.python.org/packages/source/p/psutil/psutil-3.1.1.tar.gz#md5=b34360627efb429cb18a4a3143b18c8c
Processing psutil-3.1.1.tar.gz
Writing /tmp/easy_install-8PtSRs/psutil-3.1.1/setup.cfg
Running psutil-3.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8PtSRs/psutil-3.1.1/egg-dist-tmp-Q8ye13
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: manifest_maker: MANIFEST.in, line 18: 'recursive-include' expects <dir> <pattern1> <pattern2> ...

zip_safe flag not set; analyzing archive contents...
psutil.__init__: module references __file__
Adding psutil 3.1.1 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/psutil-3.1.1-py2.7-linux-x86_64.egg
Processing dependencies for psutil==3.1.1
Finished processing dependencies for psutil==3.1.1

When trying 3.2.0

root@ip-10-0-2-186:/home/ubuntu# easy_install psutil==3.2.0
Searching for psutil==3.2.0
Reading https://pypi.python.org/simple/psutil/
Best match: psutil 3.2.0
Downloading https://pypi.python.org/packages/source/p/psutil/psutil-3.2.0.tar.gz#md5=224c2bb432003d74d022ced4409df1bc
Processing psutil-3.2.0.tar.gz
Writing /tmp/easy_install-IRRDCd/psutil-3.2.0/setup.cfg
Running psutil-3.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-IRRDCd/psutil-3.2.0/egg-dist-tmp-3ewURn
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('setuptools==3.3', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1963, in main
    with_ei_usage(lambda:
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1950, in with_ei_usage
    return f()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1967, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 381, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 616, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 646, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 834, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1040, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1025, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 50, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 100, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 52, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 150, in <module>
  File "setup.py", line 144, in get_ethtool_macro
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 566, in compile
    depends, extra_postargs)
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 362, in _setup_compile
    self.mkpath(os.path.dirname(obj))
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 881, in mkpath
    mkpath(name, mode, dry_run=self.dry_run)
  File "/usr/lib/python2.7/distutils/dir_util.py", line 68, in mkpath
    log.info("creating %s", head)
  File "/usr/lib/python2.7/distutils/log.py", line 40, in info
    self._log(INFO, msg, args)
  File "/usr/lib/python2.7/distutils/log.py", line 30, in _log
    stream.write('%s\n' % msg)
TypeError: unicode argument expected, got 'str'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 124, in wrap
    return original(path,*args,**kw)
OSError: [Errno 2] No such file or directory: '/tmp/easy_install-IRRDCd/psutil-3.2.0/temp/tmpzcgy03.c'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 124, in wrap
    return original(path,*args,**kw)
OSError: [Errno 2] No such file or directory: '/tmp/easy_install-IRRDCd/psutil-3.2.0/temp/tmpzcgy03.c'

Perhaps I am missing another obvious issue but it seems 3.2.0 has bugs that prevent people from installing it.

@nickveenhof nickveenhof changed the title Fails to install on Ubuntu 14.04 with easy_install 3.2.0 Fails to install on Ubuntu 14.04 with easy_install Sep 3, 2015
@foosel
Copy link

foosel commented Sep 3, 2015

Same thing when running python setup.py install on a project which specifies psutil as dependency. Python 2.7 on both Raspbian and Windows 7. pip install psutil works fine though.

Considering the stack trace (unicode argument expected, got 'str' when trying to write to a stream from a log function) my guess would be that something about commit 8d66475 introduced that problem, but that's just based on the recent changes to setup.py and a shoot from the hip, haven't had time yet to test this theory.

edit mistakingly stated that Windows 7 was also making problems here, it doesn't.

@foosel
Copy link

foosel commented Sep 3, 2015

Minimal example of what I described above to reproduce:

from setuptools import setup

setup(
    name="PSUtil setup test",
    version="0.1",
    install_requires=["psutil==3.2.0"]
)

Saved as testsetup.py, yields this:

gina@pi ~ $ virtualenv psutilenv
New python executable in psutilenv/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
gina@pi ~ $ source psutilenv/bin/activate
(psutilenv)gina@pi ~ $ python testsetup.py install
running install
running bdist_egg
running egg_info
creating PSUtil_setup_test.egg-info
writing requirements to PSUtil_setup_test.egg-info/requires.txt
writing PSUtil_setup_test.egg-info/PKG-INFO
writing top-level names to PSUtil_setup_test.egg-info/top_level.txt
writing dependency_links to PSUtil_setup_test.egg-info/dependency_links.txt
writing manifest file 'PSUtil_setup_test.egg-info/SOURCES.txt'
reading manifest file 'PSUtil_setup_test.egg-info/SOURCES.txt'
writing manifest file 'PSUtil_setup_test.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv6l/egg
running install_lib
warning: install_lib: 'build/lib.linux-armv6l-2.7' does not exist -- no Python modules to install

creating build
creating build/bdist.linux-armv6l
creating build/bdist.linux-armv6l/egg
creating build/bdist.linux-armv6l/egg/EGG-INFO
copying PSUtil_setup_test.egg-info/PKG-INFO -> build/bdist.linux-armv6l/egg/EGG-INFO
copying PSUtil_setup_test.egg-info/SOURCES.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying PSUtil_setup_test.egg-info/dependency_links.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying PSUtil_setup_test.egg-info/requires.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying PSUtil_setup_test.egg-info/top_level.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/PSUtil_setup_test-0.1-py2.7.egg' and adding 'build/bdist.linux-armv6l/egg' to it
removing 'build/bdist.linux-armv6l/egg' (and everything under it)
Processing PSUtil_setup_test-0.1-py2.7.egg
creating /home/gina/psutilenv/lib/python2.7/site-packages/PSUtil_setup_test-0.1-py2.7.egg
Extracting PSUtil_setup_test-0.1-py2.7.egg to /home/gina/psutilenv/lib/python2.7/site-packages
Adding PSUtil-setup-test 0.1 to easy-install.pth file

Installed /home/gina/psutilenv/lib/python2.7/site-packages/PSUtil_setup_test-0.1-py2.7.egg
Processing dependencies for PSUtil-setup-test==0.1
Searching for psutil==3.2.0
Reading http://pypi.python.org/simple/psutil/
Best match: psutil 3.2.0
Downloading https://pypi.python.org/packages/source/p/psutil/psutil-3.2.0.tar.gz#md5=224c2bb432003d74d022ced4409df1bc
Processing psutil-3.2.0.tar.gz
Running psutil-3.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-UrWaM5/psutil-3.2.0/egg-dist-tmp-CulopJ
Traceback (most recent call last):
  File "testsetup.py", line 6, in <module>
    install_requires=["psutil==3.2.0"]
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/install.py", line 73, in run
    self.do_egg_install()
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/install.py", line 101, in do_egg_install
    cmd.run()
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 349, in run
    self.easy_install(spec, not self.no_deps)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 569, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 621, in install_item
    self.process_distribution(spec, dist, deps)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 673, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 576, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 821, in best_match
    return self.obtain(req, installer) # try and download/install
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 833, in obtain
    return installer(requirement)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 589, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 619, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 809, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 1086, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 1075, in run_setup
    run_setup(setup_script, args)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/sandbox.py", line 30, in run_setup
    lambda: execfile(
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/sandbox.py", line 72, in run
    return func()
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/sandbox.py", line 32, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 150, in <module>
  File "setup.py", line 144, in get_ethtool_macro
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 564, in compile
    depends, extra_postargs)
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 360, in _setup_compile
    self.mkpath(os.path.dirname(obj))
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 879, in mkpath
    mkpath(name, mode, dry_run=self.dry_run)
  File "/usr/lib/python2.7/distutils/dir_util.py", line 68, in mkpath
    log.info("creating %s", head)
  File "/usr/lib/python2.7/distutils/log.py", line 40, in info
    self._log(INFO, msg, args)
  File "/usr/lib/python2.7/distutils/log.py", line 30, in _log
    stream.write('%s\n' % msg)
TypeError: unicode argument expected, got 'str'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/sandbox.py", line 99, in wrap
    return original(path,*args,**kw)
OSError: [Errno 2] No such file or directory: '/tmp/easy_install-UrWaM5/psutil-3.2.0/temp/tmpbimSDK.c'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/gina/psutilenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/sandbox.py", line 99, in wrap
    return original(path,*args,**kw)
OSError: [Errno 2] No such file or directory: '/tmp/easy_install-UrWaM5/psutil-3.2.0/temp/tmpbimSDK.c'

Further digging with checkout and easy_install .:

(psutilenv)gina@pi ~ $ git clone https://github.com/giampaolo/psutil.git
Cloning into 'psutil'...
remote: Counting objects: 14186, done.
remote: Compressing objects: 100% (121/121), done.
remote: Total 14186 (delta 69), reused 0 (delta 0), pack-reused 14065
Receiving objects: 100% (14186/14186), 25.48 MiB | 793 KiB/s, done.
Resolving deltas: 100% (9842/9842), done.

(psutilenv)gina@pi ~/psutil $ git reset --hard release-3.2.0
HEAD is now at 6a5f980 pre-release updates

(psutilenv)gina@pi ~/psutil $ easy_install .

// Fails like above

(psutilenv)gina@pi ~/psutil $ git revert 8d66475bbeaa04aa6c4064ceadf0f4f176f5e03d

(psutilenv)gina@pi ~/psutil $ easy_install .
Processing .
Running setup.py -q bdist_egg --dist-dir /home/gina/psutil/egg-dist-tmp-9WTBqv
cc -c /home/gina/psutil/temp/tmpARW5tM.c -o home/gina/psutil/temp/tmpARW5tM.o
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: manifest_maker: MANIFEST.in, line 18: 'recursive-include' expects <dir> <pattern1> <pattern2> ...

zip_safe flag not set; analyzing archive contents...
psutil.__init__: module references __file__
psutil 3.2.0 is already the active version in easy-install.pth

Installed /home/gina/psutilenv/lib/python2.7/site-packages/psutil-3.2.0-py2.7-linux-armv6l.egg
Processing dependencies for psutil==3.2.0
Finished processing dependencies for psutil==3.2.0

So the culprit is indeed 8d66475

@foosel
Copy link

foosel commented Sep 3, 2015

This fixes it too:

diff --git a/setup.py b/setup.py
index 8922f0f..150b13f 100644
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,7 @@ def get_description():
 @contextlib.contextmanager
 def captured_output(stream_name):
     orig = getattr(sys, stream_name)
-    setattr(sys, stream_name, io.StringIO())
+    setattr(sys, stream_name, io.BytesIO())
     try:
         yield getattr(sys, stream_name)
     finally:

I don't have a Python 3 installation setup anywhere right now to test this against too, hence no PR, only a patch.

@giampaolo
Copy link
Owner

Can you please try e538b23?

@foosel
Copy link

foosel commented Sep 3, 2015

You, that works. Tested with both current HEAD and e538b23.

@giampaolo
Copy link
Owner

3.2.1 is out.

@nickveenhof
Copy link
Author

Great work all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants