System: MacBook Pro M1 16GB RAM
Python 3.8.5
I am trying to install the cx_Oracle module and it doesent work.
sudo easy_install cx_Oracle --> Successful
Installed Basic and SDK client from Oracle, after following the installation script in the readme file the copying from the "Stick" completed.
Now the these copied folders are just laying around in my downloads directory, I think, I need to put both clients ([instanclient...]) into a specific directory, but don't know where.
so...
Error when I try to run the python program in the terminal: Traceback (most recent call last): File "app.py", line 5, in <module> connection = cx_Oracle.connect("hr", "hr", "10.0.0.22/orclpdb") cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): image not found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
The Error in pyCharm:
No module named 'cx_Oracle'
Also, this solution didnt work for me, because I dont have an oracle folder in /lib https://github.com/oracle/node-oracledb/issues/1244#issuecomment-624646368
Where do I need to put the folders, so that I can use the 'cx_Oracle' module in pyCharm ?
Thanks in advance
Follow the instructions found in the documentation located here: https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html.
So long as cx_Oracle is installed in the Python used by PyCharm you should be able to see it.
[PyCharm Fix below]
I fixed this issue, by using the
cx_Oracle.init_oracle_client()command as referenced in the docs.
Although I get the results, it only works in the command line. If I try to use it in pyCharm, it still doesent recognizes my cx_Oracle module. (I'll open a new ticket for this error)
This is an example code:
import cx_Oracle
cx_Oracle.init_oracle_client(lib_dir="/Users/benreisinger/Documents/testclients/instantclient_19_8", config_dir=None, error_url=None, driver_name=None)
# Connect as user "hr" with password "welcome" to the "orclpdb1" service running on this computer.
connection = cx_Oracle.connect("hr", "hr", "10.0.0.22/orclpdb")
cursor = connection.cursor()
cursor.execute("""
select e.first_name AS fname, e.last_name AS lname, e.department_id, d.department_name
from employees e
inner join departments d
on (e.department_id = d.department_id)
""")
for first_name, last_name, department_id, department_name in cursor:
print("Values:", first_name, last_name, department_id, department_name)
Results only in the terminal !
FIX: PyCharm->preferences->Project:[your Project]-> Python Interpreter-> add cx-Oracle package
--> With this fix, finally, PyCharm recognized the cx_Oracle module :)
Related
How fix this error, I use python3.6 and I use Oracle database 11g, I want to connect my python to oracle database, but shows error, how can I fix it?
This is my code:
#importing module
import cx_Oracle
#create a table in oracle database
try:
con = cx_Oracle.connect('db_employees/root#localhost')
#Now execute the sqlquery
cursor = con.cursor()
cursor.execute("insert into employees values(2171114103970002, raden, ceo, 01031997, batam, 001)")
#commit that insert the provided database
con.commit()
except cx_Oracle.DatabaseError as e:
print("There is a problem with Oracle", e)
#by writing finally if any error occurs
#then also we can close the all database operation
finally:
if cursor:
cursor.close()
if con:
con.close()
This is messages error:
C:\Python36>python "D:\testing.py"
There is a problem with Oracle DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help
Traceback (most recent call last):
File "D:\testing.py", line 20, in <module>
if cursor:
NameError: name 'cursor' is not defined
Here are the installation instructions: Installing cx_Oracle on Windows.
The error is saying you need a 32-bit Oracle client library. You can get one from 32-bit Windows Instant Client (The 64-bit libraries are here if anyone needs them) Any version up to 19c will connect to Oracle DB 11.2. Instructions are at the foot of the page. Make sure you have the correct VS redistributable installed.
Check your path to see if the client is on it, in some cases the path is not set to point the client or contain invalid characters on it and the python library can't access to it.
You can check here a similar issue https://github.com/oracle/python-cx_Oracle/issues/55
I was facing the same issue and here are the steps how I fixed this -
Download latest 64-bit version of oracle basic instantClient from:
https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
In my case I have downloaded - windows.x64-19.10.0.0.0dbru.zip
Unzip the Oracle instantClient and copy all .dll files
Copy these .dll files from Oracle instantclient directory to the python directory
I installed sp and automap libraries to my R 3.0.1 64-bit under Windows 7 (via install.packages command). Installation of them did not display any error and library(sp) works fine however when I try to execute library(automap) I get the following error:
> library(automap)
Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning messages:
1: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
cannot open compressed file 'C:/Program Files/R/R-3.0.1/library/sp/DESCRIPTION', probable reason 'No such file or directory'
2: In gzfile(file, "rb") :
cannot open compressed file '', probable reason 'Invalid argument'
I looked from the path and indeed there is no DESCRIPTION file (or folder) in that path. However there is just libs folder under which folder x64 and inside it file sp.dll
Any idea what could cause this?
I would definitely try to run R as administrator, both for installing the packages and loading them. This could solve your problem.
This probably has to do with file permissions. When you install the packages as admin in a location where only admin can read/write, running R as a normal user means you do not have the file permissions needed to load the package. Running R as admin will solve this, as admin does have the correct permissions.
Alternatively, you could install your R packages in a location where a normal user has read/write persmissions, e.g. C:/Users/UserName (or something like that, I do not have my windows machine accesible right now).
I am trying to get Django with MySQL working on my Windows 7 machine.
I need mySQLDB interface for this. When I try to install "mySQLDB interface", it looks for the MySQL installation in HKEY_LOCAL_MACHINE.
But in my registry it shows up in HKEY_CURRENT_USER/SOFTWARE/MySQL AB/MySQL Server 5.5.
My SQL instance seems to work fine.
MySQLDB installer somehow needs this in HKEY_LOCAL_MACHINE (I think) as it doesn't let me finish the install. It throws me this error.
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "C:\Blah\Software\MySQL-python-1.2.3\setup_windows.
py", line 8, in get_config
mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location')
WindowsError: [Error 2] The system cannot find the file specified
Thanks a lot for your time.
You can fix the registry key in site.cfg. Or you can download a Windows MSI package from SourceForge. (No, it did not exist when the question was posted.)
I get the error "No references to product.group_product_manager" when I try to install the module product_images_olbs.
I have an OpenERP V 6.0.2 instance running on Ubuntu 10.04. But it seems I run into a documented error. This error shows up in the client (running on windows) when I want to install some modules:
Environment Information :
System : Windows-2003Server-5.2.3790-SP2
OS Name : nt
Operating System Release : 2003Server
Operating System Version : 5.2.3790
Operating System Architecture : 32bit
Operating System Locale : de_DE.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 6.0.2
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "/usr/share/pyshared/openerp-server/netsvc.py", line 489, in dispatch
result = ExportService.getService(service_name).dispatch(method, auth, params)
File "/usr/share/pyshared/openerp-server/service/web_services.py", line 599, in dispatch
res = fn(db, uid, *params)
File "/usr/share/pyshared/openerp-server/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
(...)
File "/usr/share/pyshared/openerp-server/osv/orm.py", line 732, in _get_id
record_id = ir_model_data_obj._get_id(cr, uid, module, xml_id)
File "/usr/share/pyshared/openerp-server/tools/misc.py", line 823, in cached_result
result2 = fn(self2, cr, *args[:self.skiparg-2], **kwargs2)
File "/usr/share/pyshared/openerp-server/addons/base/ir/ir_model.py", line 602, in _get_id
raise ValueError('No references to %s.%s' % (module, xml_id))
ValueError: No references to product.group_product_manager
I was trying to install the product_images_olbs module 6.0.0.1
After some research I found 2 bugreports that seem to fit:
https://bugs.launchpad.net/magentoerpconnect/+bug/695516
https://bugs.launchpad.net/openobject-addons/+bug/695084
Edit: The solution in this case was actually that I have to use the latest version of product_images_olbs.
I thought I was using it but this was not the case, and this was caused by my wrong usage of bazaar. (I come from git but getting used to bazaar more and more ;)
And the accepted answer is correct if applied to the old version of the module.
This is the new version of \addons\product_images_olbs\security\ir.model.access.csv (from revision 5486):
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_product_images_olbs_product_images","product_images_olbs_product_images","model_product_images","base.group_sale_manager",1,1,1,1
An old version of the same file:
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_product_images_olbs_product_images","product_images_olbs_product_images","model_product_images","product.group_product_manager",1,1,1,1
The old file has references to product.group_product_manager, which is no longer correct for OpenERP 6.0.2
My memory's a bit hazy, but I think that error means that one of the XML files in the module you are trying to install has a reference to a record in the product module with id group_product_manager, but the product module doesn't contain any record with that id.
Do any of the bugs you found have patches or merge proposals? If so, do they help?
One possible solution is to look in the product module and see if that record id was changed to something similar and make the same change in the module you're installing.
Another option is to just remove the reference from the module you're installing. Depending on how it's used, that may or may not cause other problems.
Finally, you could create a record with that id for the new module to use. I think all those references get looked up in the ir_data table, so you could create a new record there.
I am doing some practice with clsql. I want to connect my oracle server hence my connection function is;
(connect '("192.168.2.3" "xe" "username" "password") :database-type :oracle)
when i hit the return, the following error message shows up.
Couldn't load foreign libraries "libclntsh", "oci". (searched *FOREIGN-LIBRARY-SEARCH-PATHS*)
[Condition of type SIMPLE-ERROR]
I have already installed oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm
and define export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib
So, what else should I do to connect the server?
I was playing with oracle lately and found out that all you need is to put path to libclntsh into /etc/ld.conf.d/oracle.conf
My setup was following( redhat,centos - as root): downloaded from oracle
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
install via rpm -ivh oracle*.rpm
Create file /etc/ld.so.conf.d/oracle.conf:
/usr/lib/oracle/12.1/client64/lib
then execute ldconfig
Now as clsql-oracle is not in quicklisp, I downloaded and extracted clsql-6.6.2, then
(require "asdf")
(push #P"/opt/jeff/clsql-6.6.2/" asdf:*central-registry*)
(asdf:load-system :clsql-oracle)
(defparameter *some-db* (connect '("127.0.0.1:1521/db1" "SOME_USER_RO" "*******") :database-type :oracle))
and voila, it works
One thing that trips me up with dynamic linking to the Oracle libs (in C/C++ that is), is the fact that the libclntsh.so shared object comes with the version after the so name. So you may need to create a soft link in the same directory, ensuring that the soft link name is just libclntsh.so