MacOS Sierra - brew installs graph-tool with openmp disabled - openmp

Running brew install graph-tool on MacOs 10.13.4 does install graph-tool but openmp seems disabled.
Am I missing a brew option to have openmp enabled?
I did run brew install libomp prior to installing graph-tool.
Python 3.7.2 (default, Dec 27 2018, 07:35:52)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import graph_tool as gt
>>> gt.openmp_enabled()
False
>>>

Related

Unable to install python3.7.x in mac

I am pretty new in mac version 12.6 . I tried to install python 3.7 in my mac for trying out some legacy project but I am unable to.
I tried two was downloading the .pkg file from python.org and also by pyenv
While the .pkg says successfully installed and pyenv versions gives me 3.7.13 .
While trying python3.7 or python3 from terminal I am getting
% python3
zsh: killed python3
% python3.7
zsh: killed python3.7
But my other versions working fine like
% python3.9
Python 3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
How to fix this isssue.
I usually use pyenv to install and manage Python versions. (You can install it using Homebrew)
1- pyenv install 3.7.0
#To see the list of the Python versions
2- pyenv versions
#To set the newly installed version as the default
3- pyenv global 3.7.0
Now, run python3 --version
if the output is NOT 3.7.0 then you need to add the following lines to your .zsh or .zshrc file:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
and finally update your .zsh or .zshrc file:
source .zshrc or source .zsh

How to install ipython or flask and there dependences in virtualenv?

I have learned the dependences should be installed automatically, but it only install itself when I install flask in a virtualenv.
Installing collected packages: flask
Successfully installed flask-0.12.2
➜ ~ python
Python 3.6.2 (default, Sep 15 2017, 07:44:18)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from flask import Flask
Trceback...
...
ModuleNotFoundError: No module named 'werkzeug'
Then I have to install werkzeug and re-import Flask
but:
ModuleNotFoundError: No module named 'jinja2'
After install jinja2, there still markupsafe, itsdangerous (etc) to install to run Flask.
Solved
I forgot when did I set 'no-dependences = True' in .pip/pip.conf.
Now it's okey after detele the line.
My suspicion is that you've either
installed packages into virtualenv but receive these errors when the virtualenv is not activated i.e. when interpreter has no access to those packages
or
vice versa i.e. installed packages globally and then activated virtualenv, where by default the only pre-installed packages are pip, setuptools, and wheel.
I would suggest activating the virtualenv [from dir holding venv, run . <venvName>/bin/activate] and checking packages available [pip list]. Then, deactivate and check global packages available.
Solved
I forgot when did I set 'no-dependences = True' in .pip/pip.conf.
Now it's okey after detele the line.

Tensorflow installation error on Mac OSX Sierra

When verifying my tensorflow installation as per the instructions here:
https://www.tensorflow.org/install/install_mac#ValidateYourInstallation
I get the following error message immediately after importing tf:
(tensorflow) Davids-iMac:~ david$ python
Python 3.6.1 (default, Apr 24 2017, 06:18:27)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
python(12966,0x7fffa84273c0) malloc: *** error for object 0x10b235eb0:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
I have had this problem on two different Macs; this installation was in a virtualenv, the other installation python directly. I installed python 3, readline and pip from scratch with Macports using sudo -H.
I also used sudo port select --set python python36 to set python3 to be the default (same for pip3).
Any hints where I went wrong greatly appreciated.
Here the virtualenv installation of tf:
cd /opt/local/bin
sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenv
cd
virtualenv --system-site-packages -p python3 tensorflow/
The path python3 (from --python=python3) does not exist
Davids-iMac:~ david$ virtualenv --system-site-packages -p python tensorflow/
Running virtualenv with interpreter /opt/local/bin/python
Using base prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/david/tensorflow/bin/python
Installing setuptools, pip, wheel...done.
Davids-iMac:~ david$ source ~/tensorflow/bin/activate
(tensorflow) Davids-iMac:~ david$ pip -V
pip 9.0.1 from /Users/david/tensorflow/lib/python3.6/site-packages (python 3.6)
(tensorflow) Davids-iMac:~ david$ pip install --upgrade tensorflow
Collecting tensorflow
Downloading tensorflow-1.1.0-cp36-cp36m-macosx_10_11_x86_64.whl (31.3MB)
100% |████████████████████████████████| 31.3MB 49kB/s
Collecting numpy>=1.11.0 (from tensorflow)
Downloading numpy-1.12.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.4MB)
100% |████████████████████████████████| 4.4MB 319kB/s
Requirement already up-to-date: wheel>=0.26 in ./tensorflow/lib/python3.6/site-packages (from tensorflow)
Collecting werkzeug>=0.11.10 (from tensorflow)
Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
100% |████████████████████████████████| 317kB 3.0MB/s
Collecting six>=1.10.0 (from tensorflow)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting protobuf>=3.2.0 (from tensorflow)
Downloading protobuf-3.3.0.tar.gz (271kB)
100% |████████████████████████████████| 276kB 3.2MB/s
Requirement already up-to-date: setuptools in ./tensorflow/lib/python3.6/site-packages (from protobuf>=3.2.0->tensorflow)
Building wheels for collected packages: protobuf
Running setup.py bdist_wheel for protobuf ... done
Stored in directory: /Users/david/Library/Caches/pip/wheels/1b/42/a0/4c7343df5b629ec9c75655468dce7652b28026896b0209ba55
Successfully built protobuf
Installing collected packages: numpy, werkzeug, six, protobuf, tensorflow
Successfully installed numpy-1.12.1 protobuf-3.3.0 six-1.10.0 tensorflow-1.1.0 werkzeug-0.12.2
(tensorflow) Davids-iMac:~ david$ python
Python 3.6.1 (default, Apr 24 2017, 06:18:27)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
python(12966,0x7fffa84273c0) malloc: *** error for object 0x10b235eb0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Should I use pip or pip3 to install python3 packages inside of a virtual environment?

