Can't install pandas and other python libraries on Mac M1 - python-3.x

Fist I had lots of problems installing numpy library on a new Mac book M1. (mostly with pep517) and finally I installed it using python3 -m pip install --no-binary :all: --no-use-pep517 numpy==1.20rc1 command and now,
when I try to install pandas (with pip3) library, I face a long list of errors:
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix .....)
File "/private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-build-env-pxjl8ilr/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
AssertionError: would build wheel with unsupported tag ('cp39', 'cp39', 'macosx_11_0_universal2')
########### EXT COMPILER OPTIMIZATION ###########
Platform :
Architecture: unsupported
Compiler : gcc
CPU baseline :
Requested : optimization disabled
Enabled : none
Flags : none
Extra checks: none
Requested : optimization disabled
CPU dispatch :
Enabled : none
Generated : none
CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-install-85rdftyx/numpy_6356c8e2cabc49c4a1a96e499bcbb920/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_ext.py
########### CLIB COMPILER OPTIMIZATION ###########
Platform :
Architecture: unsupported
Compiler : gcc
CPU baseline :
Requested : optimization disabled
Enabled : none
Flags : none
Extra checks: none
Requested : optimization disabled
CPU dispatch :
Enabled : none
Generated : none
CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-install-85rdftyx/numpy_6356c8e2cabc49c4a1a96e499bcbb920/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_clib.py
----------------------------------------
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/78/e4/a935f1701fac697c6c5458f86968bec5d2b4cb66e7f738225216ebaa20b4/pandas-1.2.2.tar.gz#sha256=14ed84b463e9b84c8ff9308a79b04bf591ae3122a376ee0f62c68a1bd917a773 (from https://pypi.org/simple/pandas/) (requires-python:>=3.7.1). Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-build-env-77vprpke/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' Check the logs for full command output.
Using cached pandas-1.2.1.tar.gz (5.5 MB)
Installing build dependencies ... -^canceled
ERROR: Operation cancelled by user
How can I install pandas??
other libraries like scipy also face similar errors (some errors about clang.

i solved the problem using arch x86_64 pip3 install <package>
Apparently arm64's M1 doesn't support some python libraries yet!

I used homebrew to install python and numpy, but got the same error message when trying to install pandas using pip.
I could get pandas to work installing it from source (https://github.com/pandas-dev/pandas/releases)
Unzip the downloaded file and navigate to the root folder.
pip3 install cython
python3 setup.py install

I solved this by following the steps on this link:
https://laict.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9
Allowed me to install pyenv via homebrew and pyenv install python 3.8.6. once that was installed I was able to pip install everything I needed (including numpy and pandas which I have seen many other people have issues with). However, I previously tried to do all of this with 3.7.10 but ran into some issues similar to yours.
Im still unsure how to install python3.7 on mac M1 unfortunately.

Related

I'm encountering an error while installing turicreate module on wsl, is there any requirements I'm missing?

whenever I try to install turicreate module on wsl it's showing an error like this
`Collecting turicreate
Using cached turicreate-6.4.tar.gz (1.9 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for turicreate, since package 'wheel' is not installed.
Installing collected packages: turicreate
Running setup.py install for turicreate ... error
error: subprocess-exited-with-error
× Running setup.py install for turicreate did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
running install
/root/turitest/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
==================================================================================
TURICREATE ERROR
If you see this message, pip install did not find an available binary package
for your system.
Supported Platforms:
* macOS 10.12+ x86_64.
* Linux x86_64 (including WSL on Windows 10).
Support Python Versions:
* 2.7
* 3.5
* 3.6
* 3.7
* 3.8
Another possible cause of this error is an outdated pip version. Try:
`pip install -U pip`
==================================================================================
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> turicreate
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
`
pip version - 22.0.2
python3.10 (I guess this maybe the problem, but I'm not sure)
windows10 OS
can someone help me to install turicreate...
I tried updating and upgrading pip versions, tried in python 2.7 and python3.10 but still got the same error.
I also tried this command,
python3 -m pip3 install -U pip
this returned
No module named pip3

Installing dlib in Python

I want to install face_recognition for a project that I am about to start. However, face_recognition has a dependency on dlib and I don't know how to install that.
I entered pip install dlib, however, an error was thrown since it said that I needed to install CMake. Here is the error:
Using cached dlib-19.24.0.tar.gz (3.2 MB)
Preparing metadata (setup.py) ... done
Installing collected packages: dlib
DEPRECATION: dlib is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running install
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
ERROR: CMake must be installed to build dlib
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Thus, I tried to install CMake:
Collecting CMake
Using cached cmake-3.25.0-py2.py3-none-win_amd64.whl (32.6 MB)
Installing collected packages: CMake
WARNING: The scripts cmake.exe, cpack.exe and ctest.exe are installed in 'C:\Users\Emma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed CMake-3.25.0
However, when I tried to install dlib again, I got the same error even though I installed CMake successfully.
How could I install dlib now? For reference, I am using a Windows 10 or 11 system, and Python 3.11 64-bit.
Update/Install Visual C++
Maybe try installing/updating Visual C++. Because this is necessary for CMake to run. You can install it from here, https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#
Installation with Wheel File
Run this:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Installation from Internet
Install CMake from https://cmake.org/download/
Run this,
set PATH="%PATH%;C:\Program Files\CMake\bin
to add CMake to your path. You can also do this manually by Editing The Environment Variables.
3)Download the following,
https://pypi.org/project/dlib/#files.
In the specified folder in which you extracted the install files run the following,
python setup.py install.

Cannot install Scipy in FreeBSD 13 with Python 3.10

I am trying install scipy in FreeBSD 13. I have built python 3.10 on FreebSD 13 and managed to install pandas, matplotlib and numpy on a virtual environment which has python 3.10. However, when I try to install sklearn or scipy I get an error saying scipy could not be installed.
Here it is below for when doing pip install scipy. I get the same error more or less when trying to install sklearn.
ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy, which is required to install pyproject.toml-based projects
Command errored out with exit status 1: /home/schroter/.pymain/dataViz/bin/python3 /tmp/pip-standalone-pip-d3nnvp2f/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-xp_669rf/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0' Check the logs for full command output.
My pip list is as below:
(dataViz) schroter#SCHROTER:~ % pip list
Package Version
---------------- -------
cycler 0.11.0
kiwisolver 1.1.0
matplotlib 3.4.3
numpy 1.21.4
pandas 1.3.4
Pillow 8.4.0
pip 21.3.1
pyparsing 3.0.6
python-dateutil 2.8.2
pytz 2021.3
semantic-version 2.8.5
setuptools 58.5.3
setuptools-rust 0.12.1
six 1.16.0
toml 0.10.2
wheel 0.37.0
Would anyone be able to help me in this regards please?
Thanks & Best Regards
Schroter
Reuse system package
# install system-wide version in site-packages
doas pkg install py38-scipy-1.8.0
# create a virtualenv with site-packages included
python -m venv --system-site-packages .venv
Drawback is you'll get all packages from site-packages, however you can tackle that by
doas pkg install py38-scipy-1.8.0
python -m venv .venv
YOUR_PYTHON_VERSION= SET IT HERE
ln -s $(python -c 'import lxml, os.path; print(os.path.dirname(lxml.__file__)') ./.venv/lib/$YOUR_PYTHON_VERSION/site-packages
borrowed from https://stackoverflow.com/a/13719417
Regular Installation (TODO)
Haven't figured out it yet, but maybe someone else will, so putting here 2 links which might be helpful
https://forums.freebsd.org/threads/python-scipy-with-python3-x-on-freebsd-11.59009/
https://reviews.freebsd.org/D23447
Have you tried to install scipy from freebsd ports? The freebsd ports contain patches to make the code compile on FreeBSD.

Unable to build opencv-python with python 3.8

OS:ubuntu
I am able to install opencv-python from the command line. However,when I tried to install my self-built package with opencv-python dependencies, it failed to biuld:
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (PEP 517): started
Building wheel for opencv-python (PEP 517): finished with status 'error'
ERROR: Complete output from command /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp7jntqv2r:
ERROR: Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
-- Trying "Unix Makefiles" generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
It can be installed using debian package manager:
sudo apt-get install build-essential
To build compliant wheels, consider using the manylinux system described in PEP-513.
Get it with "dockcross/manylinux-x64" docker image:
https://github.com/dockcross/dockcross#readme
For more details, please refer to scikit-build documentation:
http://scikit-build.readthedocs.io/en/latest/generators.html#linux
********************************************************************************
----------------------------------------
ERROR: Failed building wheel for opencv-python
I suspect issue is with scikit-build. I checked I have ninja, make/gcc all available. I set manually CMAKE_MAKE_PROGRAM=/usr/bin/make.
But still failed with same error. I
You are missing dependencies. Please see this part of the error message you have provided above:
Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
It can be installed using debian package manager:
sudo apt-get install build-essential
Therefore, please use apt-get to install the build tools required to build your package.
Run pip3 install -U pip before install opencv-python.
Finally figured out, when I installed locally I had a requirements with version 4.1.x and no issues. When I install with the dependencies, it fetches the latest version 4.4 and the issue is that 1) pip version is 19.1 and2) since 4.3 opencv, the wheels has been replaced.

