Building wheel for scipy (setup.py): finished with status 'error' - python

I am trying to build a Docker Image and install these requirements with a requirements.txt-file:
numpy==1.18.1
scipy==1.2.1
joblib==0.13.2
Cython==0.29.13
pandas==0.25.3
scikit-learn==0.21.3
h5py==2.8.0
Keras==2.3.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
This is my dockerfile:
FROM python:3
MAINTAINER author#sample.com
RUN mkdir /test
COPY ./ /test
WORKDIR /test
## Install your dependencies here using apt-get etc.
RUN pip install -r requirements.txt
When I try to build theThis is the error message I get
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d0v5nn_0/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d0v5nn_0/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-u8mo7l4r
cwd: /tmp/pip-install-d0v5nn_0/scipy/
Complete output (9 lines):
/tmp/pip-install-d0v5nn_0/scipy/setup.py:114: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-d0v5nn_0/scipy/setup.py", line 492, in <module>
setup_package()
File "/tmp/pip-install-d0v5nn_0/scipy/setup.py", line 468, in setup_package
from numpy.distutils.core import setup
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
ERROR: Failed building wheel for scipy
After this it also tries to run a
Running setup.py clean for scipy
but without success

Not sure if it's the reason for the error but considering the release notes of Numpy 1.18.1, you should have Cython ≥ 0.29.14 whereas the requirements.txt specifies Cython==0.29.13.
FROM python:3 results in getting Python 3.8.
The Python versions supported in this release are 3.5-3.8. Downstream
developers should use Cython >= 0.29.14 for Python 3.8 support and
OpenBLAS >= 3.7 to avoid errors on the Skylake architecture.

Related

can't install mysql==0.0.2 in python==3.8.1 environment

