can't install scipy on mac OS X - macos

I have numpy and matplot installed and working properly with python 2.7, but when I use pip to install scipy, I get this error.
numpy.distutils.npy_pkg_config.PkgNotFound: Could not find file(s) ['/usr/local/lib/python2.7/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini']
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/61/dpn0d5p51z19g5vypnmh3vfh0000gn/T/pip-build/scipy

There is no end to the amount of grief that you can run into when trying to install numpy, scipy, and matplotlib on Mac OS X. If you want to stay on the bleeding edge I would suggest downloading the git repositories and building each one.
If you don't need to be on the bleeding edge I would suggest, following the instructions on the SciPy web site:
http://www.scipy.org/Installing_SciPy/Mac_OS_X
Finally, there is the great work that Chris Fonnesbeck: At https://github.com/fonnesbeck/ScipySuperpack
The Fonnesbeck method has never failed for me.

I also was not able to install scipy using pip. However an option that has worked for me was using the .dmg package provided by scipy.org.
Important: you will have to update to the latest version of python in your Mac OS. That is, you can still use the Python 2.7, however it is necessary to update to the latest build which you can download at python.org.

I could suggest you to use some package manager for Mas OS X (for example macports). Using a kind of such system could avoid you from such things like manual resolving of dependencies, and so on.

Related

Unable to install the deepspeech library from pip. Can't find the module

I am attempting to install the Deepspeech library for Python on my Ubuntu 22.04 system.
I've created a virtual environment and then run pip install deepspeech. However, all I get back is the following error:
ERROR: Could not find a version that satisfies the requirement deepspeech (from versions: none)
ERROR: No matching distribution found for deepspeech
I can access deepspeech on tbe Pypi website so I know it's there. Could this have something to do with the fact that I'm running Python 3.10?
Any suggestions appreciated.
Thanks
yes, it seems the latest release is for 3.9 as seen in pip and this issue and the release notes
Perhaps try installing another python version alongside 3.10.
To be fair, if I were you I'd probably spin up a virtual machine instead of messing with my daily driver's python installations. Or find a different, maintained library.
Intuitively, it feels wrong to install another version, as ubuntu (or linux in general?) uses python as part of it's operation. (also mentioned in attached answer). If the "python3"/"python" symlinks somehow get remapped to the old version, it's gonna be problematic. be careful!

Is there a way to install Qutip on apple m1 macbook?

I bought a new apple m1 macbook pro. I installed python and other basic packages like numpy, scikit-learn and matplotlib though miniforge. When I tried installing qutip through conda it shows no such package exists on the osx-arm64 channel.
Is there a way to install the x86-64 version of Qutip through rosetta 2?
In short, yes. QuTip can be installed using rosetta. It is, however, not free of complications. I found myself in the same situation, with a new M1 mac.
In my case, I had to create a new installation of miniforge (THE x86_64 VERSION) and download every package (matplotlib, cython, numpy, scipy, jupyter and qutip). QuTiP could be found because I was using the standard channels instead of the new arm64 channel. In order to be able to import qutip some additional steps have to be taken. If one tries to import qutip a couple of errors appear, to which the solution has been given in https://github.com/qutip/qutip/issues/1396#issuecomment-759733240 .
Basically, you first need to install ipython. The following line worked for me: conda install -c anaconda ipython. Secondly, you have to find the hardware_info.py document in your qutip files. In my case it was in /diego/miniforge3/lib/python3.8/site-packages/qutip/hardware_info.py. Once found, comment the following lines:
results.update({'cpu_freq': int(float(os.popen('sysctl -n machdep.cpu.brand_string')
.readlines()[0].split('#')[1][:-4])*1000)})
With that done, I have a fully operational installation of jupyter notebook with qutip. Addressing the situation described in the question, I don't know if it is possible to download qutip from the regular x86_64 channels while having installed miniforge with the arm64 installer. Maybe someone who knows more than me can add further information about it.

AllenNLP Torch Version Unavailable

I am trying to install allennlp via pip on the latest version of macOS Catalina. The Python version is 3.9.0. The pip version is 20.2.4.
I was just able to install only a couple of weeks ago, but now I receive the following error when I run the command:
pip3 install allennlp allennlp-models
ERROR: No matching distribution found for torch<1.8.0,>=1.6.0 (from allennlp)
This is really bad because a time-sensitive project I am working on right now completely depends on allennlp working. I needed to reinstall due to some git issues, and my virtual env was reset. What can I do to resolve this issue?
Thanks.
EDIT: Somehow I ended up uninstalling 3.9 in homebrew and now I'm stuck at jsonnet. It errors out. I saw some posts about this issue, but none of the recommendations work.
EDIT2: I tried reinstalling brew's python 3.9. jsonnet standalone works again, but then I have the pytorch issue again.
I'm stuck in a loop. Neither the system macOS 3.8 python nor the latest 3.9 home-brew python works. I'd rather get the home-brew python working, but there's no valid version of torch available for that one apparently.
Do NOT accidentally use home-brew to download the latest Python 3.9. That isn't compatible with a lot of the required libraries.
Phew.

