Does installing Python also install libraries like scipy and numpy? - python

I just got a new computer, and I was installing some Python libraries. When I tried to install numpy, I got a message on the console saying numpy was already downloaded. I went into the library folder, and not only was numpy there, but scipy, matplotlib, and a bunch of other libraries as well. How is this possible, considering this computer is brand new? I had installed Python the previous evening, so does installing Python automatically install these libraries as well?

It depends on which Python package you install.
On any desktop oriented Linux distribution, installing the Python package will only install Python. And in practice, it is generally already installed.
On Windows (and perhaps OS X), you need to pick a Python bundle somewhere. Perhaps did you choose Anaconda, which AFAIK installs a lot of common Python libraries (as opposed to its light version Miniconda).

Python does not ship with these libraries unless you are using a pre-packaged distribution such as Anaconda.

If you copied your data from your previous computer to this one, you may have copied the python installation (and thereby the libraries you had installed before) in your appdata folder.
Another possibility is that you have install Anaconda, which is targeted especially at scientific things, and comes with numpy, scipy and some other things preinstalled.

Although this is not the place for these types of questions, yes, there is no need to install libraries, as most of the times when you download Python in a distribution, such as Anaconda, they are also included.

Related

Is it possible to use custom build cpython in Anaconda environment?

I build a cpython locally (Windows) with a fix to a problem with multiprocessing that I have, but I also need data science stack of packages like numpy, pandas, scipy, matplotlib, statsmodels and few others. When I try to install them the process appears quite cubersome for many packages and for scipy I wasn't able to resolve it after 3 days of trying.
I was thinking that it would be amazing if I can just replace python in my anaconda env, and use conda to install the packages I need. Is it possible to easily replace python with binaries I have or I need to wait while my fix is released with new Python version?
I was able to resolve my issue by replacing only python DLL that I had in, and the conda environment just worked with it

Import Error: no module named numpy (numpy already installed)

I have a question which is very similar to Import Error: No module named numpy but the answer to that question I do not believe would be appropriate for me, so I'm asking again.
This is my most recent effort after about six hours of trying to get modules to work in python (numpy is a dependency of something else), so I'm finally turning to SO. Part of efforts in the last six hours included installing the enthought distribution, as its large volume of libraries was highly advised for windows users. I've even thrown the location of numpy folder onto the path of environment variables just to exclude it as a possibility.
Windows, 64bit, Python 2.7
Since you are on windows, I highly recommend that you install ANACONDA. This way the environment variables are set automatically and you don't need to worry about anything else. There are many useful packages (e.g. numpy, sympy, scipy) which are bundled with anaconda.
Moreover, based on personal experience I can tell you that using pip on windows and compiling from source (you need visual studio) is a pain in the neck sometimes. That's why ANACONDA has been conceived.
Hope this helps.
For python versions > 3.4 ,do this
pip install numpy beacuse pip is python dependency which installs packages just like npm in js i.e. node.js

How do I install Numpy for Python 2.7 on Windows?

I am trying to install numpy for python 2.7, I've downloaded the zip, unzipped it and was expecting a Windows download file (.exe), but there isn't one.
Which of these files do I use to install it?
I tried running the setup.py file but don't seem to be getting anywhere.
Thanks!!!
There is .exe file in SourceForge. This is this link below:
http://sourceforge.net/projects/numpy/files/NumPy/1.9.1/numpy-1.9.1-win32-superpack-python2.7.exe/download
Python on Windows, including rather complex science/math/statistics package builds? It should just work? Seriously, use a third-party distribution! There are plenty and they only exist as of the hassle you were observing.
While the other two answers are "okay", it would recommend another approach. Especially for the common Windows user the following approach is easy to maintain and easy to reproduce.
Let me quote from the SciPy website:
For most users, especially on Windows and Mac, the easiest way to
install the packages of the SciPy stack is to download one of these
Python distributions, which includes all the key packages:
[a list of Python distributions]
As you can see, people having experience with this topic tend to recommend using a third-party Python distribution.
I have so far used ActivePython, but Anaconda also appears to be a well-maintained project.
Whichever you take: it comes as a nice Windows installer and will give you a seamless Python experience.
You can find a very well maintained list of Python Libraries (including numpy) for Windows at this Homepage: http://www.lfd.uci.edu/~gohlke/pythonlibs/
Wasted a lot of time trying to install on Windows from various binaries and installers, which all seemed to install a broken version, until I found that this worked: navigate to the python install directory and do python .\site-packages\pip install numpy

