ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects - pip

I want to install mpi4py.
The installation fails with the error below.
Please share the solution to the same error.
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mpi4py
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects
[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python -m pip install --upgrade pip
I installed pyproject-toml with "pip install pyproject-toml".
But mpi4py still won't install.
My python version is Python 3.8.0.

The following worked for me:
sudo apt update
sudo apt-get install libopenmpi-dev

It seems that related packages are twisted.
Installed by following the steps below.
apt --fix-broken install
apt install mpich
pip install mpi4py

For me it worked when I used sudo before:
sudo pip install mpi4py

I had the same error message. I used the Anaconda-Navigator interface and it worked fine.
Another option is to use brew. If OpenMPI isn't a dependency issue for you, the installation worked when I used it as well.
brew install mpi4py

Related

ERROR:Failed building wheel for h5pyFailed to build h5pyERROR:Could not build wheels for h5py,which is required toinstall pyproject.toml-basedprojects

I'm getting this error when I'm running the following command to install tensorflow.
python3 -m pip install tensorflow-macos
ERROR: Failed building wheel for h5py
Failed to build h5py
ERROR: Could not build wheels for h5py, which is required to install pyproject.toml-based projects
I tired to install this wheel manually, from the official link (https://pypi.org/project/h5py/#files), it got installed properly but I'm still getting the same error.
I'm facing the above issue in Mac Book M1 chip.
The official doc to use brew install.
$ brew install hdf5
If the above command gives you rosetta 2 issue, then run:-
arch -arm64 brew install hdf5
Once, the h5py installation is done, run following 2 commands:-
$ export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.12.0_4 OR export HDF5_DIR=/opt/homebrew/opt/hdf5 (if hdf5 is installed in the "/opt/homebrew/opt/hdf5" location, you have to check it out first)
$ pip install --no-binary=h5py h5py
Note:- in the first command "1.12.0_4" is the version of hdfc installed in my system, you have to change it according to yours.
If you are getting the aforementioned error implies you must be using poetry.
Finally run:-
poetry install
We are running the above command, In case poetry wants to update anything.
Once we run poetry install, it might update existing libraries or download new libraries.
So we have to update poetry.lock file as well.
poetry lock
After installing hdf5 try "export HDF5_DIR=/opt/homebrew/opt/hdf5"
Ref: https://github.com/h5py/h5py/issues/2035#issuecomment-1028226141
This works for me:
Install brew (https://brew.sh/)
brew install hdf5
export HDF5_DIR=$(brew --prefix hdf5) (as #sgt pepper said)
pip install --no-binary=h5py h5py

Pipx failed to build packages

When I run the command pipx install eth-brownie I receive the following error message,
fatal error from pip prevented installation. Full pip output in file:
/Users/gentgjonbalaj/.local/pipx/logs/cmd_2021-10-22_11.10.14_pip_errors.log
pip failed to build package:
cytoolz
Some possibly relevant errors from pip install:
cytoolz/functoolz.c:23087:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
cytoolz/functoolz.c:23092:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
cytoolz/functoolz.c:23176:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
error: command '/usr/bin/clang' failed with exit code 1
Error installing eth-brownie.
I tried to use the command "pip install eth-brownie" but my terminal says "pip command not found."
I received the same error, and was finally able to resolve after running the following commands:
Using Homebrew:
brew install recordclass
brew install cython
xcrun codesign --sign - "/Users/jon/Library/Python/3.8/lib/python/site-packages/regex/_regex.cpython-38-darwin.so"
pip3 install cytoolz
pip3 install pybind11
M1 Mac Chips has issues. There are issues at 2 fronts. (a) cytoolz, (b) regex==2021.10.8.
(a) cytoolz is resolved by doing pip install cytoolz and not pipx
(b) regex issue is a big one. The issue is with the version. Packaging bug causes an x86_64 regex to be installed on an Apple Silicon (M1) device (https://githubmemory.com/#dragos-vlad). To fix this: Pinning regex to 2021.9.30 should work for the time being. However for that you will have to change the requirements in the brownie git that you will use for installing.
For anyone using Windows 10 I had the same issue, just had to run:
pip install Cython
then
pip install eth-brownie
For whatever reason I was finally able to install with pip but not with pipx.
I have this problem with python 3.10. Try pyenv and use python 3.9.1 and it works.
What worked for me in Python 3.10 was installing cython and cytoolz before brownie.
Enter these three commands:
python3 -m pip install --user cython
python3 -m pip install --user cytoolz
python3 -m pip install --user eth-brownie
I had the same problem, Use pip rather than pipx.
command: pip install eth-brownie
For anyone using Python 3.10 on windows, simple run
pip install eth-brownie
It worked for me when I used pip3 install eth-brownie instead of pipx

How to install numpy on linux subsystem for windows?

I'm trying to install NumPy on the Linux subsystem for Windows, but it when I try to install pip sudo apt install python-pip so that I can use pip install numpy, it gives the error E: Unable to locate package python-pip.
Any suggestions?
Thanks
Edit:
When I run pip install numpy it gives the error: Command 'pip' not found, but there are 18 similar ones.
My recollection is also that python did not come installed with ubuntu, but I could be remembering incorrectly.
Try this sudo apt install python3-pip

Install horovod on MacOS

After installing horovod via pip3 install horovod
I get an error:
ImportError: Extension horovod.tensorflow has not been built: /usr/local/lib/python3.7/site-packages/horovod/tensorflow/mpi_lib.cpython-37m-darwin.so not found
If this is not expected, reinstall Horovod with HOROVOD_WITH_TENSORFLOW=1 to debug the build error.
Also tried
pip3 uninstall horovod
HOROVOD_WITH_TENSORFLOW=1 pip3 install horovod
pip3 uninstall horovod
HOROVOD_WITHOUT_MPI=1 pip3 install horovod
but get the same error.
One tricky thing about Pip is that you need to specify --no-cache-dir to prevent it from reusing its "cached" version of the package (in your case, compiling Horovod with different installation flags. So try something like this:
HOROVOD_WITHOUT_MPI=1 HOROVOD_WITH_TENSORFLOW=1 pip3 install --no-cache-dir horovod
Specific to macOS, you need to make sure libuv is installed before installing Horovod with Gloo (without MPI):
brew install libuv

Pip install fontforge, says Couldnot find a version

I have done, apt-get install fontforge on my ubuntu system. When i do import fontforge in my python code, it throws error as, No module named fontforge.
When i do, pip install fontforge, it throws error as,,
Could not find a version that satisfies the requirement fontforge (from versions: )
No matching distribution found for fontforge
How can i install fontforge's python libs?
You may want to install python3-fontforge.
sudo apt-get install python3-fontforge
After that you should be able to use fontforge in ubuntu's python version 3.
You can verify by doing /usr/bin/python3 -c "import fontforge;print(fontforge)". This should now print the path to the fontforge python module.
Try installing a specific version
pip install fontforge==1.0
For me , the above command completes without errors. If any errors, upgrade pip using
pip install --upgrade pip
And try again. You may try allow externally hosted files also.
pip install --allow-all-external fontforge

Resources