#python #gcc #pip #ctypes #python-wheel
Вопрос:
Я пытаюсь загрузить оболочку python TA-Lib в Debian, и у меня не было проблем с установкой библиотеки c, однако при запуске:
pip3 install -v --upgrade --global-option=build_ext --global-option="-L /usr/lib" --global-option="-I /usr/include" --prefix="/usr" TA-Lib
Я получаю:
x86_64-linux-gnu-gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files
Я где-то читал, что иногда эта ошибка возникает из-за отсутствия библиотек, таких как библиотеки python-dev, поэтому я пытаюсь понять, что это за библиотеки, которых мне не хватает, или ошибка вызвана чем-то другим.
Вот весь журнал:
/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py:232: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
cmdoptions.check_install_build_global(options)
Using pip 21.1.3 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)
Non-user install due to --prefix or --target option
Created temporary directory: /tmp/pip-ephem-wheel-cache-feaxl0k8
Created temporary directory: /tmp/pip-req-tracker-ef3s5f1v
Initialized build tracking at /tmp/pip-req-tracker-ef3s5f1v
Created build tracker: /tmp/pip-req-tracker-ef3s5f1v
Entered build tracker: /tmp/pip-req-tracker-ef3s5f1v
Created temporary directory: /tmp/pip-install-f0dgr57t
1 location(s) to search for versions of ta-lib:
* https://pypi.org/simple/ta-lib/
Fetching project page and analyzing links: https://pypi.org/simple/ta-lib/
Getting page https://pypi.org/simple/ta-lib/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/ta-lib/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/ta-lib/ HTTP/1.1" 304 0
Found link https://files.pythonhosted.org/packages/87/d3/59094a1816233adcb27159d4b0b54982eb5bde4513dba4d4f2e4f0467e3c/TA-Lib-0.4.9.tar.gz#sha256=102f7f763a90ae72dcbe9f842ec7e656007c0b4aa234899425f8be226e9c1cb9 (from https://pypi.org/simple/ta-lib/), version: 0.4.9
Found link https://files.pythonhosted.org/packages/0d/85/d80e736cafde6239eef73dabf2b5d5db53ccb5552526a1c4b127caafe917/TA-Lib-0.4.9.zip#sha256=0601c6f7007c3cf4f585dd6fd45df55720ab38bcd91f19abb807cbcbe9f5b42a (from https://pypi.org/simple/ta-lib/), version: 0.4.9
Found link https://files.pythonhosted.org/packages/23/ac/da20341c64ae569535eaa786f849a598015ea77e5b6d957d3c674a35b01c/TA-Lib-0.4.14.tar.gz#sha256=375edf46c146d4d7b35e305bd06096acc7dd1728ff6dff2058cc21289f9b18a9 (from https://pypi.org/simple/ta-lib/), version: 0.4.14
Found link https://files.pythonhosted.org/packages/89/27/c3f1be143905daf12ca4c9a52e4f5cc538a97ad01b9cd0123fe7643666fd/TA-Lib-0.4.15.tar.gz#sha256=811d0ba366d243e2b158de1f5678f53171741e802319f8e0e7840e721fb51c0e (from https://pypi.org/simple/ta-lib/), version: 0.4.15
Found link https://files.pythonhosted.org/packages/0a/7d/a5f64eadbac6cf7ee41f9ae88fcfee1ff0824ffea529efe1e5cb2dd7e60b/TA-Lib-0.4.16.tar.gz#sha256=555f5d9e6720ef935669c1f404a7179091ae35869c6435957709a7059b9fd1d7 (from https://pypi.org/simple/ta-lib/), version: 0.4.16
Found link https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz#sha256=16ab1e33c547fe72c10c28b02f6ae342fbcc7eef6a49ba961c639a6020aba56a (from https://pypi.org/simple/ta-lib/), version: 0.4.17
Found link https://files.pythonhosted.org/packages/d7/15/ebf1a6ebcf7580dc53e342979c7425affc38ef272bc10a7f4565ee87b394/TA-Lib-0.4.18.tar.gz#sha256=261d88fbca4b1923b37e0aad23512bc9b9245726c187344e432ee6a4a9a134a8 (from https://pypi.org/simple/ta-lib/), version: 0.4.18
Found link https://files.pythonhosted.org/packages/ac/cf/681911aa31e04ba171ab4d523a412f4a746e30d3eacb1738799d181e028b/TA-Lib-0.4.19.tar.gz#sha256=5303227898f8f08baecb4d3b8767c85891b65b21f481a3ecbaa6e901c3531db5 (from https://pypi.org/simple/ta-lib/), version: 0.4.19
Found link https://files.pythonhosted.org/packages/1f/fd/cb3b4255f2639e3478d75750d06e0d8f3342d7f8f28e8d855198769d3ede/TA-Lib-0.4.20.tar.gz#sha256=89947bf28d265bb632060bdba77eb4f4d0e812c4e918c7377f129b4a3ee9a8e9 (from https://pypi.org/simple/ta-lib/), version: 0.4.20
Skipping link: not a file: https://pypi.org/simple/ta-lib/
Given no hashes to check 9 links for project 'ta-lib': discarding no candidates
Collecting TA-Lib
Created temporary directory: /tmp/pip-unpack-dp8q5j_k
Looking up "https://files.pythonhosted.org/packages/1f/fd/cb3b4255f2639e3478d75750d06e0d8f3342d7f8f28e8d855198769d3ede/TA-Lib-0.4.20.tar.gz" in the cache
Current age based on date: 480075
Ignoring unknown cache-control directive: immutable
Freshness lifetime from max-age: 365000000
The response is "fresh", returning cached response
365000000 > 480075
Using cached TA-Lib-0.4.20.tar.gz (266 kB)
Added TA-Lib from https://files.pythonhosted.org/packages/1f/fd/cb3b4255f2639e3478d75750d06e0d8f3342d7f8f28e8d855198769d3ede/TA-Lib-0.4.20.tar.gz#sha256=89947bf28d265bb632060bdba77eb4f4d0e812c4e918c7377f129b4a3ee9a8e9 to build tracker '/tmp/pip-req-tracker-ef3s5f1v'
Running setup.py (path:/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py) egg_info for package TA-Lib
Created temporary directory: /tmp/pip-pip-egg-info-ka1a0ro3
Running command python setup.py egg_info
running egg_info
creating /tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info
writing /tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file '/tmp/pip-pip-egg-info-ka1a0ro3/TA_Lib.egg-info/SOURCES.txt'
Source in /tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f has version 0.4.20, which satisfies requirement TA-Lib from https://files.pythonhosted.org/packages/1f/fd/cb3b4255f2639e3478d75750d06e0d8f3342d7f8f28e8d855198769d3ede/TA-Lib-0.4.20.tar.gz#sha256=89947bf28d265bb632060bdba77eb4f4d0e812c4e918c7377f129b4a3ee9a8e9
Removed TA-Lib from https://files.pythonhosted.org/packages/1f/fd/cb3b4255f2639e3478d75750d06e0d8f3342d7f8f28e8d855198769d3ede/TA-Lib-0.4.20.tar.gz#sha256=89947bf28d265bb632060bdba77eb4f4d0e812c4e918c7377f129b4a3ee9a8e9 from build tracker '/tmp/pip-req-tracker-ef3s5f1v'
Requirement already satisfied: numpy in ./.local/lib/python3.7/site-packages (from TA-Lib) (1.21.0)
Created temporary directory: /tmp/pip-unpack-tp2vuc31
Skipping wheel build for TA-Lib, due to binaries being disabled for it.
Installing collected packages: TA-Lib
Created temporary directory: /tmp/pip-record-f8r8mvze
Running command /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-L /usr/lib' '-I /usr/include' install --record /tmp/pip-record-f8r8mvze/install-record.txt --single-version-externally-managed --prefix /usr --compile --install-headers /usr/include/python3.7m/TA-Lib
running build_ext
building 'talib._ta_lib' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/talib
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security /usr/include/python3.7m/Python.h -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/home/admin/.local/lib/python3.7/site-packages/numpy/core/include -I /usr/include -I/usr/include/python3.7m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.7/talib/_ta_lib.o
**x86_64-linux-gnu-gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files**
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Running setup.py install for TA-Lib ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-L /usr/lib' '-I /usr/include' install --record /tmp/pip-record-f8r8mvze/install-record.txt --single-version-externally-managed --prefix /usr --compile --install-headers /usr/include/python3.7m/TA-Lib Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/req/req_install.py", line 825, in install
req_description=str(self.req),
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/install/legacy.py", line 81, in install
raise LegacyInstallFailure
pip._internal.operations.install.legacy.LegacyInstallFailure
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 402, in run
pycompile=options.compile,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/req/__init__.py", line 85, in install_given_reqs
pycompile=pycompile,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/req/req_install.py", line 829, in install
six.reraise(*exc.parent)
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/six.py", line 703, in reraise
raise value
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/install/legacy.py", line 71, in install
cwd=unpacked_source_directory,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/subprocess.py", line 278, in runner
spinner=spinner,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/subprocess.py", line 244, in call_subprocess
raise InstallationSubprocessError(proc.returncode, command_desc)
pip._internal.exceptions.InstallationSubprocessError: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f0dgr57t/ta-lib_258102545a5149f7ba867b1872fc1c3f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-L /usr/lib' '-I /usr/include' install --record /tmp/pip-record-f8r8mvze/install-record.txt --single-version-externally-managed --prefix /usr --compile --install-headers /usr/include/python3.7m/TA-Lib Check the logs for full command output.
Removed build tracker: '/tmp/pip-req-tracker-ef3s5f1v'
Комментарии:
1. Это потому, что Python.h также передается компилятору. Не знаю, почему это так (это в setup.py ). Скорее всего, не связаны, но замените в вашей команде pip3 :
--global-option="-L/usr/lib" --global-option="-I/usr/include"
(удалите пробелы после -I и -L )