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

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.

Related

Spyder/Anaconda Navigator will not launch after Installing Geopandas

I'm trying to integrate geopandas, plotly, and shply onto my workbench to make some statistical analysis and visualization easier. I have successfully integrated plotly after using the:
conda install -c plotly plotly
comand in my anaconda prompt. However, when I repeat the process for geopandas
conda install -c conda-forge geopandas
my spyder client and anaconda clients no longer open.
I have tried a few clean uninstall/re-install of the latest anaconda distribution package, but have yet to find a fix. Do I need to create separate environments to work in? How would I go about this? Thank you in advance
(Spyder maintainer here) This kind of problem is usually caused by mixing packages from different channels. In your case, you're mixing packages from the plotly, conda-forge and defaults channels. In particular, defaults (the packages provided by default in Anaconda) and conda-forge are binary incompatible because their packages are compiled differently.
To avoid this, you need to uninstall and reinstall Anaconda because you corrupted it. Then you can simply run
conda install plotly geopandas
given that these two packages are part of the defaults channel.

Installing PyML and PyBrain with the Anaconda packages under OSX 10.10

Forgive me in case this too easy a question.
Background:
I installed Python 3 and Anaconda as I want to start programming Python and want to dive into machine learning.
Unfortunately all this shell based installation thing is absolutely new to me.
I managed to install python 3.6. and Ananconda 3.
Problem(s):
Unfortunately now I have several Python instances installed. One with Anaconda under user/anaconda and some under library/Python/
Now I need for a course to install PyML and PyBrain. I tried to it the "normal way". i.e. what is written on the webpage and as so often I get multiple errors during the installation.
Goal:
I'd like to have it under the Anaconda packages. Is there a way to do that?
If no: how can I get my other Python 3.6. installation to know the location of the Anaconda packages?
edit 12.08.17
The content of $PATH:
/Users/ak/anaconda/bin:/Users/ak/miniconda2/bin:/Users/ak/miniconda3/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/ak/.rbenv/shims:/Library/Frameworks/EPD64.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/ak/Library/Application Support/GoodSync:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/ak/.rvm/bin
edit 12.08.17 - 2:
When I try to "conda" this libraries this happens though I started it from the unzipped, downloaded PyML:
AKs-MacBook-Pro:PyML-0.7.14 ak$ conda install -c manmadescience pyml
Fetching package metadata ...........
PackageNotFoundError: Packages missing in current channels:
pyml
And when I do this: conda install -c manmadescience pyml (found here https://anaconda.org/manmadescience/pyml)
I get the same result.

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

can't install scipy on mac OS X

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.

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