Error When Using Pip To Get Python Packages On Linux Terminal - python

When I try to install a python package (cryptography in this case) in the Linux terminal, I get an error. I am using Python version 3.8. Here's the code:
Input:
python3.8 -m pip install cryptography or pip install cryptography
Output (anything after "Installing build dependencies ... error" is in RED):
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting cryptography
Using cached cryptography-36.0.1.tar.gz (572 kB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8
/usr/local/lib/python3.8/site-packages/pip install --ignore-installed
--no-user --prefix /tmp/pip-build-env-j3i9og4s/overlay
--no-warn-script-location --no-binary :none: --only-binary :none: -i
https://pypi.org/simple --extra-index-url
https://www.piwheels.org/simple -- 'setuptools>=40.6.0' wheel
'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"''
'setuptools-rust>=0.11.4'
cwd: None
Complete output (26 lines):
Looking in indexes: https://pypi.org/simple,
https://www.piwheels.org/simple, https://www.piwheels.org/simple
Collecting setuptools>=40.6.0
Using cached setuptools-60.9.3-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting cffi>=1.12
Using cached cffi-1.15.0.tar.gz (484 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8 -c 'import sys, setuptools,
tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-9sokml3p/cffi/setup.py'"'"';
__file__='"'"'/tmp/pip-install-9sokml3p/cffi/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 /tmp/pip-pip-egg-info-5ylb3zxi
cwd: /tmp/pip-install-9sokml3p/cffi/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py",
line 19, in <module>
from setuptools.dist import Distribution
File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py",
line 34, in <module>
from setuptools import windows_support
File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py",
line 2, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py
egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 22.0.3
is available.
You should consider upgrading via the '/usr/local/bin/python3.8 -m
pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 1:
/usr/local/bin/python3.8 /usr/local/lib/python3.8/site-packages/pip
install --ignore-installed --no-user --prefix
/tmp/pip-build-env-j3i9og4s/overlay --no-warn-script-location
--no-binary :none: --only-binary :none: -i https://pypi.org/simple
--extra-index-url https://www.piwheels.org/simple --
'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation
!= '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4' Check the logs for full
command output.
I don't really understand what this means, and I'd like some assistance installing a package and trying to fix this error. Thanks! -Shane
EDIT: I found near the beginning the text 'Command errored out with exit status 1'
EDIT: I have installed libffi-dev.

Solved by upgrading pip to pip3 using sudo apt-get -y install python3-pip.

Looks like you may need to install libffi-dev. I'm not sure your distro, but it'll be there. Distro is raspbian.
Install with:
apt-get install libffi-dev
There are other questions that looks similar since they have the _ctypes issue, but I won't mark this as a duplicate since your question is exactly the same. I think the underlying root cause is probably the same. See here and here.

Related

Error installing any libraries in paycharm

After calling the "pip install" command of any library, an error occurs:
ERROR: Command errored out with exit status 2:
command: 'c:\users\roman\appdata\local\programs\python\python38\python.exe' 'c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip' install -
-ignore-installed --no-user --prefix 'C:\Users\roman\AppData\Local\Temp\pip-build-env-2tu6fau4\overlay' --no-warn-script-location --no-binary :none: --only-binary :no
ne: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (24 lines):
Collecting setuptools>=40.8.0
Using cached setuptools-67.0.0-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Installing collected packages: setuptools, wheel
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
status = self.run(options, args)
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
return func(self, options, args)
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 412, in run
installed = install_given_reqs(
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\req\__init__.py", line 82, in install_given_reqs
requirement.install(
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\req\req_install.py", line 778, in install
scheme = get_scheme(
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\locations.py", line 185, in get_scheme
scheme = distutils_scheme(
File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\locations.py", line 118, in distutils_scheme
assert not (home and prefix), "home={} prefix={}".format(home, prefix)
AssertionError: home=C:\Users\roman\AppData\Local\Temp\pip-target-tdo35poo prefix=C:\Users\roman\AppData\Local\Temp\pip-build-env-2tu6fau4\overlay
WARNING: You are using pip version 20.2.1; however, version 22.3.1 is available.
You should consider upgrading via the 'c:\users\roman\appdata\local\programs\python\python38\python.exe -m pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 2: 'c:\users\roman\appdata\local\programs\python\python38\python.exe' 'c:\users\roman\appdata\local\programs\python\python
38\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\roman\AppData\Local\Temp\pip-build-env-2tu6fau4\overlay' --no-warn-script-location -
-no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.`
Important nuances:
I have a new project in paycharm without modules.
Pure Python 3.9
pip (python 3.8).
I am not an admin in Windows 10 system.
I correctly added Python 3.9 to the system path.
Installing libraries through the interpreter settings also gives the same error
I reinstalled python and paycharm
I tried writing pip3 and --no-user
Upon googling the error assert not (home and prefix), we can find this pypa/pip issue where someone has solved this by making sure their pip.conf doesn't have a target line.
You should make sure your pip configuration files don't have extraneous cruft left over in them and/or that nothing has set a PIP_TARGET environment variable or similar.

Error installing pandas for python 3.7.12

Context:
I am using the brand new MacBook pro with M1 pro, it has macOS Monterey 12.0 it is only has a week old.
I installed pyenv with brew and then I installed version 3.7.12, I wanted to create a venv and install pandas inside it but by mistake, I started to install it on the pyenv of the 3.7.12 without the venv created. When it was executing the installation and I realized I pressed Command + C and stopped.
After that, I created the venv "cosa5" and try to install it but it showed me the following error:
(cosa5) matiasnavarrete#MacBook-Pro-de-Matias codetest % pip install pandas
Collecting pandas
Using cached pandas-1.3.4.tar.gz (4.7 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python /Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-build-env-44pq47ee/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=51.0.0' wheel 'Cython>=0.29.24,<3' 'oldest-supported-numpy>=0.10'
cwd: None
Complete output (29 lines):
Collecting setuptools>=51.0.0
Using cached setuptools-59.4.0-py3-none-any.whl (952 kB)
Collecting wheel
Using cached wheel-0.37.0-py2.py3-none-any.whl (35 kB)
Collecting Cython<3,>=0.29.24
Using cached Cython-0.29.24-py2.py3-none-any.whl (979 kB)
Collecting oldest-supported-numpy>=0.10
Using cached oldest_supported_numpy-0.12-py3-none-any.whl (3.8 kB)
Collecting numpy==1.14.5; python_version == "3.7" and platform_machine != "aarch64" and platform_system != "AIX" and platform_python_implementation != "PyPy"
Using cached numpy-1.14.5.zip (4.9 MB)
ERROR: Command errored out with exit status 1:
command: /Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-install-r3mgeudj/numpy/setup.py'"'"'; __file__='"'"'/private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-install-r3mgeudj/numpy/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 /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-pip-egg-info-h4uqe4mm
cwd: /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-install-r3mgeudj/numpy/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist import Distribution
File "/Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/Users/matiasnavarrete/.pyenv/versions/3.7.12/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.
You should consider upgrading via the '/Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python -m pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python /Users/matiasnavarrete/Desktop/codetest/cosa5/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/4p/syttjfhj7896l__s3gtxnxkm0000gn/T/pip-build-env-44pq47ee/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=51.0.0' wheel 'Cython>=0.29.24,<3' 'oldest-supported-numpy>=0.10' Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.
You should consider upgrading via the '/Users/matiasnavarrete/Desktop/codetest/cosa5/bin/python -m pip install --upgrade pip' command.
I don't know if the fact that I stopped it is related to the bug or not, but I mentioned it anyway.
Tried uninstalling 3.7.12 from pyenv, installing it again, creating a new venv but it keeps showing the same error.
After this I installed 3.9.9, I created the venv and I installed pandas and I had no problem with that version. It is 3.7.12 that keeps giving me problems.
Question:
How can I fix it?

Errors when installing packages in Dockerfile (to run pythoscript with cron)

I have to schedule the execution of a python script within a docker container. My script uses several packages that I have to install, so this is my Dockerfile:
FROM python:3.9.0b4-alpine3.12
COPY AzureVM /bin/AzureVM
COPY root /var/spool/cron/crontabs/root
RUN pip install azure-common
RUN pip install azure-mgmt-compute
RUN pip install msrestazure
RUN pip install paramiko
RUN chmod +x /bin/AzureVM
CMD crond -l 2 -f
When I try to build the container, it gets huge errors for some of the packages (more specifically msrestazure and paramiko). For example:
Step 6/8 : RUN pip install msrestazure
---> Running in f02284bb6aee
Collecting msrestazure
Downloading msrestazure-0.6.4-py2.py3-none-any.whl (40 kB)
Requirement already satisfied: msrest<2.0.0,>=0.6.0 in /usr/local/lib/python3.9/site-packages (from msrestazure) (0.6.19)
Collecting adal<2.0.0,>=0.6.0
Downloading adal-1.2.4-py2.py3-none-any.whl (55 kB)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from msrestazure) (1.15.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (2020.6.20)
Requirement already satisfied: requests-oauthlib>=0.5.0 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (1.3.0)
Requirement already satisfied: requests~=2.16 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (2.24.0)
Requirement already satisfied: isodate>=0.6.0 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (0.6.0)
Collecting python-dateutil>=2.1.0
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting PyJWT>=1.0.0
Downloading PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)
Collecting cryptography>=1.1.0
Downloading cryptography-3.1.tar.gz (534 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-8e8f308c/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
cwd: None
Complete output (37 lines):
Collecting setuptools>=40.6.0
Downloading setuptools-50.3.0-py3-none-any.whl (785 kB)
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting cffi!=1.11.3,>=1.8
Downloading cffi-1.14.3.tar.gz (470 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5nw42fq5/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5nw42fq5/cffi/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 /tmp/pip-pip-egg-info-l9k0d28w
cwd: /tmp/pip-install-5nw42fq5/cffi/
Complete output (23 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-5nw42fq5/cffi/setup.py", line 163, in <module>
ask_supports_thread()
File "/tmp/pip-install-5nw42fq5/cffi/setup.py", line 81, in ask_supports_thread
config.try_compile('__thread int some_threadlocal_variable_42;'))
File "/usr/local/lib/python3.9/distutils/command/config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "/usr/local/lib/python3.9/distutils/command/config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "/usr/local/lib/python3.9/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/local/lib/python3.9/distutils/unixccompiler.py", line 117, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
File "/usr/local/lib/python3.9/distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/usr/local/lib/python3.9/distutils/spawn.py", line 74, in spawn
proc = subprocess.Popen(cmd, env=env)
File "/usr/local/lib/python3.9/subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.9/subprocess.py", line 1819, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gcc'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-8e8f308c/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install msrestazure' returned a non-zero code: 1
I tried to change the base image (slim, buster, slim-buster) and all the packages were installed, but then I got the following error every time:
Crond not found
When I try to schedule a simple script (without any strange installs) it works fine (only with python:3.9.0b4-alpine3.12). I don't know what to do, so please help!
Add this before running pip commands.
RUN apk add build-base libffi-dev openssl-dev --no-cache
Tested below Dockerfile. Rest steps you can add accordingly.
FROM python:3.9.0b4-alpine3.12
RUN apk add build-base libffi-dev openssl-dev --no-cache
RUN pip install azure-common \
&& pip install azure-mgmt-compute \
&& pip install msrestazure \
&& pip install paramiko

problem while installing gnuhealth client on centos 7

when i run the command ;
pip3 install --user --upgrade gnuhealth-client
it shows the same error msg everytime
gnuhealth#ghealth:~ $ pip3 install --user --upgrade gnuhealth-client
Collecting gnuhealth-client
Using cached gnuhealth-client-3.6.9.tar.gz (700 kB)
Collecting pycairo
Using cached pycairo-1.19.1.tar.gz (205 kB)
Requirement already satisfied, skipping upgrade: python-dateutil in ./.local/lib/python3.6/site-packages (from gnuhealth-client) (2.8.1)
Collecting PyGObject
Using cached PyGObject-3.36.1.tar.gz (716 kB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /home/gnuhealth/.local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-w04za2un/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
cwd: None
Complete output (31 lines):
Collecting setuptools
Using cached setuptools-49.6.0-py3-none-any.whl (803 kB)
Collecting wheel
Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting pycairo
Using cached pycairo-1.19.1.tar.gz (205 kB)
Using legacy 'setup.py install' for pycairo, since package 'wheel' is not installed.
Installing collected packages: setuptools, wheel, pycairo
Running setup.py install for pycairo: started
Running setup.py install for pycairo: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ax6ip1o2/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ax6ip1o2/pycairo/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-2p1yavr2/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-w04za2un/overlay --compile --install-headers /tmp/pip-build-env-w04za2un/overlay/include/python3.6m/pycairo
cwd: /tmp/pip-install-ax6ip1o2/pycairo/
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ax6ip1o2/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ax6ip1o2/pycairo/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-2p1yavr2/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-w04za2un/overlay --compile --install-headers /tmp/pip-build-env-w04za2un/overlay/include/python3.6m/pycairo Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /home/gnuhealth/.local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-w04za2un/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
what should i do ?
UPDATED ANSWER
It's PyGObject that is failing
try
sudo yum install gcc gobject-introspection-devel cairo-devel pkg-config python3-devel gtk3 cairo-gobject-devel
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
before attempting the pip install
This actually worked for me on Centos7

yfinance - ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

I am trying to install yfinance "sudo -H pip install yfinance" and keep getting the following error at the bottom of this post. I have uninstalled/installed pip. I have uninstalled/installed setuptools via pip and have tried the following commands:
python3 -m ensurepip --upgrade
Requirement already up-to-date: setuptools in /usr/local/lib/python3.8/site-packages (49.2.0)
Requirement already up-to-date: pip in /usr/local/lib/python3.8/site-packages (20.1.1)
pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python3.8/site-packages (20.1.1)
pip install --upgrade setuptools
Requirement already up-to-date: setuptools in /usr/local/lib/python3.8/site-packages (49.2.0)
Python Version
python --version
Python 3.8.3
Pip Version
pip --version
pip 20.1.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
System Update Checks
sudo apt-get upgrade
sudo apt-get update
Actual error code below when I run "sudo -H pip install yfinance"
*****#*******:~/Desktop/Project$ sudo -H pip install yfinance
Collecting yfinance
Using cached yfinance-0.1.54.tar.gz (19 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xpuca0pe/yfinance/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xpuca0pe/yfinance/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 /tmp/pip-pip-egg-info-1j4zanh6
cwd: /tmp/pip-install-xpuca0pe/yfinance/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 23, in <module>
from setuptools.dist import Distribution
File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
How do I fix this error?
After running this command it fixed the error.
Reference: https://packaging.python.org/tutorials/installing-packages/
sudo -H python -m pip install --upgrade pip setuptools wheel

Categories

Resources