I am trying to install OpenMDAO, which is an open source framework that uses python. So before I get to it, it needs 3 packages:
Fortran Compiler
NumPY
ScyPy
Which I did install using homebrew:
brew install gfortran
sudo easy_install-2.6 pip
sudo pip-2.6 install numpy
sudo pip-2.6 install scipy
Now, to install OpenMDAO, I'm supposed to be in the OpenMDAO folder and at that level I should run this script:
python go-openmdao-dev.py
But I keep getting this error:
ERROR: the following prerequisites could not be imported: ['scipy'].
So I was talking to the people at OpenMDAO, and it seems that I need to use is python2.6 - although I'm not certain, so my guess is that all the packages I installed are for python 2.7 which I downloaded since it was recommended in the python website.
The one that comes with Mac was not. So when I type in terminal the following:
python2.6
It actually runs that version. So at this point I don't know if I have to go run the script in python 2.6, but if so, I have no idea how to do it. I tried doing this and it did not work:
If anyone is familiar with the environment or just with python itself and has any suggestions, I'll really appreciate it.
This question was answered on the OpenMDAO support forum:
http://openmdao.org/forum/questions/744/error-the-following-prerequisites-could-not-be-imported-scipy
The solution was to install scipy and numpy for python2.7. The original poster first installed them for python2.6, but then ran the go-openmdao.py script with python2.7. Once all the pre-reqs were installed for 2.7, it worked.
I had the same problem after downloading scipy from a .dmg. I uninstalled, and then reinstalled from source: http://sourceforge.net/projects/scipy/files/scipy/0.12.0/ and then the openmdao installer recognized scipy.
This may be useful (from INSTALL.txt in scipy-0.12.0.tar.gz):
To test SciPy after installation (highly recommended), execute in
Python
>>> import scipy
>>> scipy.test()
To run the full test suite use
>>> scipy.test('full')
Please note that you must have version 0.10 or later of the 'nose'
test framework installed in order to run the tests. More information
about nose is available on the website__.
__ http://somethingaboutorange.com/mrl/projects/nose/
Related
I am trying to use scipy but when I import it with import scipy, it says "no module named scipy. I have used pip list to see if it is installed and it is, and i have tried pip install scipy but it just said that it was already installed. Does anyone know how to fix this?
SOLVED: ran the code with python3 instead of python
it is possible you have 2 versions of python installed, python2.7 or python3.x .. when you install stuff with pip and want to use it for a specific python version:
pip install scipy is for python 2.7, so its "python" in the terminal and "python x" to run scripts
pip3 install scipy is for python 3, so its "python3" in the terminal and "python3 x" to run scripts
in your case, you would be calling scripts like:
python pythonFile.py
you would be installing packages like:
pip install package
and you would be using python in the terminal with "python"
if that still doesn't work, for me solving that problem was updating numpy. not sure if it would be the same with you. hope this helped
I've been trying to install astropy and at the end of the installation I get this message:
Cannot uninstall 'numpy'. It is a distutils installed project and thus
we cannot accurately determine which files belong to it which would
lead to only a partial uninstall.
I have tried: pip uninstall numpy and then I get the same message.
I have Python 2.7.10 in a macOS High Sierra version 13.10.5
This doesn't directly answer your question, but that's because you're asking the wrong question.
Astropy requires Python 3.5 or 3.6. Trying to get it working with Apple's pre-installed Python 2.7 is a waste of time. You might be able to get an old version working this way, but not by using the installation instructions on astropy.org, and it won't be supported even if you do.
The easy solution is to just Install the latest Anaconda 5.x with Python 3.6, because it comes with Astropy built in.
The almost-as-easy solution is to install Python 3.6 from either a python.org binary installer, or Homebrew, and then use pip3 or, better, python3 -m pip to install everything, as explained on the Astropy install page.
Either way, before doing anything else, you want to get back to a clean slate. In particular, you do not want pip, or any other scripts, attached to Apple's Python 2.7; they will only cause confusion. Assuming you can't reinstall macOS from scratch, the best way to do this is:
Look in /Library/Python/2.7/site-packages and delete everything there except for README and Extras.pth.
Look in /usr/local/bin for symlinks to anything in that site-packages. (If you don't know much about using Unix, try this command: ls -l /usr/local/bin | grep 2.7.) You'll probably have pip and pip2.7 here, and probably nothing else. But whatever you have here, delete it.
Now, when you install Python 3.6, the only thing named pip anywhere will be that Python 3.6's pip. You still want to use pip3 or python3 -m pip, but if you screw up and type pip by accident, it won't break anything.
Also, you should strongly consider using a virtual environment. See the Python Packaging Authority's User Guide (or the Anaconda docs, if you went that way) for more on this.
One simple solution I found:
sudo -H pip install astropy --ignore-installed numpy
I also had this issue and couldn't get around it in a clean way, but this is what I did:
Inside the Lib folder search "numpy" for an egg_info file (eg. numpy-1.11.0.dev0_2329eae.egg-info).
In my case, this is what Pip was looking at to determine if a current version already exists. I deleted it, then ran normal
pip install numpy
and installed the newest version.
I don't recommend this because I don't understand what it's doing under the hood and it doesn't properly uninstall the old version which could be a recipe for trouble down the line, but if you're desperate like I was then maybe this is a solution for you.
I have both Python 2.7 and Python 3.4 (and have to have both because for the class I'm running, students have the option of using either). One student has used Python 2.7 and numpy for their project, but when I attempt to install numpy, it installs it to 3.4. I need to install it to 2.7.
I'm using numpy 1.9 from this site, which I'm told is also 2.7-specific: http://sourceforge.net/projects/numpy/files/NumPy/
However, nonetheless it still goes to the 3.4 folder. Copying it to Python 2.7 didn't work, obviously.
How do I do this?
I recommend installing with pip.
pip install numpy
If this doesn't work on windows then download the binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and convert it to a wheel before installing.
pip install wheel
wheel convert path/to/binary
pip install numpy_wheel
Pip is recommended because you can uninstall.
To check where you are installing to
pip -V
You may have an environmental variable path to the wrong pip.
Assuming that you are using, or at least you should use pip to install the library. You can specify the python version to be installed by changing the suffix, e.g. pip-2.7 install numpy.
pip install numpy
pip-2.7 install numpy
pip-3.4 install numpy
As an alternative, in case that you do not want to use pip is to download and install the library using setup with a similar technique.
python setup.py install
python2.7 setup.py install
python3.4 setup.py install
Your PATH isn't setup correctly.
C:> where pip
Should tell you which pip it is trying to use, and it is likely whichever one it found on your PATH first...
So, instead, you will want to run it as
C:> C:\mypython2install\pip.exe install numpy
Or, setup your path correctly. See here
Just one other note on issues like this. I had a similar problem with Python 2.7 libraries not being found, because I had miniconda installed for a Python virtual environment that was hijacking calls to python from other programs. After deleting the minconda directory in my home the problem went away and python libraries that were properly installed were found again.
Note-This answer is particularly for Windows PC which has both Python2 & Pyhton3 installed on it.
Both the versions of Python has their different directories somewhat like
"C:\Python27\" ----for python2
"C:\Python35\" ---- for python3
*(or it depends on what path you chose while installing Python**)*
pip GENERALLY exist under the directory "C:\Python**\Scripts"
there you can find exe files like:
pip.exe/pip2.exe/pip2.7.exe ----for python2
pip3.exe/pip3.5.exe ----for python3
to install packages on python2:
use
Python27\Scripts\pip2.exe install package_name
(where the 1st argument is the path of exe file, it might differ for your system)
to install packages on python3:
use
Python35\Scripts\pip3.exe install package_name
there is no need to uninstall any version of python to achieve the task.
I am trying to install the Scipy python stack, but having issues.
I have a new mac os with mavericks (10.9).
I have installed homebrew and am using brew to manage installations.
I used
% brew install python
then (I verified pip is from my homebrew installation)
% pip install numpy [this works]
% pip install scipy [this works]
% pip install matplotlib OR pip install http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz
Both fail with the same error. After checking the backend, I get
Fatal Python error: PyThreadState_Get: no current thread
The error message from mac os X (the pop up error window) shows errors very similar to those in the previous thread
Homebrew + Python on mac os x 10.8: Fatal Python error: PyThreadState_Get: no current thread importing mapnik
It seems I need to fix the python bindings, as some of them linked against the /System/Library python that ships with the mac. What is not clear to me from the above post is
which of the Binary Images need to be "re-linked"? all of them? some seem quite general an not related to matplotlib
how do I actually use install_name_tool to fix the link? As I mentioned, some seem quite general - do I really want to change the path? Do I cp the dylib from old to new?
I have also tried
brew uninstall python
and re-brewing, all to get the same error. I am trying not to use EPD because EPD installs its own libxml2 and others, which I need for other software I will install, and this has caused me problems on an old machine. I am open to considering a virtualenv, but was hoping to learn to just fix my current problem if possible.
Thanks,
Andre
PS, when pip install matplotlib`, the following warning appears, which seems odd because matplotlib is such a staple piece of software
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
This is an issue in pygtk. You can test it with brew (it should throw the same error):
brew test pygtk
I ran into the same problem, and got past that error with the following steps from https://github.com/mxcl/homebrew/issues/13654
brew rm py2cairo
brew install py2cairo
You can test that pygtk is working using brew test pygtk again.
I'm still having other problems getting pip install matplotlib to work, so you may also run into more problems, but that should get you past that particular issue.
I had the same problem, and after some experimentation it seems that installing under Python 3 works more reliably. i.e. this installed without error:
pip3 install matplotlib
I then had to re-install everything else using pip3, and make sure I was running under python3 at execution time.
brew install freetype
it works on mac os sierra!
I have Python 2.7, and I have distutils installed.
I downloaded the latest version of Scipy for win 32.
For the life of me, I do not understand how to install it.
From the directions on the site, it states:
If you already have Python installed, the easiest way to install Numpy
and Scipy is to download and install the binary distribution from
Download.
I have followed the above directions and downloaded this.
I cannot figure what to do now!
How do I finish getting scipy installed?
It looks like you've downloaded the source distribution, which you would normally install by doing:
python setup.py install
However, without the proper C compiler environment and other libraries, it will probably fail. I'm guessing you really wanted to download the Windows binaries .
You have to drill a little further down in the sourceforge site to find it.
try downloading the windows binary ...
http://sourceforge.net/projects/scipy/files/scipy/0.11.0/scipy-0.11.0-win32-superpack-python2.7.exe/download
You'll be well off installing setuptools. Makes installing almost anything python-related a breeze!
e.g.
easy_install scipy
There's another one called pip.
easy_install pip
pip install scipy
just open windows command prompt and go to the directory you have installed Python. e.g
c:\python34>
Once there, just type python -m pip install scipy and press enter