Error when installing mpi4py on Ubuntu instance - python

I'm trying to install mpi4py on my Ubuntu 18.04 instance. I have python3.6.5 installed.
First I try sudo apt-get build-dep python-mpi4py and I get:
Reading package lists... Done E: You must put some 'source' URIs in
your sources.list
I then try to install simply with pip install mpi4py. I get a long error message and I include some of the most important parts below:
checking for library 'lmpe' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
--------------------------------------------------------------------------
failure.
This failure occurs for most libraries. I include just one of the many, and
warning: build_clib: command '/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc' failed with exit status 1
warning: build_clib: building optional library "vt-mpi" failed
checking for library 'vt-hyb' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
Running which mpcc gives:
(tensorflow_p36) ubuntu#ip-172-31-35-200:~$ which mpicc
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc
How can I add the specified compiler x86_64-conda_cos6-linux-gnu-cc to my PATH in order to resolve this error?

Simply run:
conda install -c anaconda mpi4py as shown here.
Also, a helpful comment by Lidandro Dalcin:
I guess you are missing the mpich-mpicc package, this one is a
metapackage that depends in the right compiler. Why are you installing
mpi4py with pip? Maybe all you need is to conda install mpi4py
(available in the conda-forge channel) ?

Related

Unable to execute 'gcc-8': No such file or directory error: command 'gcc-8' failed with exit status 1. PySIT package installation

