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
Related
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.
I am trying to install Pandas for Python 3.4 for a Django project, however I get the error Unable to find vcvarsall.bat.
How can I install Pandas on Python 3.4 in Windows?
The easiest way to install Pandas, like almost every other package for Python, is with pip.
Many packages (including Pandas) require a compiler, and a bunch of third-party DLLs, and many Windows users don't know how to deal with that. That's exactly why the "wheel" format was created: so packages can upload pre-built binaries.
Not every project has pre-built binary wheels for Windows yet. But you can look at Christoph Gohlke's site and find wheels for all of the most popular ones. Just follow the instructions on that page to download the wheel file and install it with pip.
But in the case of Pandas, you don't have to do that. They have wheels on their download page, and uploaded to PyPI. And the documentation tells you to use these. (Well, it first suggests you use Anaconda/Miniconda, but if you want a stock Python, use pip and the packages on PyPI.)
Be aware that different versions of Python will need different version of Visual C++. I use Python 3.4 and it worked with Visual C++ 10. Most of what I read recommended version 8, which probably works with 2.7, but didn't work with 3.4
A very simple way of doing it would be to use pip, as suggested by abernert.
The command to be entered is :
pip install pandas
You will find pip in the scripts folder in your python folder. (eg. c:\python34\Scripts).
numpy will also be installed during this process.
I know this is late, but I'll just leave this here, since it is very similar.
I downloaded numpy1.9.0 but there is no EXE file in the package, how should I install it?
Numpy must be compiled for your system. You'll have to use a compiler to compile it if you want to use it from a download of the source code.
For compatibility with your system and other related or dependant packages, I recommend using a prepackaged distribution. (I get most of the Python data stack on Ubuntu with sudo apt-get install python-statsmodels.) For people with Windows who come to our Python meetup group and who have trouble installing things, we typically recommend getting the Python data stack distribution, Anaconda, from Continuum Analytics which will include Numpy. This link should take you to the versions for Python 3.4.
I would much rather you get everything you're likely to need at once as opposed to installing piecemeal different packages from various sources that may not work well together. If you just install Numpy, you're likely to want other packages that depend on it later, which is likely to give you problems if you're not using a package manager. I am unaware of a package manager for Windows, and it's probably out of scope to look for one.
(Disclaimer, Continuum Analytics sometimes sponsors and provides speakers for our meetup group, but I'm just a volunteer, and otherwise unconnnected to them.)
There are many versions of Python, and it becomes difficult to manage them all.
Often I need to install one module into 3 different versions of Python.
Is there a tool which can simplify things?
I'm on Windows.
Thanks.
Are you using virtualenv? If not, you definitely want to check that out: http://pypi.python.org/pypi/virtualenv
It helps you by managing and switching between several virtual Python environments, with different versions of Python if you want to.
There are loads of tutorials of how to set it up, all over dem interweb.
What Legogris said: use virtualenv.
I just answered a question on pip, virtualenv, and virtualenvwrapper applicable here. I highly recommend this combination of tools for maintaining isolated python environments.
As a further point, I strong recommend using the no-site-packages option so that each virtualenv has all its requirements in one place.
Because some modules contain binary code which is linked agains a specific Python version, it will not be possible to instal a module only once. You will always have to install it for each installed version. But if you use pip, you should have a look at pip: dealing with multiple Python versions? Just create a batch file which calls pip for each installed version. That should at least simplify your life.
I'm not aware of any Python facility for doing that, that's really the OS's job. Debian/Ubuntu, for example, has support for installing multiple versions of Python and installing libraries into each version. I doubt there's any such support in Windows.
A colleague of mine wants to use my python 2 code on his OS X (10.6) machine. My code imports several built-in python packages, including Tkinter and shelve, and also uses third-party packages, including numpy, scipy, matplotlib, and ipython.
I've encountered a few problems with OS X's built-in python. (IDLE doesn't work, for example*). I suspect I should install a more recent version of python, and a different version of Tk.
My questions:
Will having two different versions of python/Tk on the same machine cause problems?
I would like to associate the terminal commands 'python', 'ipython', and 'easy_install' with the more recent version of python. How should I do this?
When I install third-party packages like numpy using a .dmg file, how do I control which version of python numpy installs into?
Is there a better way to do this?
If this process goes well, I'd consider adding OS X instructions to my code's documentation, so I'd like to boil down this process to the simplest, most general approach.
*EDIT: Also, this
EDIT: Thank you everyone for the useful answers. My colleague tried MacPorts, which seems to work well, but has a few speedbumps. First we had to install Xcode from the system install disk. This is not a fast or lightweight install (several GB). Luckily we still had the disk! Once Xcode was installed, MacPorts was easy to install. Python and the python subpackages we needed were also easy to install, but he told me this installation took several hours. Presumably this delay is due to compilation? He had an easy time setting the MacPorts python as default. However, I think we have to change the 'Python Launcher' application by hand, this seems to still default to the system python.
Even though he has a working system now, I'm tempted to ask him to try one of the other solutions. I'm not sure all of my code's potential users will tolerate a multi-hour, multi-gigabyte installation.
I use brew to install all my libraries/compilers/interpreters.
To install python try this:
brew install python
Then add Python's binaries directory to your $PATH in your ~/.profile:
export PATH=`brew --prefix python`/bin:$PATH
I'd recommend you to install pip, virtualenv and virtualenvwrapper to have better control over your environment too.
Have you tried ActivePython?
It includes a package manager (PyPM) that, by default, installs into your home directory (eg: ~/Library/Python/2.7). Main scripts get symlinked in /usr/local/bin; use the included pythonselect to set the active Python version.
You don't have to bother installing .dmg packages, as PyPM is a binary package manager ... therefore you can install non-pure Python packages like NumPy without having to compile things yourself.
ActivePython can use Apple's Tcl/Tk or, if installed, ActiveTcl.
A "simplest, most general approach" in your documentation could be:
Install ActivePython 2.7
Open Terminal and type pypm-2.7 install matplotlib ipython
Using MacPorts, you can install python 2.6, 2.7, 3.1 and 3.2 at the same time, with their own packages, without ever touching the built-in python.
numpy, scipy, matplotlib, and ipython are also available as ports for most of those python versions.
Moreover, if you install the python_select port, you'll be able:
to choose which one of those (plus the built-in python) is the "default" python;
to install python packages through easy_install/pip for the "selected" python, if they're not available as ports.
Add virtualenv to the mix, and you'll have a very, very flexible Python development environment.
As for your questions:
Q1: with MacPorts, no. while not a frequent user, I've installed and used matplotlib in 2.6 and 2.7, switching between the two using python_select.
Q2: easy_install, pip, ipython will be "linked" to the python they were installed by. (but see tip 1)
Q3: it's easier to install one of the py{26,27,xx}-numpy ports, or pip install numpy under your python_select'ed python.
Q4: well, MacPorts is the best thing I know after APT on Debian/Ubuntu... :-)
Now, two tips if you try MacPorts:
MacPorts cleanly installs ports separately from the OS X installation, in an /opt/local directory, and each python version is installed in a /opt/local/Library/Frameworks/Python.framework/Versions/{2.5,2.6,2.7,...} directory. Using python_select cleanly switch the "python" command using links. BUT... the Versions/{2.5,2.6,2.7,...}/bin directory, where python scripts are installed, is not added to the PATH. Just adding: export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH to your ~/.profile will always give you direct access to the scripts installed for the selected python.
to avoid bad surprises, I've added a echo Selected python is \"$(python_select -s)\" line to my ~/.profile, so I always know which is my currently selected python when opening a session... :-)
Regards,
Georges
In almost all cases, the best python to use is the one from http://python.org/. It sets up the paths correctly and doesn't overwrite anything. DMG package installs usually work automatically, as does python setup.py install, and it's not too hard to get setuptools to work. If you want per-user installs, it is easy to set up .pydistutils.cfg and python automatically recognizes the path install_lib = ~/Library/Python/$py_version_short/site-packages
An addendum regarding the usage of brew:
Since some time, brew install python will install python3.
If you intend to install python2, you want to use
brew install python#2
It is perfectly fine to install both python and python3 using brew!
Here is an old post that answers your questions too.
In general it is not a problem at all to have more than one python installation on your machine. You just have to watch out which one you are calling on the command line.
>> which python
... helps to identify where your python binary is located. The original Mac OS X python is usually at "/usr/bin/python"
I personally use the MacPorts python installation. It also supports you with the installation of modules. (see link above)
I have 4 versions of python on my MacBook Pro. 2 from the original install of OS X 10.6 and a subsequent update, then self installed copies of python 2.7 and 3.2. You can update the python command to point at any of the versions. They all install in separate directories and cause no problems with each other.
I'm not sure what will happen when you install from a .dmg file. I believe it will simply use whatever version python points to.
This post on superuser.com answers your questions on changing default paths.