I am getting an error while installtion the cx_oracle in my windows 10
python version 3.8 (win32)
oracle client 12.0
this error i am getting while installing
please note i am new to Python
error log
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x048CDC40>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’)’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x048CD958>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’)’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x048CD8E0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’)’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x048CD868>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’)’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(‘<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x048CD088>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’)’: /simple/cx-oracle/
ERROR: Could not find a version that satisfies the requirement cx_Oracle (from versions: none)
ERROR: No matching distribution found for cx_Oracle
I have tried adding the proxy server also but getting this error after
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 404 Not Found’))’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 404 Not Found’))’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 404 Not Found’))’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 404 Not Found’))’: /simple/cx-oracle/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 404 Not Found’))’: /simple/cx-oracle/
ERROR: Could not find a version that satisfies the requirement cx_Oracle (from versions: none)
ERROR: No matching distribution found for cx_Oracle
Just wanted to share a solution that worked for me while resolving an issue installing cx_Oracle on my MacBook. I wanted to connect Python to an Oracle Database. I installed Oracle Instant Client 18c from here. I clicked on “Instant Client for Mac OS X (Intel x86)(32 bit and 64 bit). Then I downloaded following :
- Basic Package - All files required to run OCI, OCCI and JDBC-OCI applications - The other 2 Downloads under Tools - optional packages.
On Mac, by default these downloads are unzipped. I copied all the files into a Single Folder and updated the .bash_profile with ORACLE_HOME. I made sure that I am able to execute sqlplus. Once done, I started the installation of cx_Oracle. Received the following error :
python -m pip install -U cx_oracle Collecting cx_oracle Using cached https://files.pythonhosted.org/packages/4b/aa/99e49d10e56ff0263a8927f4ddb7e8cdd4671019041773f61b3259416043/cx_Oracle-7.1.2.tar.gz Building wheels for collected packages: cx-oracle Building wheel for cx-oracle (setup.py) ... error Complete output from command /Users/vivek/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-install-kt4hhttb/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-wheel-5rm6ofqh --python-tag cp36: running bdist_wheel running build running build_ext building 'cx_Oracle' extension creating build creating build/temp.macosx-10.7-x86_64-3.6 creating build/temp.macosx-10.7-x86_64-3.6/src creating build/temp.macosx-10.7-x86_64-3.6/odpi creating build/temp.macosx-10.7-x86_64-3.6/odpi/src gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/vivek/anaconda3/include -arch x86_64 -I/Users/vivek/anaconda3/include -arch x86_64 -DCXO_BUILD_VERSION=7.1.2 -Iodpi/include -Iodpi/src -I/Users/vivek/anaconda3/include/python3.6m -c src/cxoBuffer.c -o build/temp.macosx-10.7-x86_64-3.6/src/cxoBuffer.o xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error: command 'gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for cx-oracle Running setup.py clean for cx-oracle Failed to build cx-oracle Installing collected packages: cx-oracle Running setup.py install for cx-oracle ... error Complete output from command /Users/vivek/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-install-kt4hhttb/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-record-08000fay/install-record.txt --single-version-externally-managed --compile: running install running build running build_ext building 'cx_Oracle' extension creating build creating build/temp.macosx-10.7-x86_64-3.6 creating build/temp.macosx-10.7-x86_64-3.6/src creating build/temp.macosx-10.7-x86_64-3.6/odpi creating build/temp.macosx-10.7-x86_64-3.6/odpi/src gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/vivek/anaconda3/include -arch x86_64 -I/Users/vivek/anaconda3/include -arch x86_64 -DCXO_BUILD_VERSION=7.1.2 -Iodpi/include -Iodpi/src -I/Users/vivek/anaconda3/include/python3.6m -c src/cxoBuffer.c -o build/temp.macosx-10.7-x86_64-3.6/src/cxoBuffer.o xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/Users/vivek/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-install-kt4hhttb/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-record-08000fay/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/63/_hp23hwx0kg3f469c_jqwzq00000gn/T/pip-install-kt4hhttb/cx-oracle/
The relevant error here was “xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)”, which is related to Xcode. To be honest, searched few solutions on google and finally got a solution which was to run download and install Xcode.
xcode-select --install
Just Download, Install Xcode and the installation went smooth. I can now connect python to an Oracle Database. Task accomplished 🙂
Viveks-MacBook-Air:~ vivek$ xcode-select --install xcode-select: note: install requested for command line developer tools Viveks-MacBook-Air:~ vivek$ python -m pip install -U cx_oracle Collecting cx_oracle Using cached https://files.pythonhosted.org/packages/4b/aa/99e49d10e56ff0263a8927f4ddb7e8cdd4671019041773f61b3259416043/cx_Oracle-7.1.2.tar.gz Building wheels for collected packages: cx-oracle Building wheel for cx-oracle (setup.py) ... done Stored in directory: /Users/vivek/Library/Caches/pip/wheels/5f/b1/97/adf672ad4ab215e227ba939604abccc086e16c91b04cccdcd7 Successfully built cx-oracle Installing collected packages: cx-oracle Successfully installed cx-oracle-7.1.2
One important point to remember is that while it says cx_oracle installed, while importing the module in Python Prompt or on Jupyter, it is cx_Oracle.
Command run: pip3 install -r requirements.txt
Building wheels for collected packages: cx-Oracle
Building wheel for cx-Oracle (pyproject.toml) … error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/d2/wtpwr5_x0rbg4f4079hy98c00000gn/T/tmphsc9ph_z
cwd: /private/var/folders/d2/wtpwr5_x0rbg4f4079hy98c00000gn/T/pip-install-1pf1t3bd/cx-oracle_26573c96c8354a0bbe8918e16aa299b2
Complete output (12 lines):
running bdist_wheel
running build
running build_ext
building ‘cx_Oracle’ extension
creating build
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/src
creating build/temp.macosx-10.9-x86_64-3.7/odpi
creating build/temp.macosx-10.9-x86_64-3.7/odpi/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DCXO_BUILD_VERSION=8.2.1 -Iodpi/include -Iodpi/src -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/cxoApiType.c -o build/temp.macosx-10.9-x86_64-3.7/src/cxoApiType.o
clang: error: invalid version number in ‘MACOSX_DEPLOYMENT_TARGET=11’
error: command ‘gcc’ failed with exit status 1
ERROR: Failed building wheel for cx-Oracle
I tried exporting MACOSX_DEPLOYMENT_TARGET=12 with same failure.
(‘platform.platform:’, ‘Darwin-21.1.0-x86_64-i386-64bit’)
(‘sys.maxsize > 2**32:’, True)
(‘platform.python_version:’, ‘2.7.18’)
- What versions are you using?
-
Is it an error or a hang or a crash?
-
What error(s) or behavior you are seeing?
- Include a runnable Python script that shows the problem.
Я пытаюсь установить cx_Oracle и получаю эту ошибку, у меня установлены последние setuptools и pip. У кого-нибудь была похожая проблема и как они ее решили?
У меня есть VISUAL STUDIO: см. изображение
введите описание изображения здесь
Processing c:....resourcescx_oracle-8.1.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: cx_Oracle
Building wheel for cx_Oracle (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for cx_Oracle (pyproject.toml) did not run successfully.
¦ exit code: 1
?-> [7 lines of output]
C:....2pip-build-env-806_5jc6overlayLibsite-packagessetuptoolsconfigexpand.py:144: UserWarning: File 'C:\....\2\pip-install-r8jb3ohi\cx-oracle_111cfa7e3d91425bb65e9a6baa89c82f\README.md' cannot be found
warnings.warn(f"File {path!r} cannot be found")
running bdist_wheel
running build
running build_ext
building 'cx_Oracle' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cx_Oracle
Failed to build cx_Oracle
ERROR: Could not build wheels for cx_Oracle, which is required to install pyproject.toml-based projects
1 ответ
Показанный вами образ содержит распространяемые файлы, а не саму Visual Studio! Вам нужно будет перейти по предоставленной ссылке, чтобы установить инструменты сборки Microsoft, если вы хотите собрать его самостоятельно.
Однако, если вы используете pip, вы должны иметь возможность загружать и устанавливать готовые двоичные файлы, что НАМНОГО проще! Команда для использования:
python -m pip install cx_Oracle
0
Anthony Tuininga
19 Май 2022 в 23:33