11

Update: I tried @user2258766 suggestion on miniconda. It was initially very promising. But, when I have installed scipy numpy matplotlib sympy, the miniconda folder size quickly grows to 1G.

enter image description here

Does this mean that the minimal size of the installation is 1G if I want to use the 4 packages I mentioned. Why they are so large? Is it still possible to shrink the installation size further?

enter image description here

--

The Scipy website recommended Anaconda.

But it installs so many un-relevant packages for me.

Is there a smallest distribution I can use?

I only want Scipy, Sympy, Numpy, and Maplotlib, not others.

Another relevant questions is, why there are so many dependencies between these Python packages?

I was programming in Java, and now feel a little bit uncomfortable to see these Python packages (Scipy e.g.) are so tightly relatively to so many other packages. Why is that the case? A reasonable explanation could possible make more comfortable to start coding in Python.

Thanks.

I am using Windows. Thanks. I was using Java and am new to Python.

Changwang Zhang
  • 2,467
  • 7
  • 38
  • 64
  • 3
    Why not just download Python itself and install the only libraries you need? – Ffisegydd Apr 30 '14 at 19:15
  • The [official scipy site](http://www.scipy.org/install.html#individual-binary-and-source-packages) has a list of individual binaries (all of the ones you give are listed). Follow each link and download each package individually. Alternatively, you could use [easy_install](http://pythonhosted.org/setuptools/easy_install.html). – wflynny Apr 30 '14 at 19:16
  • 2
    i bet conda is saving the archived libraries so that you won't need to download them again in the event that you create different but similar environment – Paul H Apr 30 '14 at 20:14
  • @PaulH Thanks for the suggestion. I am not sure whether that is the case. I am just a little bit disappointed for my first try in Python. Maybe I should just accept it that Python should be at least 1G to work for me. Such a pity. Maybe I should re-consider whether I should change from my current Java+Gnuplot+maxima to Python. – Changwang Zhang Apr 30 '14 at 20:22
  • you can surely clear out that cache, manually or otherwise – Paul H Apr 30 '14 at 20:26
  • `conda clean -a` should remove about 100-300 MB of unused tar.bz2 archive files. See https://stackoverflow.com/questions/40241133/how-to-reduce-the-number-of-files-in-the-anaconda-directory – Mr-IDE Dec 06 '17 at 10:52

3 Answers3

6

I'd suggest downloading miniconda: http://conda.pydata.org/miniconda.html#miniconda. Miniconda has a small footprint -- only python and conda are installed. Conda is a universal package manager for Python available on all OSes. You can now run the following:

conda create -n dev_env scipy numpy matplotlib sympy

The above will create a contained environment (named dev_env) with only the packages listed in the command. For more information on conda: http://conda.pydata.org/

quasiben
  • 1,444
  • 1
  • 11
  • 19
  • 3
    I tried miniconda. It was initially very promising. But, when I have installed scipy numpy matplotlib sympy, the miniconda folder size quickly grows to 1G. While the full Anaconda-1.9.2 is 1.3G after installation. ... ... – Changwang Zhang Apr 30 '14 at 19:55
  • 1
    Hmm, that seems odd. I just tired this and my directory is reasonable 237M /Users/quasiben/anaconda/envs/dev_env/ – quasiben Apr 30 '14 at 20:01
  • That means, I must have done something wrong...But there are only two steps right. 1) install miniconda, 2) run the command you give me "conda create -n dev_env scipy numpy matplotlib sympy". I can not be wrong, can I? – Changwang Zhang Apr 30 '14 at 20:02
  • The initial size of the Miniconda is small: 64MB before running "conda create". – Changwang Zhang Apr 30 '14 at 20:04
  • 3
    @Leo, you are correct. I apologize for my somewhat glib remark earlier. I can confirm the size of the installed pkgs does bring the total size to +1GB. You can reduce the footprint a bit by calling `conda clean --tarballs` and `conda clean --packages`. This reduced my footprint to 500MB which is expected. SciPy is ~200MB Numpy: ~100MB PySide: ~200MB... – quasiben Apr 30 '14 at 22:13
  • 4
    Maybe whatever you are using to measure the size is counting hardlinks twice. Conda installs packages by unpacking the tarballs in the `pkgs` directory and then hard linking them to the install environment. Hard links take up no additional hard disk space, but a naive method of counting hard disk space will count the same file multiple times. – asmeurer Apr 30 '14 at 22:30
5

Use these commands to reduce the install size of Python libraries, by removing unnecessary downloaded package files:

# Remove about 100-300 MB of unused tar.bz2 archive files
# https://stackoverflow.com/questions/40241133
conda clean --all

# Manually delete about 1-2GB of downloaded packages, after install. See:
# https://groups.google.com/a/continuum.io/d/msg/anaconda/CZjcQKVmIgo/Xx3tYBYzCgAJ
du -sh /path/to/Miniconda/pkgs/  # Just display the folder size
rm -rf /path/to/Miniconda/pkgs/

# Manually delete the useless Pip cache of downloaded files. See:
# https://stackoverflow.com/questions/9510474/removing-pips-cache
rm -rf ~/.cache/pip           # Linux
rm -rf ~/Library/Caches/pip/  # Mac OS X
del %LocalAppData%\pip\Cache  # Windows

Direct links for info:

Mr-IDE
  • 7,051
  • 1
  • 53
  • 59
2

Just install python and individually install each library.

This site has windows installers for all the packages you mentioned:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Ryan
  • 3,555
  • 1
  • 22
  • 36
  • 2
    It's worth noting that `matplotlib` has several dependencies that also need to be installed, plus several other optional ones, depending on what you're using it for. – MattDMo Apr 30 '14 at 19:23