I am trying to install a package called PySIT to be run with Python, and have followed the instructions on this install page (https://pysit.readthedocs.io/en/latest/install.html) using pip on my terminal to install PySIT.
I am using macOS Catalina for this, and have Anaconda installed on my computer.
This is the output I get on my terminal when I run the command: python setup.py install
gcc-8 -fno-strict-aliasing -I/Users/KBrindha/anaconda2/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/KBrindha/anaconda2/lib/python2.7/site-packages/numpy/core/include -Ipysit/solvers/fd_tools -I/Users/KBrindha/anaconda2/include/python2.7 -c pysit/solvers/constant_density_acoustic/time/scalar/solvers_wrap.cxx -o build/temp.macosx-10.6-x86_64-2.7/pysit/solvers/constant_density_acoustic/time/scalar/solvers_wrap.o -O3 -fopenmp -ffast-math
unable to execute 'gcc-8': No such file or directory
error: command 'gcc-8' failed with exit status 1
Any help on how to bypass this issue or install gcc-8 would be appreciated.
For further information, I have Xcode and Xcode Command Line Tools installed in my computer.
I also have "just" gcc (not gcc-8) installed at /usr/bin/gcc.
The authors inserted fixed names for compilers right into their setup.py. This is a bug and I recommend to report it.
Meanwhile you can clone the repository or download source code, extract it, edit setup.py and remove or replace these fixed names. Then build with the command pip install .

Error when installing pyminizip on docker

I am getting an error while installing pyminizip package inside docker container ( docker version 17.03.1-ce). I am doing it inside virtual environment with python 2.7.13.
I ended up with below message while trying to install it.
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isrc -Izlib123 -I/usr/local/include/python2.7 -c src/py_minizip.c -o build/temp.linux-x86_64-2.7/src/py_minizip.o
src/py_minizip.c: In function ‘_compress’:
src/py_minizip.c:251: warning: ‘filepathnameinzip’ may be used uninitialized in this function
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isrc -Izlib123 -I/usr/local/include/python2.7 -c src/zip.c -o build/temp.linux-x86_64-2.7/src/zip.o
In file included from src/zip.c:66:
src/crypt.h:34: error: redefinition of typedef ‘z_crc_t’
src/zip.h:83: note: previous declaration of ‘z_crc_t’ was here
src/zip.c:201: warning: function declaration isn’t a prototype
src/zip.c:203: warning: function declaration isn’t a prototype
error: command 'gcc' failed with exit status 1
Is there any alternate of pyminizip package ?
I want to create a password protected zip. So, even if there is any alternate solution to it, please let me know.
Would be useful know what docker image you use... but Try to Install python developer version:
sudo apt-get install python-dev
and libevent libraries
sudo apt-get install libevent-dev
This issue has been resolved. It is working fine with pyminizip version 0.2.1. I had faced this issue on 0.2.2 and
0.2.3 but version 0.2.1 is working fine for me.

Installing aspell for python 3 on MacOS X

I am trying to install aspell for Python 3 (on MacOS X 10.11), and have encountered an issue (the same one) using both pip and the manual installer (by cloning the git repo). I have already installed aspell using MacPorts (sudo port install aspell) as well as the english dictionary (sudo port install aspell-dict-en).
The error is obvious (aspell.h cannot be found), however I have no idea how to fix it.
Any help would be greatly appreciated.
$ sudo python3 setup.3.py build
running build
running build_ext
building 'aspell' extension
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c aspell.c -o build/temp.macosx-10.11-x86_64-3.5/aspell.o
aspell.c:53:10: fatal error: 'aspell.h' file not found
#include <aspell.h>
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Asked the same question on the project's GitHub page. Original can be found here. Copied here for convenience.
In case anybody encounters the same issue, I had installed aspell using MacPorts (sudo port install aspell) and had to include the dir '/opt/local/include', which is where the header file for aspell (aspell.h) was located.
Hence, my setup.3.py looks like this:
module = Extension('aspell',
libraries = ['aspell'],
library_dirs = ['/usr/local/lib/'],
include_dirs = ['/opt/local/include'],
sources = ['aspell.c']
)

Pybluez installation in Linux

I am trying to install PyBluez-0.18 on my Linux Mint 15 machine, but got an error message during the installation process. I tried searching online to see if others might have encountered this problem, but I could not find any.
I list the command I tried to execute, along with the error message I received. Could someone tell me what I am doing wrong, and what I need to do to reso
tri108354#prtgc004-Latitude-E6320 ~/Downloads/PyBluez-0.18 $ python setup.py install
running install
running build
running build_py
running build_ext
building 'bluetooth._bluetooth' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tri108354/anaconda/include/python2.7 -c bluez/btmodule.c -o build/temp.linux-i686-2.7/bluez/btmodule.o
In file included from bluez/btmodule.c:20:0:
bluez/btmodule.h:5:33: fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
You need to install libbluetooth-dev package for compiling your code
sudo apt-get install libbluetooth-dev
That should install the bluetooth header files.

Scipy Installing to Wrong Place on Mountain Lion?

Tried installing scipy on Mountain Lion, and couldn't get anything to work except:
sudo pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev
which I believe installs the development version of scipy. For some reason it leaves an src directory inside my current folder, which contains a pip-delete-this-directory.txt and scipy directory containing all scipy files. I can import scipy from anywhere, but removing this folder removes scipy entirely. What's going on?
If I try installing with simply sudo pip install scipy, I get the following
/System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:22:4: error: "<vecLib/vecLib.h> is deprecated. Please #include <Accelerate/Accelerate.h> and link to Accelerate.framework."
#error "<vecLib/vecLib.h> is deprecated. Please #include <Accelerate/Accelerate.h> and link to Accelerate.framework."
^
1 error generated.
error: Command "clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Iscipy/sparse/linalg/eigen/arpack/ARPACK/SRC -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c -o build/temp.macosx-10.8-intel-2.7/scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.o" failed with exit status 1
From the pip documentation page:
Edit mode
Packages normally install under site-packages, but when you’re making changes, it makes more sense to run the package straight from the checked-out source tree. “Editable” installs create a .pth file in site-packages that extends Python’s import path to find the package:
$ pip install -e path/to/SomePackage
So this means you can simply solve your problems by running:
$ sudo mv src/scipy/scipy /Library/Python/2.7/site-packages/
And then if you want to be clean, you can edit the file to remove the line that was added by pip:
$ sudo vim /Library/Python/2.7/site-packages/easy-install.pth

Categories