Pip3 is not working Python 3.10 for pandas installation - pandas

I am trying to install pandas library for python with pip but I get this error. I don't understand how to fix, can someone help me?
pi#raspberrypi:~/Desktop $ pip3 install pandas
Collecting pandas==1.3.0 Using cached pandas-1.3.0.tar.gz (4.7 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [1350 lines of output]
[...] 1000 lines of stuff
rgument is of type ‘npy_longdouble *’ {aka ‘double *’}
__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
^
error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall
-fPIC -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DHAVE_CBLAS -DNO_ATLAS_INFO=-1 -Ibuild/src.linux-armv7l-3.10/numpy/core/src/umath -Ibuild/src.linux-armv7l-3.10/numpy/core/src/npymath -Ibuild/src.linux-armv7l-3.10/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-armv7l-3.10/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/include/python3.10 -Ibuild/src.linux-armv7l-3.10/numpy/core/src/common -Ibuild/src.linux-armv7l-3.10/numpy/core/src/npymath -c build/src.linux-armv7l-3.10/numpy/core/src/multiarray/scalartypes.c -o build/temp.linux-armv7l-3.10/build/src.linux-armv7l-3.10/numpy/core/src/multiarray/scalartypes.o -MMD -MF build/temp.linux-armv7l-3.10/build/src.linux-armv7l-3.10/numpy/core/src/multiarray/scalartypes.o.d -std=c99" failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.

Did you try to install numpy first in case you had an incompatible version?
pip install numpy

Try using the below code instead of pip3 install pandas
pip install pandas
or
pip install pandas=1.4.4

Related

How to install p4python on Cygwin64

Trying to install p4python on Cygwin fails with
$pip install p4python
[... logs ...]
File "/tmp/pip-install-6mn3hyn3/p4python_9e95a104710b449a90a68bc227a2ee69/setup.py", line 292, in run
raise Exception("Parameter --ssl is needed")
Exception: Parameter --ssl is needed
[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.
╰─> p4python
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I am using Cygwin64 on Windows 10, specifically:
$ pip --version
pip 22.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
$ python --version
Python 3.9.10
$ which python
/usr/bin/python
I tried using the wheel files from PyPi but there is no compatible platform for Cygwin.
How can I work around this ssl dependency to install the module?
I have included libssl while installing Cygwin.
Try
python -m pip install p4python

Installing Tensorflow on macOS on an Arm MBP

When attempting to install tensorflow on an ARM M1 MacBookPro, I am seeing the following issues:
% pip install tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
After searching around, I found a package called tensorflow-macos which produces the following issues:
clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.9-universal2-3.9/numpy/core/src/umath -Ibuild/src.macosx-10.9-universal2-3.9/numpy/core/src/npymath -Ibuild/src.macosx-10.9-universal2-3.9/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-10.9-universal2-3.9/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/thing/dev/SOTAMoon/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -Ibuild/src.macosx-10.9-universal2-3.9/numpy/core/src/common -Ibuild/src.macosx-10.9-universal2-3.9/numpy/core/src/npymath -c numpy/core/src/multiarray/descriptor.c -o build/temp.macosx-10.9-universal2-3.9/numpy/core/src/multiarray/descriptor.o -MMD -MF build/temp.macosx-10.9-universal2-3.9/numpy/core/src/multiarray/descriptor.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers -std=c99" failed with exit status 1
----------------------------------------
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/a7/81/20d5d994c91ed8347efda90d32c396ea28254fd8eb9e071e28ee5700ffd5/h5py-3.1.0.tar.gz#sha256=1e2516f190652beedcb8c7acfa1c6fa92d99b42331cbef5e5c7ec2d65b0fc3c2 (from https://pypi.org/simple/h5py/) (requires-python:>=3.6). Command errored out with exit status 1: /Users/thing/dev/SOTAMoon/venv/bin/python3 /private/var/folders/8k/z291bhgd5gs06tp9b4j6_bb40000gn/T/pip-standalone-pip-8qa87uy0/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/8k/z291bhgd5gs06tp9b4j6_bb40000gn/T/pip-build-env-bxy_nyoo/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'numpy==1.12; python_version == "3.6"' 'numpy==1.19.3; python_version >= "3.9"' 'numpy==1.14.5; python_version == "3.7"' pkgconfig 'Cython>=0.29; python_version < "3.8"' 'Cython>=0.29.14; python_version >= "3.8"' 'numpy==1.17.5; python_version == "3.8"' Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement h5py~=3.1.0 (from tensorflow-macos) (from versions: 2.2.1, 2.3.0b1, 2.3.0, 2.3.1, 2.4.0b1, 2.4.0, 2.5.0, 2.6.0, 2.7.0rc2, 2.7.0, 2.7.1, 2.8.0rc1, 2.8.0, 2.9.0rc1, 2.9.0, 2.10.0, 3.0.0rc1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.0)
ERROR: No matching distribution found for h5py~=3.1.0
Unfortunately I couldn't work out a solution to the 'faltivec' issue. I also found a tensorflow package made by Apple that seems specifically geared for M1's, however going by this tutorial produces the following issues:
% pip install --upgrade --force --no-dependencies https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
ERROR: tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform.
After this, I am a bit stuck. I have upgraded pip to 21.1.3, and my python version is Python 3.9.6.
Tensorflow-macos and Tensorflow-metal Install
Currently, to harness the M1 GPU you need to install Tensorflow-macos and TensorFlow-metal as opposed to Tensorflow, the install steps are detailed here, they can be summarized as follows using mini-forge:
conda create -n tf python=3.8 -y
conda activate tf
conda install -c apple tensorflow-deps -y
# Navigate the issue with conda environments
# built against pre-macOS 11 SDK use (Just in case)
# this solves the Intel / M1 install issues:
SYSTEM_VERSION_COMPAT=0 pip install tensorflow-macos
SYSTEM_VERSION_COMPAT=0 pip install tensorflow-metal
to test all is well we can run:
#!/usr/bin/env bash
PYCMD=$(cat <<EOF
import tensorflow as tf
tf.config.list_physical_devices()
with tf.device('/GPU'):
a = tf.random.normal(shape=(2,), dtype=tf.float32)
b = tf.nn.relu(a)
print(a)
print(b)
EOF
)
python3 -c "$PYCMD" 2>/dev/null
the expected output for my test machine:
>./val.sh
Metal device set to: Apple M1
systemMemory: 16.00 GB
maxCacheSize: 5.33 GB
tf.Tensor([-0.4044231 0.08157467], shape=(2,), dtype=float32)
tf.Tensor([0. 0.08157467], shape=(2,), dtype=float32)
ok, everything is (assumed) to be working...
Side-Note: Package Install Issues:
One thing to note is that that packages that rely on tensorflow will try to install tensorflow as they will likely not have an explicit dependency on tensorflow-macos or tensorflow-metal.
When you install tensorflow dependent packages or code you'll likely have to review the requirements.txt file before running:
python3 pip install -r requirements.txt
The requirements.txt will try to install the tensorflow package, not the tensorflow-macosx or tensorflow-metal packages which will result in a host of issues if you run the requirements.txt file unchanged. That and explicit versions of packages == which can also cause problems.
Hopefully, this points you in the right direction in thinking about the hurdles involved in getting python to work with the Apple-M1 laptops using the TensorFlow metal plugin to harness the M1 GPU features.
Stay safe and well.
try
python3 -m pip install tensorflow-macos
python3 -m pip install tensorflow-metal
you may also need:
brew install hdf5
export HDF5_DIR=$(brew --prefix hdf5)

No module named pytrustnfe.nfe (Odoo Server Error)

I have some problems to install Odoo Module named ODOO BRASIL - MODULO BASE (br_base).
The error message is:
O módulo "br_base" não pode ser instalado porque uma dependência
externa não foi encontrada: No module named pytrustnfe.nfe
Translating:
The module "br_base not be installed because external dependency not
founded: No module named pytrustnfe.nfe
If you are using Linux:
pip install PyTrustNFe
The dependency of PyTrustNFe called xmlsec didn't installed. When I try install this dependency I had this.
[root#agileweb ~]# pip install xmlsec
Collecting xmlsec
Using cached https://files.pythonhosted.org/packages/35/42/d7cd323c91d4706f3cc32ffe7d5f851ab8ef9898ccb350f6ba593dd8b89a/xmlsec-1.3.3.tar.gz
Requirement already satisfied: pkgconfig in /usr/lib/python2.7/site-packages (from xmlsec) (1.3.1)
Requirement already satisfied: lxml>=3.0 in /usr/lib64/python2.7/site-packages (from xmlsec) (3.7.1)
Building wheels for collected packages: xmlsec
Running setup.py bdist_wheel for xmlsec ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk_Ibz/xmlsec/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-Vx1fna --python-tag cp27:
running bdist_wheel
running build
running build_ext
*********************************************************************************
Could not find xmlsec1 config. Are libxmlsec1-dev and pkg-config installed?
*********************************************************************************
----------------------------------------
Failed building wheel for xmlsec
Running setup.py clean for xmlsec
Failed to build xmlsec
Installing collected packages: xmlsec
Running setup.py install for xmlsec ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk_Ibz/xmlsec/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-record-qiBfpy/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
*********************************************************************************
Could not find xmlsec1 config. Are libxmlsec1-dev and pkg-config installed?
*********************************************************************************
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk_Ibz/xmlsec/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-record-qiBfpy/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-sk_Ibz/xmlsec/
The correct command to solve this problem would be PIP3 since this dependency is getting deprecated in python2.7
pip3 install PyTrustNFe3==1.0.35

Installing seaborn on Docker Alpine

I am trying to install seaborn with this Dockerfile:
FROM alpine:latest
RUN apk add --update python py-pip python-dev
RUN pip install seaborn
CMD python
The error I get is related to numpy and scipy (required by seaborn). It starts with:
/tmp/easy_install-nvj61E/numpy-1.11.1/setup.py:327: UserWarning:
Unrecognized setuptools command, proceeding with generating Cython
sources and expanding templates
and ends with
File "numpy/core/setup.py", line 654, in get_mathlib_info
RuntimeError: Broken toolchain: cannot link a simple C program
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-DZ4cXr/scipy/
The command '/bin/sh -c pip install seaborn' returned a non-zero code: 1
Any idea how I can fix this?
To fix this error, you need to install gcc: apk add gcc.
But you will see that you will hit a new error as numpy, matplotlip and scipy have several dependencies. You need to also install gfortran, musl-dev, freetype-dev, etc.
Here is a Dockerfile based on you initial one that will install those dependencies as well as seaborn:
FROM alpine:latest
# install dependencies
# the lapack package is only in the community repository
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk --update add --no-cache \
lapack-dev \
gcc \
freetype-dev
RUN apk add python py-pip python-dev
# Install dependencies
RUN apk add --no-cache --virtual .build-deps \
gfortran \
musl-dev \
g++
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
RUN pip install seaborn
# removing dependencies
RUN apk del .build-deps
CMD python
You'll notice that I'm removing the dependencies using apk-del .build-deps to limit the size of your image (http://www.sandtable.com/reduce-docker-image-sizes-using-alpine/).
Personally I also had to install ca-certificates but it seems you didn't have this issue.
Note: You could also build your image FROM the python:2.7-alpine image to avoid installing python and pip yourself.

pip install matplotlib fails: 'cannot build package freetype; "python setup.py egg_info" failed with error code 1'

I want to use matplotlib.pyplot. I can't because
altoidnerd#LEPTON:~/ $ pip install matplotlib
is failing on ubuntu 14 giving an egg_info error, and warning "cannot build package freetype"
* The following required packages can not be built:
* freetype
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-8UvQcW/matplotlib
But
altoidnerd#LEPTON:~/$ dpkg -L libfreetype6
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libfreetype.so.6.11.1
/usr/share
/usr/share/doc
/usr/share/doc/libfreetype6
/usr/share/doc/libfreetype6/FTL.TXT.gz
/usr/share/doc/libfreetype6/ft2faq.html
/usr/share/doc/libfreetype6/TODO
/usr/share/doc/libfreetype6/copyright
/usr/share/doc/libfreetype6/changelog.Debian.gz
/usr/share/doc/libfreetype6/pcf
/usr/share/doc/libfreetype6/pcf/README
/usr/lib/x86_64-linux-gnu/libfreetype.so.6
my debug.log is here: http://pastebin.com/rvDuYDiy
A discussion about this on github was closed last year, but I was unable to use it to solve the problem (I left a note):
https://github.com/matplotlib/matplotlib/issues/3029
I started a reddit thread too.
This did the trick for me:
sudo apt-get install libfreetype6-dev pkg-config
The following command mentioned in the github thread that you mentioned above works for me:
sudo ln -s /usr/include/freetype2/ft2build.h /usr/include/
I had a similar issue solved by:
easy_install -U pip
pip install matplotlib