This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients Arfrever, Trundle, barry, brett.cannon, chba, eric.smith, eric.snow, jcea, jkloth, lemburg, loewis, meador.inge
Date 2014-03-25.17:17:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On 25.03.2014 17:47, Christian Bachmaier wrote:
> Christian Bachmaier added the comment:
>> To test what I asked for, please run freeze on this script:
>> """
>> import _psycopg2

Sorry. The above should have read "import _psycopg".

>> print ('Works.')
>> """
> $ xxx/
> $ make
> $ ./hello
> Traceback (most recent call last):
>   File "", line 3, in <module>
>     import _psycopg2
>   File "/usr/lib/python3.4/importlib/", line 2214, in _find_and_load
>     return _find_and_load_unlocked(name, import_)
>   File "/usr/lib/python3.4/importlib/", line 2201, in _find_and_load_unlocked
>     raise ImportError(_ERR_MSG.format(name), name=name)
> ImportError: No module named '_psycopg2'
> Btw the same with import psycopg2, psycopg2._psycopg, or _psycopg. Event with the subdir link as explained above. The first one (import psycopg2) is the one which operates in interpretation mode.

Ok, now we're getting closer.

Could you run this to have Python print the locations where
it looks for the shared lib:


This should print a long list of messages such as these:

import os # frozen
import errno # builtin
import posix # builtin
import posixpath # frozen

to stderr. Of those only the lines which mention _psycopg are relevant.

Please make sure that the dir where the .so file resides is
included in this list. If not, you will need to adjust PYTHONPATH

If the dir is mentioned in the listing, we have to dig deeper
using strace or similar.

Marc-Andre Lemburg
Date User Action Args
2014-03-25 17:17:22lemburgsetrecipients: + lemburg, loewis, barry, brett.cannon, jcea, eric.smith, jkloth, Arfrever, Trundle, meador.inge, eric.snow, chba
2014-03-25 17:17:22lemburglinkissue16047 messages
2014-03-25 17:17:22lemburgcreate