I have python 2(as default) and 3 on my Linux machine. I created a virtual environment to try out pandas with python3. So, I ran:
virtualenv -p python3 pandas_env
If I type python inside of this env it goes to the standard python shell, with python 3 as the default version
(panda_env)$ python
Python 3.4.3 (default, Sep 14 2016, 12:36:27)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
To install ipython, I did:
(panda_env)$ pip install ipython
now, running ipython, it defaults to python2 instead of 3
(panda_env)$ ipython
WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
With a WARNING saying to install ipython inside virtualenv. I thought did installed ipython inside the environment, and why is it using python2.x by default?
How do I install ipython inside virtualenv correctly, and how can I make ipython use 3.x instead of 2.x?
Also, should I use pip or pip3 to install packages inside a virtualenv?
Note, for python > 3.3 it's recommended you start a virtual environment with the pyvenv command. This has now been deprecated as of python > 3.6 in favor of python3 -m venv <environment name> (via https://docs.python.org/3/library/venv.html)
In answer to your question, I don't believe it matters based on this check:
# start enviroment
$ python3 -m venv test_env; source test_env/bin/activate
# check python version
(test_env) $ python --version
Python 3.6.0
# check pip and pip3
(test_env) $ which pip
~/Documents/test_env/bin/pip
(test_env) $ which pip3
~/Documents/test_env/bin/pip3
# The pip commands are different, but if we check their versions they are the same and both appear to be using python3.
(test_env) $ pip -V
pip 9.0.1 from ~/test_env/lib/python3.6/site-packages (python 3.6)
(test_env) $ pip3 -V
pip 9.0.1 from ~/test_env/lib/python3.6/site-packages (python 3.6)
# In fact the binaries for pip and pip3 within the environment are identical as you can see with this.
(test_env) $ diff ~/Documents/test_env/bin/pip ~/Documents/test_env/bin/pip3
# Checking with ipython
(test_env) $ pip install ipython
(test_env) $ ipython
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
The easiest way to work with virtual environments is to download anaconda and use the conda version control system:
Works exactly the same way for all versions of python
Python is treated as just another package as part of the environment
Everything related to an environment is stored in one folder
You can see revision history and rollback to previous versions of the environment if something stops working

Changing python interpreter in spyder

I'm running spyder 2.3.8 on Mac OS 10.11.4. I've installed spyder with the .dmg installer. I would like to use the python 2.7.11 interpreter located in /opt/local/bin/python (found with which python):
~> which python
/opt/local/bin/python
~> /opt/local/bin/python
Python 2.7.11 (default, Mar 1 2016, 18:40:10)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
So I've changed the interpreter in spyder using Preferences > Console > Advanced settings > Use the following Python interpreter: /opt/local/bin/python. But still, when I launch spyder, it runs python 2.7.10. I don't understand why. Any idea?

Resources