Arthur Accioly Arthur Accioly - 1 year ago 92
Python Question

Does the pip option "--force-reinstall" recompiles a module? (I'm trying to reinstall cx_Oracle)

My setup has:

- oracle-instantclient (downgraded from 12 to 11)
- Virtual Environment with Python + Django + cx_Oracle

When I downgraded the oracle-instantclient, I tried to reinstall cx_oracle using:

pip install --upgrade --force-reinstall cx_Oracle

The problem is that cx_Oracle keeps complaining that I'm not using the previous installed version 12:

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot open shared object file: No such file or directory

So, some questions here: "--force-reinstall" is not supposed to make a full reinstall, including a module recompile (aka cx_Oracle)? Somebody has some suggestion about how to workaround this issue? I looked at the pip manual and just tells me that it reinstalls the package. Not very useful.


I tried to follow the solution here, adding my cx_Oracle path to the LD_LIBRARY_PATH but it's still not working.


Note that my root user has a different python while my virtualenv uses its own python installation.

[root@myserver]# which python

From my virtual environment:

(myvirtualenv) [myuser@myserver]$ which python

Is there some way of installing cx_Oracle manually using my root user but putting the files at the virtual environment somehow?


I tried to download cx_Oracle and compile manually using the following command:

sudo -u myuser ~/myvirtualenv/bin/python build install

But now I'm seeing some permission errors:

error: could not create 'build/bdist.linux-x86_64/egg': Permission denied

Am I doing the right thing? I don't want to mess this environment. Thanks.

Answer Source

The answer to your question (although you seem to have had another problem) is as follows: It depends on the module's structure. If its setup script calls the compiler, then yes it does. Because, you see, pip modules by default do not include compiled parts, it's up to the module author to provide them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download