Installing rpy2 on python 2.7 on macOS - macos

I have python version 2.7.10 on macOS High Sierra and would like to install rpy2.
When I do sudo pip install rpy2
I get the error message:
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-Nwbha3/rpy2/
I have already upgraded setuptools (version 39.0.1).
I also downloaded the older version rpy2-2.7.0.tar.gz and tried installing it with sudo pip install rpy2-2.7.0.tar.gz. I then get the following error message:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-O0cu4E-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-haDUA3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-O0cu4E-build/
If somebody has the answer to my installation problem, it would be greatly appreciate it.
Many thanks in advance!

The clang that ships with Mac does not support openmp which is what the -fopenmp flag is for. You'll likely need a version of clang that supports openmp.
One possible solution would be to get the full llvm/clang build with openmp support. With homebrew you can do:
brew install llvm # clang/llvm
brew install libomp # OpenMP support
And then try installing rpy2 again with newly installed version of clang.
As an example, the current version is 6.0.0 so you would run
CC=/usr/local/Cellar/llvm/6.0.0/bin/clang pip install rpy2

Related

Error code (exit code 1) when installing netfilterqueue on macOS

When I try to install the module netfilterqueue for python via pip, I get the error:
"Command
"/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-u -c "import setuptools, tokenize;file='/private/tmp/pip-install-Ut3XcJ/netfilterqueue/setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /private/tmp/pip-record-teUDXs/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-Ut3XcJ/netfilterqueue/"
I installed the module scapy without any problems, so I'm confused why netfilterqueue isn't installing. I'm currently using macOS High Sierra.
According to these issue on their Github page, it is not supported on macOS.
https://github.com/kti/python-netfilterqueue/issues/14:
libnetfilterqueue is a Linux-only feature, so you won't be able to
install python-netfilterqueue on Mac OS.
https://github.com/kti/python-netfilterqueue/issues/2:
Sorry, python-netfilterqueue will not work on Mac because nfqueue is Linux-only: http://www.netfilter.org/projects/libnetfilter_queue/index.html
error code 1 means operation not permitted, so it is a problem of authorization.
Try with sudo before the command:
sudo pip install python-netfilterqueue

Installing Pyinstaller

I am getting the below error while installing Pyinstaller. Pip is already installed and the command used at the Terminal is pip install pyinstaller.
error: could not create
'/Library/Python/2.7/site-packages/_dummy_thread': Permission denied
Command "/usr/bin/python -u -c "import setuptools,
tokenize;file='/private/var/folders/pq/l_flqbp91_xgfmb0j1x8ckyh0000gp/T/pip-install-PIu2W0/future/setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /private/var/folders/pq/l_flqbp91_xgfmb0j1x8ckyh0000gp/T/pip-record-7rrphN/install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
/private/var/folders/pq/l_flqbp91_xgfmb0j1x8ckyh0000gp/T/pip-install-PIu2W0/future/
My Python installed version is 3.6 and pip version is 10.0.1; however its showing some python 2.7 text in the output, as below, when I check versions:
Apples-MacBook-Pro:~ solelthermtechnik$ pip --version
pip 10.0.1 from /Library/Python/2.7/site-packages/pip-10.0.1-py2.7.egg/pip (python 2.7)
Apples-MacBook-Pro:~ solelthermtechnik$ python --version
Python 3.6.2
Please help to understand and fix. I could not get any way out of the question in Can I use PyInstaller from Python 2.7 to compile an executable for a Python 3 script?
I figured it out by trying to run with sudo (as admin) and password and it worked. So Pyinstaller successfully installed :)screenshot

installation of vpython using pip in High Sierra

I am having issue with installing vpython using pip. During the installation I get and error as if I do not have stdio.h, which I do
In file included from _scandir.c:14:
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-build-czavCr/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-is5WM1-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-build-czavCr/scandir/
I am running High Sierra, latest Xcode
Most posts on the web suggest to install the command line tools with
xcode-select --install but I did and I can compile some of my codes just fine.
Other things I have tried:
removing and reinstalling xcode+command line tools
remove the /Library/Developer/CommandLineTools/
CFLAGS=-stdlib=libc++ pip install vpython
MACOSX_DEPLOYMENT_TARGET=10.13 pip install vpython
but nothing works. I am completely out of ideas
I was unable to understand the problem above, but I have managed to find two workarounds to get a working version of vpython. Somehow the issue seems to be related to python package I installed from python.org and the pip included. I removed it and installed instead python2 and python3 using Homebrew and both pip2 and pip3 managed to install successfully the vpython and other modules.
Another alternative, which seems even better is to install Anaconda Python and then use conda to get vphyton.

Install dlib in python3 on mac

Getting the below as error:
Collecting dlib
Using cached dlib-19.1.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/x1/bsml9c1532x102zlxhqt_k380000gn/T/pip-build-_1n6svbf/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/x1/bsml9c1532x102zlxhqt_k380000gn/T/pip-0m_zvdwp-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
error: Cannot find cmake, ensure it is installed and in the path.
You can install cmake on OSX using `sudo brew install cmake`.
You can also specify its path with --cmake parameter.
----------------------------------------
Then sudo brew install cmake is not installing as well.
Any solutions to this.
Maybe you should use brew without sudo..
brew install cmake

"error code 1" Installing usaddress with Anaconda on Windows 7 32-bit

I am running Windows 7 and Anaconda. Attempting to install usaddress library found here: https://github.com/datamade/usaddress I have attempted this installation using a virtual env of Python 2.7 in my Anaconda3 installation, and a separately installed Anaconda 2.
I installed pip for Conda and navigated to my Scripts directory to attempt an install using pip install usaddress. It does not work, neither do many of the solutions that I have found on the internet. The error I get is this:
Command "C:\Users\User\Anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\user\appdata\local\temp\pip-build-0a_vd7\python-crfsuite\setup.py';exec(compile(getattr(tokenize, 'open'
, open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-mtrojm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\user\appdata\local\temp\pip-build-0a_vd7\python-crfsuite
This is another error that seems to pop up:
Failed building wheel for python-crfsuite
Running setup.py clean for python-crfsuite
Failed to build python-crfsuite
I have also attempted to fix this error with no luck by searching Stack and other places on the internet.

Resources