PyCharm does not recognize installed module (cx_oracle)

I am using anaconda with Python3

I installed the cx_oracle package using pip.
When I type import cx_Oracle or run the code, the python interpreter recognizes the package and runs it, but for some reason PyChram does not recognize the package and does not offer me autocomplete.

As you can see in the screenshot, the package name is cx-Oracle instead of cx_Oracle , so I looked for cx-Oracle in the anaconda folder (and subfolders) and changed it to cx_Oracle , but without success,

enter image description here

+6
source share
2 answers

This can come from different sources, the main ones are listed below:

First source: C ++ compiler

You probably don't have the Microsoft Visual C ++ compiler.

Download Microsoft Visual C ++ 2015 and install it.

Then restart Pycharm and make sure your problem is resolved.

Second source: conflicts with other packages

If you use Anaconda, you probably have the SQLAlchemy package installed, which already contains instances of sql connectors (for example, pyodbc.py, cx_oracle.py, ...). Removing SQLAlchemy from the project interpreter package listed (for PyCharm, go to File → Preferences → Project Translator) will help resolve conflicts with file names.

The following post will also help you solve your problem: Deploying cx_Oracle on Windows

Basically, the answer lists 4 different sources of the problem (including the missing C ++ compiler or the need to install the Oracle client).

+1
source

Do not rename folders! It doesn't matter that the distributed package has a dash in its name - its developers probably took care of it, and it is installed in the Python package with underscores.

In the terminal, check the freezing output. Is the package listed here?

If not, run "what python". If this is not the same as what you have in the project interpreters dialog box, this is the problem. You must first activate the correct virtual environment.

In addition, sometimes PyCharm does not update indexes. A restart or reset assistant may help.

0
source

Source: https://habr.com/ru/post/1013707/


All Articles