oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
308 stars 61 forks source link

Could not build wheels for oracledb, which is required to install pyproject.toml-based project #264

Closed avijit09 closed 6 months ago

avijit09 commented 6 months ago

I was trying to install a specific of oracledb==1.0.3 via Anaconda Prompt by running the following script

pip install oracledb==1.0.3

I have created a virtual environment where I was trying to install that specific package.

with the latest version I am getting this error "time zones are not supported in thin mode". Therefore, need to install 1.0.3

I m getting following error.,

Failed to build oracledb ERROR: Could not build wheels for oracledb, which is required to install pyproject.toml-based projects

and

DPY-3022: named time zones are not supported in thin mode

I need to run it in thin client

Any help would be appreciated

cjbj commented 6 months ago

You don't need/want 1.0.3. It has the same support but without the good behavior of failing gracefully with the DPY-3022. You should use the latest version and use a numeric timezone offset in Thin mode. Or use Thick mode.

avijit09 commented 6 months ago

Thanks for your reply. Tried using a numeric timezone offset in Thin mode. but still the same. Is there any other way to fix this?

cjbj commented 6 months ago

Same what?

Share some code and your environment setup so we can help further.

avijit09 commented 6 months ago

I tried something like this in oracle config function;

'connection_details' : { 'host':'hostname', 'port': 0000, 'service': 'servicename', 'sid':sadfsdfsdfsd5445; 'user': '', 'pass' : '', 'timezone' = '+11:00', },

Still get the same error while trying to connect to oracledb via jupyter notebook in my anaconda environment.

DPY-3022: named time zones are not supported in thin mode.

&

Building wheel for oracledb (pyproject.toml) did not run successfully.

Unfortunately, I need to use thin mode. I just somehow need to install 1.0.3

anthony-tuininga commented 6 months ago

You should be able to simply do pip install oracledb==1.0.3 which should download and install that particular version without needing to build it.

Please be aware, however, that versions earlier than 1.3.0 won't raise an error when a named time zone is detected -- but they also won't return correct data! Your dictionary of connection_details doesn't really help much either as the parameters are invalid for the oracledb.connect() call! Can you supply a standalone script that demonstrates your problem?

avijit09 commented 6 months ago

Hi Anthony, thanks for your reply. I did everything to install version 1.0.3. One of my team member could able to install the package and he didnt report any data loss after connecting to the db. I am not sure why I cant do the pip when others can!.

I can share the below but not sure it demonstrates my problem well ;

oracle_config = { 'type_dictionary' : { 'DB_TYPE_BFILE':'oracledb.LOB', 'DB_TYPE_BINARY_DOUBLE':'float', 'DB_TYPE_BINARY_FLOAT':'float', 'DB_TYPE_BLOB':'oracledb.LOB', 'DB_TYPE_CHAR':'str', 'DB_TYPE_CLOB':'oracledb.LOB', 'DB_TYPE_CURSOR':'oracledb.Cursor', 'DB_TYPE_DATE':'datetime.datetime', 'DB_TYPE_INTERVAL_DS':'datetime.timedelta', 'DB_TYPE_JSON':'dict, list or a scalar value 4', 'DB_TYPE_LONG':'str', 'DB_TYPE_LONG_RAW':'bytes', 'DB_TYPE_NCHAR':'str', 'DB_TYPE_NCLOB':'oracledb.LOB', 'DB_TYPE_NUMBER':'float or int 1', 'DB_TYPE_NVARCHAR':'str', 'DB_TYPE_OBJECT':'oracledb.Object', 'DB_TYPE_RAW':'bytes', 'DB_TYPE_ROWID':'str', 'DB_TYPE_TIMESTAMP':'datetime.datetime', 'DB_TYPE_TIMESTAMP_LTZ':'datetime.datetime 2', 'DB_TYPE_TIMESTAMP_TZ':'datetime.datetime 2', 'DB_TYPE_ROWID':'str', 'DB_TYPE_VARCHAR':'str', },

cjbj commented 6 months ago

but they also won't return correct data!

To reiterate: don't use 1.0.3 because you can lose data.

Try setting the environment variable ORA_SDTZ to a numeric offset before you run python. Support for this was added in python-oracledb 1.4.

avijit09 commented 6 months ago

Not sure where I can set this environment variable to a numeric offset!

Could you pls advise?

cjbj commented 6 months ago

Here is one resource https://oracle-base.com/articles/misc/setting-database-time-zones-in-oracle#ora_sdtz

avijit09 commented 6 months ago

thanks. should I add these into system variables or user variables? I am using 64 bit windows machine

set ORA_SDTZ='Europe/London' set ORA_SDTZ='-05:00' set ORA_SDTZ='OS_TZ' set ORA_SDTZ='DB_TZ'

cjbj commented 6 months ago

I am not a Windows user. It might depend how your app runs.

You would only execute one of those calls: the one with numeric value. Use the value you desire for your location or purposes.

avijit09 commented 6 months ago

ok. should it be ORA_SDTZ='+11:00' or

ORA_SDTZ=+11:00

avijit09 commented 6 months ago

Unfortunately it didnt resolve my issue. still experiencing the same issue

cjbj commented 6 months ago

Since we don't know your code, or the actual error, there's not anything else for us to suggest.

Of course, if you want to share useful details, then we can certainly help.

cjbj commented 6 months ago

Closing - no update

Chinmaya910 commented 2 months ago

hi i am also getting the same error when trying to build a docker image

Dockerfile

FROM python:3.11.0-alpine

RUN apk update RUN apk add glib-dev librdkafka-dev gcc RUN apk update && apk add --update --no-cache python3 py3-pip && \ ln -sf python3 /usr/bin/python #--no-install-recommends ENV PY_VERSION 3.11

RUN apk add librdkafka-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community

copy requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt

Ran the following command docker build -t kafkacheck .

error:

Failed to build oracledb 28.69 ERROR: Could not build wheels for oracledb, which is required to install pyproject.toml-based projects

requirements.txt