[SciPy-User] How to install scipy in virtualenv+python3+unbuntu12.04?

zzzhhh zhou_heng at yahoo.com
Wed Nov 20 20:48:22 EST 2013


Andreas Hilboll <lists <at> hilboll.de> writes:

> 
> On 20.11.2013 23:15, zzzhhh wrote:
> > Thomas Kluyver <takowl <at> gmail.com> writes:
> > 
> >>
> >>
> >>
> >> On 20 November 2013 03:39, Evgeni Burovski <evgeny.burovskiy <at> 
> > gmail.com> wrote:An easy trick is to first install it system-wide using 
apt-
> > get to satisfy non-python dependencies, then install it manually in 
> > virtualenv, run the test suite to make sure it works all right. After 
that 
> > apt-get remove packages installed in step one.
> >>
> >>
> >>
> >>
> >> You probably want to 'apt-get build-dep python3-scipy', rather than 
> > simply installing it. That will install the packages required to 
compile 
> > it, whereas installing it will only get runtime dependencies.
> >>
> >> Thomas
> >>
> >>
> >>
> >> _______________________________________________
> >> SciPy-User mailing list
> >> SciPy-User <at> scipy.org
> >> http://mail.scipy.org/mailman/listinfo/scipy-user
> >>
> > 
> > Thank you, but, after excuting the following commands (in order) in 
> > virtualenv:
> > 
> > sudo apt-get install python3-scipy
> > sudo apt-get build-dep python3-scipy
> > sudo pip install scipy
> > 
> > , I did successfully installed scipy because I was told "Successfully 
> > installed scipy". But in python3, when I input "import scipy", an error 
> > says "ImportError: No module named scipy". Could you please tell me if 
I 
> > missed something? Should I apt-get remove the global package? Thanks a 
lot!
> > 
> > Heng
> > 
> > 
> > 
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User <at> scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> > 
> 
> Don't do "sudo pip install scipy". Do "pip install scipy" within the
> virtualenv (i.e. after executing "source /path/to/venv/bin/activate". If
> you call "sudo pip install scipy", the root user executes "pip install
> scipy", and the root user doesn't have the virtualenv enabled.
> 
> Cheers, Andreas.
> 

Thank you very much! I finally made it! Thank Andreas Hilboll, thank Thomas 
Kluyver, thank Evgeni Burovski, thank everyone who helped me, I loved you!

Here I summarize all the steps as follows:

In ubuntu 12.04 server that comes only with python 2.7, to install a 
python3 virtual environment that doesn't conflict with python2, and scipy 
package that can be used by python3, run the following commands:

sudo apt-get install python-pip
sudo pip install virtualenv
sudo apt-get install python3
virtualenv -p /usr/bin/python3 py3env
. py3env/bin/activate
sudo apt-get install python3-scipy
sudo apt-get build-dep python3-scipy
pip install numpy
pip install scipy

Now you are all set. Finally a small hint: to find where the python3 is, 
type: whereis python3.

Thank you all again!

Heng Zhou









More information about the SciPy-User mailing list