I can't install mysql==0.0.2. I am able to install mysql==0.0.3. The error looks like.
Seems to me setuptools error.
(venv) C:\Users\xyz\Envs\>pip install mysql==0.0.2
Collecting mysql==0.0.2
Using cached mysql-0.0.2.tar.gz (1.9 kB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\xyz\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"'; __file__='"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info'
cwd: C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\
Complete output (32 lines):
WARNING: `mysql` is a virtual package. Please use `%s` as a dependency directly.
running egg_info
creating C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info
writing C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info\PKG-INFO
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\setup.py", line 33, in <module>
setup(
File "c:\users\xyz\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "c:\users\xyz\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
.....
.....
.....
lines = header.split('\n')
AttributeError: 'list' object has no attribute 'split'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
You shouldn't install mysql at all.
This package is a ‘virtual package’, which requires MySQL-python (Python 2) or mysqlclient (Python 3) to install. In effect, this means ‘pip install mysql’ will actually install MySQL-python.
Instead of depending on this package, please depend on the relevant package directly.
In a Python 3 world, use either
pip install mysqlclient (for MySQLdb), or
pip install mysql-connector-python (for mysql.connector).

Not able to install librosa

I am not able to install librosa in Ubuntu 18.04. I have tried the following commands, all are failed.
pip install librosa
python3.8 -m pip install librosa
sudo pip install librosa
pip install -u librosa
The below error I am getting:
Failed cleaning build dir for numba
Running setup.py bdist_wheel for resampy ... done
Stored in directory: /home/nageshas/.cache/pip/wheels/fa/c1/56/e0e12c6f7f3d2cdea9712b35136a2d40a7817c6210ec096485
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zrky3kzn/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmphpnrxd05pip-wheel- --python-tag cp38:
running bdist_wheel
/usr/bin/python3.8 /tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 220, in <module>
main()
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 210, in main
main_posix('linux', '.so')
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 134, in main_posix
raise RuntimeError(msg) from None
RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
error: command '/usr/bin/python3.8' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Successfully built librosa audioread resampy
Failed to build numba llvmlite
Installing collected packages: audioread, decorator, joblib, llvmlite, numpy, setuptools, numba, chardet, urllib3, idna, certifi, requests, pyparsing, packaging, appdirs, pooch, scipy, six, resampy, threadpoolctl, scikit-learn, pycparser, cffi, soundfile, librosa
Running setup.py install for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zrky3kzn/llvmlite/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-f20fjedr-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
got version from file /tmp/pip-build-zrky3kzn/llvmlite/llvmlite/_version.py {'version': '0.36.0', 'full': 'e6bb8d137d922bec8beeb01a237254778759becd'}
running build_ext
/usr/bin/python3.8 /tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 220, in <module>
main()
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 210, in main
main_posix('linux', '.so')
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 134, in main_posix
raise RuntimeError(msg) from None
RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
error: command '/usr/bin/python3.8' failed with exit status 1
I came across the same issues too.
There are several steps that helped me, but I cannot define the exact one. So I will list all:
First, update setuptools and wheel
python3 -m pip install --upgrade pip setuptools wheel
Second
python setup.py bdist_wheel
Try to install the previous version of librosa
pip install librosa==0.7.2
I hope the first two steps will help

ERROR: Command errored out with exit status 1

I tried:
pip3 install -r requirements.txt
Here's the error I received:
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\Admin\AppData\Local\Temp\pip-install-6c3rea1s\pycocotools\
You are using pip version 19.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip'
command.
So, I tried:
pip install --upgrade pip
and
install pip3 install -r requirements.txt
That resulted in more errors:
ERROR: Command errored out with exit status 1: command:
'c:\users\admin\appdata\local\programs\python\python37-32\python.exe'
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-epmkeh4g\\pycocotools\\setup.py'"'"';
__file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-epmkeh4g\\pycocotools\\setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
egg_info --egg-base
'C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\pip-egg-info'
cwd:
C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\
Complete output (5 lines): Traceback (most recent call last):
File "<string>", line 1, in <module> File
"C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\setup.py",
line 2, in <module> from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'
---------------------------------------- ERROR: Command errored out
with exit status 1: python setup.py egg_info Check the logs for full
command output.
I deleted the folder and re-install, but the results remained the same.
This is a bug in pycocotools. The bug was fixed in 2017 but it seems the fix didn't get into release 2.0 in 2018 (I guess the release process is also buggy).
There is also another similar bug in setup.py — it imports numpy before installing it.
There is no simple workarounds for these bugs using requirements.txt. You need to install the required modules before installing pycocotools:
pip install Cython numpy
pip install -r requirements.txt

How to install mysqlclient in python?

I am new to Python, coming from Java and JS background,
I've installed Python and Pip in my local machine,
I am trying to learn Django, using MySQL,
But I am unable to install the mysqlclient using pip,
I used the following command to do so -
pip install mysqlclient
It's giving the following error -
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ms/q8s67d8n09q59mbpshz3dq9m0000gn/T/pip-install-nk55db_s/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/ms/q8s67d8n09q59mbpshz3dq9m0000gn/T/pip-install-nk55db_s/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/ms/q8s67d8n09q59mbpshz3dq9m0000gn/T/pip-install-nk55db_s/mysqlclient/
Complete output (12 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/ms/q8s67d8n09q59mbpshz3dq9m0000gn/T/pip-install-nk55db_s/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/ms/q8s67d8n09q59mbpshz3dq9m0000gn/T/pip-install-nk55db_s/mysqlclient/setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "/private/var/folders/ms/q8s67d8n09q59mbpshz3dq9m0000gn/T/pip-install-nk55db_s/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Screenshot -
I am solve error following process
Python 3.8.0
First install in Homebraw type following command. type this command in terminal
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install mariadb-connector-c
pip install mysqlclient
more issues follow this tutorial
https://medium.com/#MrWeeble/homebrew-on-mac-and-pythons-mysqlclient-ea44fa300e70
mysqlclient requires additional c libraires.
For linux (Debian):
$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
For Mac:
$ brew install mysql
Further reading at the home page

DockerSkeleton python ML module installation error

I am trying to install python ml modules via dockerSkeleton so i can invoke docker action from openwhisk cli but i am keep getting below errors and couldn't find much help.
Collecting scikit-learn (from sklearn->-r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/25/b6 /454cf208be93efa3db50ce06b732328c57ede005d1dcfa71d9a1548530b0/scikit-learn-0.19.2.tar.gz (9.7MB)
Building wheels for collected packages: numpy, elm, scipy, sklearn, deap, optunity, scikit-learn
Running setup.py bdist_wheel for numpy: started
Running setup.py bdist_wheel for numpy: still running...
Running setup.py bdist_wheel for numpy: still running...
Running setup.py bdist_wheel for numpy: still running...
Running setup.py bdist_wheel for numpy: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/29/74/5c/331da973b82cedd300e088ad58bd241c4c8857dd6faf5433eb
Running setup.py bdist_wheel for elm: started
Running setup.py bdist_wheel for elm: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/31/17/21/20fd245c9d2b1db0e4805d9e3a9b36c2767ce4816378548cf7
Running setup.py bdist_wheel for scipy: started
Running setup.py bdist_wheel for scipy: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jprwp998/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-st6v_gb2 --python-tag cp36:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-jprwp998/scipy/setup.py", line 474, in <module>
setup_package()
File "/tmp/pip-install-jprwp998/scipy/setup.py", line 450, in setup_package
from numpy.distutils.core import setup
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
Failed building wheel for scipy
Running setup.py clean for scipy
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jprwp998/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
`setup.py clean` is not supported, use one of the following instead:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
Add `--force` to your command to use it anyway if you must (unsupported).
----------------------------------------
Failed cleaning build dir for scipy
Running setup.py bdist_wheel for sklearn: started
Running setup.py bdist_wheel for sklearn: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/76/03/bb/589d421d27431bcd2c6da284d5f2286c8e3b2ea3cf1594c074
Running setup.py bdist_wheel for deap: started
Running setup.py bdist_wheel for deap: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/22/ea/bf/dc7c8a2262025a0ab5da9ef02282c198be88902791ca0c6658
Running setup.py bdist_wheel for optunity: started
Running setup.py bdist_wheel for optunity: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/1c/a1/79/8c2f85ed743981107a5b98afcc95bab74d5f85335ec70c7995
Running setup.py bdist_wheel for scikit-learn: started
Running setup.py bdist_wheel for scikit-learn: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jprwp998/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-mhy2zrpk --python-tag cp36:
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 168, in get_numpy_status
import numpy
ModuleNotFoundError: No module named 'numpy'
Traceback (most recent call last):
File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 148, in get_scipy_status
import scipy
ModuleNotFoundError: No module named 'scipy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 269, in <module>
setup_package()
File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 249, in setup_package
.format(numpy_req_str, instructions))
ImportError: Numerical Python (NumPy) is not installed.
scikit-learn requires NumPy >= 1.8.2.
Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html
----------------------------------------
Failed building wheel for scikit-learn
Running setup.py clean for scikit-learn
and the docker file i am using to build this is
# Dockerfile for Python whisk docker action
FROM openwhisk/dockerskeleton
ENV FLASK_PROXY_PORT 8080
# lapack-dev is available in community repo.
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
# add package build dependencies
RUN apk add --no-cache \
g++ \
lapack-dev \
gfortran
# Install our action's Python dependencies
ADD requirements.txt /action/requirements.txt
RUN cd /action; pip install -r requirements.txt
# Add all source assets
ADD . /action
# Rename our executable Python action
ADD main.py /action/exec
CMD ["/bin/bash", "-c", "cd actionProxy && python -u actionproxy.py"]
requirement file is
numpy==1.14.3
elm
scipy
sklearn
i have searched alot of websites but nothing is helping, if anyone have any idea or experience with openwhisk docker python actions please any help would be appreciated.
I have checked it by just installing numpy and its working perfectly but somehow when i add scipy and numpy both to install it throws me error that numpy module not found.
Thanks
Try using the python runtime kind python-jessie:3 it already contains some ML related packages like numpy, scipy, pandas, and scikit-learn
For example using the CLI to create an action
ibmcloud fn action update mymlaction mymlaction.py --kind python-jessie:3
More details on the python runtime here https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html#openwhisk_ref_python_environments

Categories