TensorFlow dependencies needed. How to run TensorFlow on Windows

I am interested in getting TensorFlow to run on Windows, however at present I realize that this is not possible due to some of the dependencies not being usable with Windows, e.g. Bazel.
The need arises because as I currently understand it the only way to access the GPU from TensorFlow is via a non-virtual install of Linux. I do realize I can dual boot into a Linux install, but would prefer to avoid that route.
To resolve the problem I am in need of the entire dependency chain to build TensorFlow as was wondering if this already existed.
I also realize that I can capture the build output when building from source as a solid start, but would like to avoid that work if it is already known.
There is a beta of Bazel that runs on Windows - https://github.com/dslomov/bazel-windows
See related GitHub Issue to run TensorFlow on Windows. - https://github.com/tensorflow/tensorflow/issues/17
Another reason to run on Windows is the possibility to port to Xbox One.
I found a possible answer, still need to check it. This will generate a dependency graph as a dot file.
$ bazel query 'deps(//tensorflow/tools/pip_package:build_pip_package)' --output graph > tensorflow.dependency.dot
There are now three main options for building and/or running TensorFlow on Windows:
You can install a GPU-enabled PIP package of TensorFlow 0.12rc0 from PyPI: pip install tensorflow-gpu
You can build the GPU-enabled PIP package yourself using the experimental CMake build. This also gives you the ability to work with TensorFlow in Visual Studio. The documentation for this build can be found here.
There is preliminary support for building TensorFlow using Bazel for Windows. However, we are still ironing out some bugs with this build.
This may not be exactly what you want one way to run TensorFlow under Windows is to install a virtual machine (VMWare player v12 is free to use for non-commercial) and then install Ubuntu in that and finally TensorFlow in Ubuntu. Works well for me.
Since the begin of 2017, Tensorflow is now officially supported on Windows and can be installed via pip:
pip install --upgrade tensorflow
pip install --upgrade tensorflow-gpu
or by fetching packages directly (pick the one that matches your needs, e.g. x64/gpu)
# x86 / CPU
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl
# x64 / CPU
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_amd64.whl
# x64 / GPU
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.0-cp35-cp35m-win_amd64.whl

Install Numpy on Mac OS X Lion 10.7

I need to install Numpy on my Mac OS X Lion 10.7. I googled a little bit, it seems like there are a lot of stuff needs to be installed. And some says I need install Xcode before I install Numpy. But the official website of Numpy doesn't give much information about installing Numpy on Mac. I really don't want to install Xcode as it would cost a lot space.
So anyone knows how to install Numpy? What's the prerequisites?
Thanks,
Lion comes with numpy installed. It should already be there:
$ python -c 'import numpy, numpy.version; print numpy, numpy.version.version'
<module 'numpy' from '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.py'> 1.5.1
For anyone that hits this from google, here is where I figured out how to build numpy on Mac OS.
http://www.scipy.org/Installing_SciPy/Mac_OS_X
On lion, it amounts to setting some environment variables (after Xcode is installed):
export CC=gcc-4.2
export CXX=g++-4.2
export FFLAGS=-ff2c
Then pip install numpy works just fine.
I have used a few software packages that require a fresh install of NumPy, that won't work with the built in NumPy or even with the built-in Python. The easiest way to install NumPy on the mac is to download any of these packages. This will work for most OS versions.
Python 2.7
Python 2.6
Python 2.5
Still the other answers are valid, though this is a more general answer.
This is the SourceForge page of the project.
If you do install Xcode you can get the latest and greatest open source libraries and packages. Consider using the excellent Mac Ports (http://www.macports.org) project. It is a package manager that will download source packages and their dependencies and build all the libraries and tools for you.
Installing Numpy becomes a one line command once Xcode and mac ports is installed:
sudo port install py27-numpy
The easiest way that I found was to visit http://sourceforge.net/projects/numpy/files/NumPy/, pick the folder of the latest version, and then download the .dmg file that matched my installed version of Python.
Based on this post, I found that Chris Fonnesbeck keeps a highly functional installer script for OSX 10.7 at the OSX SuperPack Github site.
Because I hapened to have all the dependencies (such as gfortran) already, I did not use his full shell script. Rather I just did
git clone --depth=1 git://github.com/fonnesbeck/ScipySuperpack.git
python -m easy_install -N -Z ScipySuperpack/*.egg
And it worked beautifully. In particular, it worked better than the .dmg files from the official numpy and scipy distributions, and better than pip install.
You can install numpy/scipy using pip, If pip is not installed on your machine, you can install it with easy_install:
sudo easy_install pip
Then install numpy:
sudo pip install numpy
A very easy route is to install Anaconda from Continuum, or Enthought's Canopy. These are python distributions that include numpy, as well as other useful scientific computing libraries
Generally, unless you have a good reason you might want to avoid trying to have to build numpy/scipy et al. yourself.
For Mac's there are two nice everything-included packages for numerical python. Enthough distribution (paid, http://www.enthought.com/) and Sagemath (free, http://www.sagemath.org/). I'm happily using Sagemath on 10.7 - it has numpy, scipy etc.

Resources