Error installing Firefox 'marionette_driver' python package

Error installing Mozilla automation client 'marionette_driver'.
Mozilla documentation says to install with the following command:
$ pip install marionette_driver
This produces an error:
Collecting marionette_driver
Downloading marionette_driver-2.2.0.tar.gz
Collecting mozrunner>=6.13 (from marionette_driver)
Downloading mozrunner-6.13.tar.gz (67kB)
100% |████████████████████████████████| 71kB 1.5MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0829rk11/mozrunner/setup.py", line 24, in
<module>
assert sys.version_info[0] == 2
AssertionError
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-build-0829rk11/mozrunner/
These variations of the pip install command produce the same error.
$ sudo pip install marionette_driver
$ sudo -H pip install marionette_driver
$ pip3 install marionette_driver
$ sudo pip3 install marionette_driver
$ sudo -H pip3 install marionette_driver
(debian systems seem to require pip3 to install python3 packages, while it has been suggested the egg_info error can be avoided by using sudo -H. seems to make no difference.)
I have both Python 2.7 and 3.5 installed. I would normally expect pip to install python 2 packages. But I use 3.5, so what do I know? Anyway, the same error occurs using pip and pip3.
The error occurs when you install the mozrunner dependency of marionette_driver. The error message indicates that it is checking that it is running on Python version 2.x (assert sys.version_info[0] == 2), which fails as you would expect. Unfortunately, at time of writing, there is not Python 3 compatible version of mozrunner, so it looks like you will not be able to install marionette_driver for Python 3.
If you are using virtual environments (e.g. with virtualenv, anaconda, or similar), you should be able to create a Python 2 environment and install it there with pip.
Also, on most Unix-like systems, you can install both Python 2 and 3. Usually, the executables will be called python2 and python3, with one of them sym-linked to the default python. The same goes for the corresponding pip2 and pip3 executables. You may have better luck running your installation via pip2, if you have Python 2 installed on your system.

Resources