I just got a new machine (osx-lion), and I'm in the process of trying to reinstall all of my tools. I'm trying to install NumPy and SciPy. I know that the version Apple ships isn't exactly what makes NumPy and SciPy happy, so I went to Python.org and installed the recommended version (2.7.3), which went smoothly. Now when I which python, it points to the new 2.7 version which was different than the one the machine came with. My PATH variable also contains the path to the 2.7 (python.org) version.
Then I downloaded NumPy and got the message:
numpy 1.6.1 cannot be installed on this disk. numpy requires python.org Python 2.6 to install.
So then I tried SciPy, and got the same message:
scipy 0.10.1 can't be installed on this disk. scipy requires python.org Python 2.6 to install.
After some googling, I see that the 2.6 required is just 2.6 or or greater, and I did install the Python.org version (2.7), but I must be missing something.
Edit - Just tried rebooting the machine in case there were some changes that needed a restart to take effect, but that didn't help.
Any help would be greatly appreciated. Thanks all.
A simple and easy way to install numpy and scipy without going through version conflicts is to use the Enthought python distribution. They have a free version that includes python and the two packages you want, and the iPython console that I like a lot. They also offer a more extensive distribution that is free only for academic use, otherwise you have to pay for it.
python.org recommends installing an updated version of python 2.x instead of the version that comes with OSX. Following this advice, I was able to get scipy and numpy to work without enthought. Here are the versions that I am using (some version numbers missing, my notes are not complete):
Python 2.7.2 from python.org (64 bit)
numpy/scipy (OSX 10.6 build)
ipython 0.12
readline
matplotlib
At the end of the day, enthought.com is the easiest way to install everything.
Install latest version of Xcode/devtools and fortran ( http://www.scipy.org/Installing_SciPy/Mac_OS_X ).
Confirm python version
python --version
Install pip
sudo easy_install pip
Install numpy
sudo pip install numpy
If it complains you have an older version of bumpy installed, upgrade it.
pip install numpy --upgrade
check how many tests it fails ;)
sudo pip install nose
python
import numpy as np
np.test('full')
If you have the OSX developer tools installed, you should be able to install from source without much trouble.
make sure you have setuptools/distribute installed in your Python.org installation: run distribute_setup.py from the new python
make sure you have the gfortran compiler for scipy. This is just brew install gfortran if you use Homebrew.
use the right easy_install to just do easy_install numpy; easy_install scipy. (Or, easy_install pip and then pip install numpy; pip install scipy.)
im not exactly sure how osx works, but if it prompts you for a directory select the one in which you installed python 2.7
you could also download numpy for 2.6 here: (via sourceforge)
http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/numpy-1.6.1-py2.6-python.org-macosx10.3.dmg/download
note: i was searching for a scipy for 2.6 when i came across this on their website:
"Note that the Mac OS X binaries work with the Python from python.org, not with the Python provided by Apple. "
I suggest using the superpack by https://twitter.com/fonnesbeck you can find the install script here http://fonnesbeck.github.io/ScipySuperpack/
Enthought's canopy is a lot of money for software they did not build themselves.
Related
How do I download and install matplotlib for Python 3.5 for my mac to use in Eclipse? My mac is running macOS High Sierra version 10.13.1. I can handle quantum mechanics and thermodynamics, but the whole downloading and installing and using new python programs/packages/libraries/stuff is so hopelessly confusing to me. Assume I don't know anything, because I don't.
For scientific work using Python I recommend using Anaconda. It has all relevant packages installed.
Follow these steps:
Download Anaconda
Double Click the File in your Download Folder
For further setup with Eclipse, follow these steps.
Given that you have Python3 already installed you could also try:
python3 -m pip install matplotlib
In my experience, it is wise to consider installing a package manager like Anaconda. For something like matplotlib however, using
pip install matplotlib should be more than sufficient. For your information, the Mac already has pip (a package management system) installed, so running the above command should be enough.
please help installing SciPy. I think i've tried almost any advice i could find, but still no luck.
I am using Mac High OS Sierra 10.13.1, python 3.7, trying to make this work for IntellIJ IDEA 2017.2 IDE. I have Xcode version 9.2 if that helps.
I've tried instaling from IDE, using package installer -> fails with error status code 1.
I've tried installing using pip3 install scipy
I've installed brew install gcc ( I have version 7.2.0 installed)
I've installed numpy.
I've tried to install using Macports as suggested on official site - didn't help.
I've tried to instal using brew install scipy.
I've tried to install using Conda. It installed somewhere to Conda Dir, but i still cannot access library from python file using import scipy, error: No module named scipy.
Looks like i am just going in loops now, can some one suggest any idea please?
Topics i researched:
SciPy build/install Mac Osx
Can't install Scipy through pip
"failed with error code 1" while installing scipy
Some other ones i lost links to.
Ok looks like i made it work.
This thread: helped me.
It appeared I was actaully able to install scipy package using conda. But my Python didn't see the package. So i had to:
Change Right Click on my project in IDE > Project > New > Python SDK > Add Local
Select Python in Conda dir. In my case it was /Users/[my user ]/miniconda3/bin/python3.6
Restart IDE just in case and my python script was able to see import scipy.
The downside of this - that I cannot install packages the clean way from IDE anymore for some reason. I.e. Tools > Manage Python Packages > + > doesn't find any. And I have to reinstall all the packages i had using conda install [package name] from terminal . But I am fine with it, as long as it works.
Hopefully my quest might be useful for someone.
I can download python 2.7.12 from python.org, and all python versions from 2.7.9 onwards are supposed to come with pip, but after installing it, using pip in the terminal does not work.
I am on macOS.
Have I installed pip, and if I have, how do I use it?
Here you have informations about pip:
https://packaging.python.org/installing/
normally python from python.org come with pip, maybe you should just update...
to update from terminal:
pip install -U pip setuptools
After when you need to install package, for example numpy, just do in a terminal:
pip install numpy
more informations here :
https://pip.pypa.io/en/stable/reference/pip_install/
you can also use conda install from anaconda as an alternative of pip :
http://conda.pydata.org/docs/get-started.html
Multiple instances of Python can coexist on your machine. Thus you could have installed Python 2.7.12 yet, when you call Python from terminal, you may be calling an older version.
To know which version you are using, type which python in terminal and look at its path. Then from Python in terminal, type
import sys
print(sys.version)
to get the exact version.
As Dadep says, I would recommend using conda to isolate your invironments if you have to play with multiple Python interpreters. Further conda simplifies 3rd party package installation process beyond doubt.
I'm trying to install numpy, matplotlib, and scipy in the right python version.
Initially I was testing with different python versions (3.2, 2.7, 2.6).
I removed all these versions using: How to uninstall Python 2.7 on a Mac OS X 10.6.4?
Afterwards, I reinstalled Python 2.7.11.
when I try to install numpy, matplotlib and scipy, using pip, I get the following message:
Requirement already satisfied (use --upgrade to upgrade) ...
In my terminal, I tried the following:
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ python
Python 2.7.11 (v2.7.11:.....)
.....
>>> import numpy
ImportError: No module named numpy
$ /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Python 2.7.10 (default, ......
.....
>>> import numpy
>>> numpy.__version__
'1.8.0rc1'
for some reason these packages got installed in 2.7.10 and not 2.7.11, which is the version I downloaded from python.org. Also, I don't even know how I got the 2.7.10 version.
How can I fix this issue?
You can also use macports (https://www.macports.org/) to install different versions of python, numpy, and matplotlib. It's really quite simple.
Alternatively, you can perhaps use anaconda (https://www.continuum.io/downloads), which uses conda, to achieve your goal.
I recommend using virtualenv (with virtualenvwrapper: https://virtualenvwrapper.readthedocs.org). It is very easy to setup and you'll have absolutely no problems in future when you deal with multiple Python installations.
I work with virtualenv for years now and create for each project a separate virtual environment, which is always clean and I never have to deal with PATH, PYTHONPATH or whatever.
If you followed the virtualenvwrapper installation guide, you can simply create for example one virtualenv for everyday work via:
mkvirtualenv common -p /Library/Frameworks/Python.framework/Versions/2.7/bin/python
this will create the virtualenv and automatically activate it, so you can instantly install the packages you want:
pip install matplotlib numpy scipy
and every time you want to use it you type:
workon common
As you see above, you can specify the python executable via the -p flag. Each virtualenv will be a completely fresh and independent Python installation where you can use pip to install whatever you want (without root access of course).
It is likely to mean that you used pip or easy_install from another python version.
When you install your modules, make sure to use the correct pip version.
It might be /usr/local/bin/pip2.7 for example.
If you install Anaconda from continuum.io, you'll get access to versions of many packages that have been tested to work with the version of Python that you are interested in working with. Here's the list that come with the current version of their distribution.
You also get access to conda, which is a package and environment manager. Think pip + virtualenv.
Once you have that, you can do
conda create -n my_env python=3.6 numpy pandas
This will install Python 3.6 and all of the dependencies for numpy and pandas into a virtual environment called my_env. Conda will make sure that you have the most up to date packages that work together.
To access your environment, you can do:
activate my_env
Now you're running Python in that environment with those installed packages. If you need more packages, you can either do conda install package_name. If conda can't find the package, you can still do pip install package_name.
Note that as an added bonus, you get an optimized and pre-compiled version of Numpy by way of the Intel MKL.
(From my comment on a previous answer)
I'd second the recommendation for going the Anaconda route.
Particularly if you're using Numpy or anything that depends on Numpy
(Pandas, Scipy, Sci-kit Learn). Continuum has access to the Intel MKL
which gives you significant optimizations and pre-compiled C code
specific to your operating system. docs.continuum.io/mkl-optimizations
from this site
http://matplotlib.sourceforge.net/users/installing.html#installing-from-source
tell us that the requirement is python 2.4 or later but not python3.
Now im working with python3 and i need some plot form matplotlib.
So how to solve it?
I'm sorry, but at the current time it's not supported.
If you feel brave, you can try with the Py3k SVN branch which reportedly works with a simple example. Be aware that there has been no update in the last 8 months on this though.
Of course, you'd be more than welcome to contribute to the porting to Python 3 if you could.
You could try the unofficial versions. Check this site:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Looking at the docs at the link it says the following is a dependency:
Python (>= 2.7 or >= 3.4)
You can download a version of Python that will work at:
https://www.python.org/downloads/windows/
I would go with the most recent release and a 64 bit version as certain libraries for data analysis do not run on the 32 bit version of Python.
The version of Python you download will come with pip which you can then use to install any libraries you need to do your work.
Make sure you have set your environment variables if you want to run your programs from the command line or bash terminal.
I installed matplotlib through the bash terminal with:
pip install matplotlib
Let me know if that helps.
To install matplotlib on windows, first, you have to install pip first to install pip on windows go to website
https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip
Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:
python get-pip.py
if pip is already installed, install matplotlib by writing in command prompt:
python -mpip install -U pip
python -mpip install -U matplotlib