Question

So I got python3.3.2 from source easy install-3.3 and I'm trying to get them to work nicely, but I'm having an issue in one of the servers. In Ubuntu I just do this:

# Install python 3.3.2
cd /tmp/
wget http://www.python.org/ftp/python/3.3.2/Python-3.3.2.tar.bz2
tar xvf Python-3.3.2.tar.bz2
cd Python-3.3.2/
./configure --prefix=/usr/
make
make test
sudo make install

To get python to work... this is fine, then:

# Install easy_install for python 3.3.2
cd /tmp/
wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
tar xzvf distribute-0.6.49.tar.gz
cd distribute-0.6.49
sudo python3 setup.py build
sudo python3 setup.py install

And then I can see something weird on the output:

...

Extracting distribute-0.6.49-py3.3.egg to /usr/bin/lib/python3.3/site-packages
distribute 0.6.49 is already the active version in easy-install.pth
Installing easy_install script to /usr/bin/bin
Installing easy_install-3.3 script to /usr/bin/bin

...

Why is easy_install getting placed in /usr/bin/bin???? WTH??

Also, everything I install with easy_install goes there:

sudo easy_install-3.3 gunicorn
Searching for gunicorn
Best match: gunicorn 18.0
Processing gunicorn-18.0-py3.3.egg
gunicorn 18.0 is already the active version in easy-install.pth
Installing gunicorn_django script to /usr/bin/bin
Installing gunicorn script to /usr/bin/bin
Installing gunicorn_paster script to /usr/bin/bin

Using /usr/bin/lib/python3.3/site-packages/gunicorn-18.0-py3.3.egg
Processing dependencies for gunicorn
Finished processing dependencies for gunicorn

Although:

which python3 and which easy_install-3.3 both point to /usr/bin as expected!

Surely all the binaries are there but they are not reachable on PATH... and I don't want to edit my PATH env variable... any ideas on what is going on??

Was it helpful?

Solution

I completely nuked my python installation! and now it is working. I do not have a clue what was happening but stackoverflow users care about solving thinks first... here is what I did:

  1. Clear every single trail of python3... BEWARE WITH THIS COMMANDS, THEY WILL BLOW UP YOUR PYTHON3 INSTALLATION.

    sudo apt-get remove python3
    sudo apt-get remove python3.2*
    sudo apt-get remove python3.3*
    sudo apt-get remove python3.4*
    sudo apt-get remove python-sphinx
    sudo apt-get autoremove
    sudo rm -rf /usr/bin/bin/
    sudo rm -rf /usr/lib/python3*
    sudo rm /usr/bin/python3*
    sudo reboot
    
  2. Reinstall the dependencies to build python

    sudo apt-get build-dep -y python3 python-setuptools

  3. I install 3.3.3 since 3.3.2 was giving me issues with some tests.

    cd /tmp/
    wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.bz2
    tar xvf Python-3.3.3.tar.bz2
    cd Python-3.3.3/
    ./configure --prefix=/usr/
    make
    make test
    sudo make install
    python3 --version
    
  4. Now easy_install!!!

    cd /tmp/
    wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
    tar xzvf distribute-0.6.49.tar.gz
    cd distribute-0.6.49
    sudo python3 setup.py build
    sudo python3 setup.py install
    
  5. Fix some permission issues up

    sudo chmod +r /usr/lib/python3.3/site-packages/python_dateutil-*-py3.3.egg/EGG-INFO/top_level.txt
    sudo chmod +r /usr/lib/python3.3/site-packages/python3_digest-1.8b4-py3.3.egg/EGG-INFO/top_level.txt
    mkdir -p $HOME/.config/ipython
    sudo chown -R $USER:$USER $HOME/.config/ipython
    sudo chmod g+w $HOME/.config/ipython
    sudo ln -sf /usr/bin/ipython3 /usr/bin/ipython  # this is more for me... maybe you don't want this one... it will open ipython3 on `ipython` command.
    
  6. Try it!

    sudo easy_install-3.3 ipython gunicorn
    

And everything is in order now!

Adding gunicorn 18.0 to easy-install.pth file
Installing gunicorn script to /usr/bin
Installing gunicorn_django script to /usr/bin
Installing gunicorn_paster script to /usr/bin

Check that /usr/bin out!!!! Don't you just wanna lick it!?

Ha!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top