pythonbrew icon indicating copy to clipboard operation
pythonbrew copied to clipboard

Pythonbrew fails to install distribute

Open thedrow opened this issue 13 years ago • 6 comments

root@omer-VirtualBox:~/.pythonbrew/dists# python3 distribute_setup.py 
Extracting in /tmp/tmp3udj3v
Traceback (most recent call last):
  File "distribute_setup.py", line 494, in <module>
    main(sys.argv[1:])
  File "distribute_setup.py", line 490, in main
    _install(tarball, _build_install_args(argv))
  File "distribute_setup.py", line 73, in _install
    tar = tarfile.open(tarball)
  File "/home/omer/.pythonbrew/pythons/Python-3.2/lib/python3.2/tarfile.py", line 1744, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

I tried it on 2.7.2 as well. Same result.

Tried running with sudo and without sudo. Same results.

I'm on ubuntu 11.10.

thedrow avatar Apr 03 '12 17:04 thedrow

Turns out that on Ubuntu you have to run the following script:

sudo apt-get install build-essential
sudo apt-get install libncursesw5-dev
sudo apt-get install libreadline-gplv2-dev
sudo apt-get install libssl-dev
sudo apt-get install libgdbm-dev
sudo apt-get install libbz2-dev
sudo apt-get install libc6-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install tk-dev

This gets all the dependencies that python uses to build itself. You can cherrypick them but for distribute zlib and bz2 (I'm not sure about bz2) are a must. This should be specified in the docs.

If python still doesn't recognize zlib and fails to install distribute try installing dpkg-dev as the python install script uses it to find out where libz.so is.

sudo apt-get install dpkg-dev

thedrow avatar Apr 03 '12 19:04 thedrow

I have failed to get setuptools instaled for 2.7.x versions of brewed pythons. No matter if I do it manually or omitting --no-setuptools command I get this output on my environment:

Installing Python-2.7.3 into /home/amer/.pythonbrew/pythons/Python-2.7.3 Downloading distribute_setup.py as /home/amer/.pythonbrew/dists/distribute_setup.py ######################################################################## 100,0% Installing distribute into /home/amer/.pythonbrew/pythons/Python-2.7.3 ERROR: Failed to install setuptools. See /home/amer/.pythonbrew/build.log to see why. Skip installation of setuptools.

Installed Python-2.7.3 successfully. Run the following command to switch to Python-2.7.3. pythonbrew switch 2.7.3 Switched to Python-2.7.3 asking libproxy about url 'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg' libproxy suggest to use 'direct://' --2012-08-05 21:51:02-- http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg Resolving pypi.python.org (pypi.python.org)... 82.94.164.168 Connecting to pypi.python.org (pypi.python.org)|82.94.164.168|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 332005 (324K) [application/octet-stream] Saving to: `setuptools-0.6c11-py2.7.egg'

100%[===================================================================================================================================================>] 332.005 541K/s in 0,6s

2012-08-05 21:51:02 (541 KB/s) - `setuptools-0.6c11-py2.7.egg' saved [332005/332005]

sh: ./setuptools--0.6c9-py2.7.egg: No such file or directory Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to [:<exec_prefix>] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Traceback (most recent call last): File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site.py", line 563, in main() File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site.py", line 545, in main known_paths = addusersitepackages(known_paths) File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site.py", line 278, in addusersitepackages user_site = getusersitepackages() File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site.py", line 253, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site.py", line 243, in getuserbase USER_BASE = get_config_var('userbase') File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/sysconfig.py", line 521, in get_config_var return get_config_vars().get(name) File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/sysconfig.py", line 420, in get_config_vars _init_posix(_CONFIG_VARS) File "/home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/sysconfig.py", line 288, in _init_posix raise IOError(msg) IOError: invalid Python installation: unable to open /home/amer/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/config/Makefile (No such file or directory)

azec-pdx avatar Aug 05 '12 22:08 azec-pdx

On Debian Squeeze, installing libbz2-dev and zlib1g-dev (and rebuilding 2.7.3) solved the issue.

mbenedettini avatar Apr 02 '13 15:04 mbenedettini

libssl-dev is also needed for httplib to support https connections

mbenedettini avatar Apr 02 '13 15:04 mbenedettini

Can confirm that installing libbz2-dev zlib1g-dev has fixed the problem.

hartmut27 avatar Apr 14 '13 21:04 hartmut27

I have the same problem when installing Python 2.5 with --configure="--enable-shared", even after installing all those dependencies. I'm running Debian GNU/Linus 5.0.

Running python distribute_setup.py works OK.

cristiandreica avatar Jun 03 '13 06:06 cristiandreica