What version of scipy and matplotlib should I install on Mac Mountain Lion?

I wish to install python numpy, scipy, and matplotlib packages. I used the following:
sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose
I was able to install and run numpy, but not scipy or matplotlib. I get an error, "No module named scipy", even though installation appeared to proceed normally. I suspect that this has something to do with the version of scipy and bumpy. I am running OS X Version 10.8.4, python 2.7.2 and numpy 1.6.1. I suspect the problem is either the version or the directory which scipy is installed; scipy is in /Users/myname/src/scipy. I couldn't find out where numpy is located (how can this be done? Spotlight search does not indicate file directory, and grep hangs). How can I install scipy and other packages?
It's hard to be 100% sure without a little more information, but I'm 99% sure…
Your problem is that you're installing all this stuff for the MacPorts Python, but then trying to run Apple's Python, which doesn't have any of it installed. (Part of the reason I suspect this is that Apple's Python is version 2.7.2, while MacPorts has been on 2.7.5 for a long time now. The other part of the reason is that this is exactly the same kind of problem people have when they install two different Python X.Y versions without realizing that's what they're doing.)
If you want to use the MacPorts Python, run /opt/local/bin/python instead of just python.
If you know what you're doing, you can change your PATH, or create a symlink, etc., but I suspect you will just confuse yourself further.
I personally think you'd be a lot happier just sticking to Apple's Python. You need to install a Fortran compiler with MacPorts (or Homebrew, or manually, or …), but to install Python packages, just use pip.
(At this point, that last bit of advice probably won't help you, as the first pip on your PATH is probably the MacPorts one, and doesn't match the first python on your PATH. But if you're willing to start over, just port uninstall python, and then look at these blog posts or the dozens of related questions here on SO.)

python 2.7 not installing matplotlib

Hi I'm trying to install matplotlib on my mac. I have lion OS X.
my python version is 2.7.1 ( this is what it says when I run it from terminal)
every time I install matplotlib, it promots this error
matplotlib 1.1.0 cannot be installed on this disk. matplotlib requires System python 2.7 to install.
I'm new to the python world and I need a tool to graph a few things... so a clear explanation is much appreciated.
Thanks!
You are installing a binary package which is going to expect a specific system python. You are better off building from source.
Just try installing it from pip:
pip install numpy
pip install matplotlib
If you do not yet have pip, you can install it like this:
wget "http://peak.telecommunity.com/dist/ez_setup.py"
python ez_setup.py
easy_install pip
If any of this fails, then follow #Nolen Royalty's guide that he mentioned in the comments
I've tried installing python in various different ways to get numpy, scipy, and matplotlib to all work together, and its a huge pain. Your exact version of python will dictate the version of numpy, scipy, and matlplotlib that will work for you.
By far, the easiest solution I have found is to use the pre-built package Enthought. It takes care of all of those problems with one easy installer. You might get some additional software installed like mayavi (an interactive 3d plotting tool), but its not too much.
If you are a student (or have ever been one since the dawn of email), you can download the entire Enthought package for free here. Or you can visit the Enthought home at www.enthought.com. All you have to do is select the academic license and then insert a email that ends in .edu.
I even think there are free trial versions which should solve the issue. I've never tried any of the trial versions, but even if it is a limited time trial, you should be able to use the trial version, and then see exactly which versions of each package you need to install. Its a little more roundabout, but it should work.
I tried to install numpy, scipy, and matplolib on my Mac Book Pro running Lion many times and they all failed. Nolen's recipe cam pretty close, but some of the matplotlib tests were failing in strange ways. The method that worked for me can be found on the page Installing Python, virtualenv, NumPy, SciPy, matplotlib and IPython on Lion
Since you list you are new to Python, I recommend installing matplotlib with MacPorts. First install macports
http://www.macports.org/install.php
then execute
port install py27-matplotlib
A couple of years ago there were some extra steps, but now it is this simple. You need to make sure you set your environment for the macports python, but that is provided in the documentation.
Have Fun!

Categories

Resources