Unable to install Scipy with MKL using Meson - pip

I am attempting to install scipy 1.9.1 with the MKL implementation of BLAS, using pip as my package manager. For numpy, I can do this with: pip install numpy --no-binary numpy. Doing this with Scipy (pip install scipy--no-binary scipy) fails with the error:
Run-time dependency openblas found: NO (tried pkgconfig and cmake)
../../scipy/meson.build:130:0: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig and cmake
I cannot figure out how to configure scipy/meson to use a specific version of BLAS, it always looks for OpenBLAS. Older versions of scipy could accomplish this in a variety of ways using environment variables or site.cfg settings, but the new meson build system specifically no long supports this.
Any suggestions how I can build scipy from the source using a specific BLAS library (ideally with pip)?

From looking at partial error provide, it seems either libopenblas development package or pkg-config command is missing. Below is the command to install them(for ubuntu or debian based system)
apt install libopenblas-dev pkg-config libopenblas64-dev
Depending on what are the other packages installed on system you may need to install below packages.
apt install patchelf python3-pythran cython3 gfortran

Related

can't find Rust compiler to install transformers

I don't know how to fix this error (for pip install transformer on windows):
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects
also tried this:
git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e .
and when I install rust it doesn't work either.

python module cropresize won't install (PIL dependency doesn't recognize Pillow)

I am trying to install a module (cropresize) for Python3, as required by another module (montage).
pip complains that cropresize (all versions) "depends on PIL."
easy_install, similarly, complains that "no local packages or working download links found for PIL."
Neither pip nor easy_install care that PIL replacement, Pillow, is installed.
To remedy, I installed pillowcase (for "smooth[ing] out installation issues due to the PIL/Pillow fork") but to no avail.
(Attempted install on Python2 failed as well, due to lack of PIL. Pillow is installed there too.)
Any idea what bit of hacking I need to do to get pip or easy_install to install cropresize with Pillow instead of PIL?

Error installing geopandas in python on mac m1

I'm trying to install geopandas on my M1 mac and I'm running into errors
I tried to pip install all the dependencies individually but where I'm tripping up is in the install of pyproj.
I installed PROJ using brew install proj and that worked fine
When I try to pip install pyproj, I get the follow error
Building wheels for collected packages: pyproj
Building wheel for pyproj (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyproj (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
PROJ_DIR is set, using existing PROJ installation..
running bdist_wheel
running build
running build_py
running build_ext
building 'pyproj._geod' extension
pyproj/_geod.c:704:10: fatal error: 'geodesic.h' file not found
#include "geodesic.h"
^~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyproj
Failed to build pyproj
ERROR: Could not build wheels for pyproj, which is required to install pyproject.toml-based projects
Any help would be much appreciated
At the moment, installing geopandas on M1 macs can be achieved via conda or pip+homebrew.
GeoPandas itself is written in pure Python, so there is no issue running that on any architecture. However, it depends on other libraries that are written in other languages (C, C++) that need to be compiled specifically for M1 chips. While you could compile it yourself, I am not going to cover this option as it is not user friendly.
There are three possible sources of required libraries - pip wheels, conda-forge, and Homebrew.
When a Python package requires C dependency, it can create wheels with the dependency compiled for each system and chip architecture. See for example pygeos - https://pypi.org/project/pygeos/#files. What you need is *macosx_11_0_arm64.whl . If your package doesn't offer it, you have to find another way of installing than pip. Since GeoPandas requires shapely and fiona (among others) that do not have these wheels, you should look elsewhere - either on conda-forge or Homebrew. Below are both options tested as of today.
Conda and conda-forge way (recommended)
Conda-forge currently has all packages geopandas needs
Install M1 version of miniforge or mambaforge. It can be downloaded from here - https://github.com/conda-forge/miniforge.
conda install -c conda-forge geopandas pygeos
Note: if you install x86 (Intel) version of conda, it will run under Rosetta2 and install all packages using x86 architecture, meaning that everything will run under emulation. Try to avoid that.
Pip and Homebrew way
Homebrew can install C libraries compiled for M1. Python packages will find and use them.
Using an environment with Python 3.9
Install shapely:
brew install geos
export DYLD_LIBRARY_PATH=/opt/homebrew/opt/geos/lib/
pip install shapely
DYLD_LIBRARY_PATH is needed for shapely to find GEOS installation.
Install fiona:
brew install gdal
pip install fiona
Install pyproj:
brew install proj
pip install pyproj
Install geopandas and pygeos for speedups:
pip install pygeos
pip install geopandas
Note that this is a copy&paste of my own explanation given in https://github.com/geopandas/geopandas/issues/1816#issuecomment-1003093329.
Related https://github.com/pyproj4/pyproj/issues/1027
I was stuck with the same problem, I also tried setting the environment values for PROJ_DIR, PROJ_LIBDIR, PROJ_INCDIR but perhaps setting the values is causing the error, so closed the terminal and tried again and was able to install correctly

Installing tensorflow on anaconda/mac?

I can not find a solution to install tensorflow on anaconda/mac.
When i try: conda install tensorflow,
I get:
UnsatisfiableError: The following specifications were found to be in conflict:
- blaze -> numba -> numpy=1.13
- tensorflow
Use "conda info " to see the dependencies for each package.
I tried reinstalling numpy, and could not find any relevant documentation.
On mac use following command:
conda install -c conda-forge tensorflow
This will install the latest Tensorflow on your system. if you wish to upgrade it to newer version then you can use the following command
conda update -f -c conda-forge tensorflow
I have had success installing tensorflow through pip...
pip install tensorflow
or, if you have all of the proper libraries...
pip install tensorflow-gpu
But if you have already removed numpy form the anaconda install, you might be in for a long day because almost all of the numeric packages require it. If the above pip install doesn't work, you might want to start from a clean anaconda install.
I have installed tensorflow using -
pip install tensorflow
Or, you can use Anaconda in following way -
Open Anaconda Navigator
On Left side go to Environments
Create a new environment (eg :- tensorflow_tf), select python 3.7
then select Not installed and Search "tensorflow"
click on tensorflow and apply

how to install opencv and run first program in anaconda3 5.0.0 python 3.6.2 version?

I tried using
pip install opencv-python
It says to not break the installation rules and that I should use the conda command. How to install opencv and run first program on it in anaconda3 5.0.0 and python 3.6.2?
Ideall you shouldn't mix conda installed and pip installed packages - it confuses the dependencies when it comes to updates. Although you can use pip install opencv-python and opencv will work perfectly well within anaconda.
Instead you need to select opencv3 (assuming you want v3) from a specific repository
conda install -c menpo opencv3
ps. I don't know why it isn't included as standard and why have to know/search for the specific repository!

Resources