3

I am new to ubuntu and using ubuntu 14.04 on lenovo t410 with python-3.4 For installing Healpy I have followed following steps; I have installed pthon3-dev package using

    sudo apt-get install python3-dev

and python-vm-builder by:

    sudo apt-get install python-vm-builder

But when I install Healpy using the command:

    pip install healpy

it gives me following error:

error: command 'i686-linux-gnu-gcc' failed with exit status 1

error code 1 in /tmp/pip_build_sibte/healpy
    Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 27: ordinal not in range(128)

Any help to solve the problem?

Sibte Raza
  • 187
  • 1
  • 3
  • 7

2 Answers2

3

In Ubuntu 14.10 and later, python3-healpy can be installed from the default Ubuntu repositories. Open the terminal and type:

sudo apt install python3-healpy

I have successfully installed healpy in Ubuntu 14.04 by downloading the python3-healpy package for Ubuntu 14.10 16.04 because the python3-healpy package is not available in Ubuntu 14.04. I installed python3-healpy in Ubuntu 14.04 using the following steps:

  1. Download dependencues of healpy. From http://packages.ubuntu.com/xenial/libcfitsio2 choose your architecture, select your mirror, and download libcfitsio2. From http://packages.ubuntu.com/xenial/libhealpix-cxx0v5 choose your architecture, select your mirror, and download libhealpix-cxx0v5.

  2. Download healpy. From http://packages.ubuntu.com/xenial/python3-healpy choose your architecture, select your mirror, and download python3-healpy

  3. Install dependencies. From the terminal run:

    sudo apt install libgomp1 python3-numpy python3-pyfits python3-six python3-matplotlib idle3 
    

    If any of these packages are already installed, the terminal will give you a message about which packages are already installed and install only the other packages.

  4. Install libcfitsio2. Browse to the folder where you downloaded the libcfitsio2_3.370-5 .deb file, double-click it to open it for installation in the Ubuntu Software Center, and install it.

  5. Install libhealpix-cxx0v5. Browse to the folder where you downloaded the libhealpix-cxx0_3.11.2-7.1 .deb file, double-click it to open it for installation in the Ubuntu Software Center, and install it.

  6. Install python-healpy_1.8.1-1.1. Browse to the folder where you downloaded the python-healpy_1.8.1-1.1 .deb file, double-click it to open it for installation in the Ubuntu Software Center, and install it.

  7. Test python3-healpy. Open IDLE3 and test python3-healpy by running the following simple Python code:

    import healpy as hp
    hp.pix2ang(16, 1440)
    

    This code should return the following output:

    (1.5291175943723188, 0.0)
    
karel
  • 5,489
  • 46
  • 45
  • 50
  • 1
    @user3269913 I strongly advise you not to uninstall anything until you've had some additional experience with the graphics output, 2D graphs, 3D graphs, etc. In fact you may need to install additional packages as the need arises (IPython, for example). Leave a comment anytime to let me know how healpy is working out. – karel Aug 12 '14 at 23:53
  • If I install enthought canopy 1.4.1 on my linux machine then can I be able to access the previously installed pakages which are not in canopy? how? – Sibte Raza Aug 22 '14 at 02:14
  • From Enthought Knowledge Base:[Installing packages into Canopy User Python from the OS command line](https://support.enthought.com/hc/en-us/articles/204469690-Installing-packages-into-Canopy-User-Python-from-the-OS-command-line) – karel Nov 14 '16 at 10:08
1

As you can see from the traceback, /usr/bin/pip is using Python 2. Run

sudo apt-get install python3-pip

to install a /usr/bin/pip3 binary, then try running

sudo pip3 install healpy

and see if that gets you anywhere. Make sure you have python3-matplotlib and python3-numpy installed as well, as in my experience it's much easier (and faster) to install them through the package manager than through pip.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • 1
    Now another error occur: raise CalledProcessError(retcode, cmd) **subprocess.CalledProcessError: Command '['make', 'install']' returned non-zero exit status 2** – Sibte Raza Aug 12 '14 at 04:51
  • I have installed python3-matplotlib and numpy and working on them and desperately need healpy – Sibte Raza Aug 12 '14 at 05:00
  • @user3269913 try running `sudo apt-get install autoconf automake libtool pkg-config python3-cython` then rerun the `pip3` command. – MattDMo Aug 12 '14 at 14:15