You are not logged in.

#1 2017-01-05 10:43:55

Sensibility
Member
Registered: 2017-01-05
Posts: 4

[SOLVED] Weird issue with Python and Python2 installed

I run across a weird issue with python and python2 installed via pacman.

python2 works fine but python (or python3) ignores all commandline arguments except for filenames and opens the python2.7 shell.
Trying to execute a script using ./somescript.py just prints:

/: can't find '__main__' module in '.'

I tried reinstalling both packages and I also tried removing them using pacman -Rdd and installing only one of them.
When I only have python (python3) installed it opens the correct shell and accepts commandline arguments but prints:

ERROR: ld.so: object '/usr/lib64/libpython2.7.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

running ldd /usr/bin/python3 gives me the following output:

$ ldd /usr/bin/python3
        linux-vdso.so.1 (0x00007fff7f584000)
        /usr/lib64/libpython2.7.so (0x00007fcf3c0fc000)
        libpython3.5m.so.1.0 => /usr/lib/libpython3.5m.so.1.0 (0x00007fcf3bc2e000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fcf3ba11000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fcf3b673000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fcf3b46f000)
        libutil.so.1 => /usr/lib/libutil.so.1 (0x00007fcf3b26c000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fcf3af68000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fcf3c4e6000)

Any help is appreciated.

Last edited by Sensibility (2017-01-05 11:12:41)

Offline

#2 2017-01-05 10:50:15

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] Weird issue with Python and Python2 installed

What's the output of

$ type python
$ type python3
$ which python
$ which python3

Offline

#3 2017-01-05 10:54:50

Sensibility
Member
Registered: 2017-01-05
Posts: 4

Re: [SOLVED] Weird issue with Python and Python2 installed

$ type python
python is hashed (/usr/bin/python)
$ type python3
python3 is hashed (/usr/bin/python3)
$ which python
/usr/bin/python
$ which python3
/usr/bin/python3

It might also be worth mentioning that calling /usr/bin/python3.5 directly gives me the same result as described above

Last edited by Sensibility (2017-01-05 10:56:28)

Offline

#4 2017-01-05 11:01:54

loqs
Member
Registered: 2014-03-06
Posts: 19,183

Re: [SOLVED] Weird issue with Python and Python2 installed

What is the output of

$ printenv LD_PRELOAD

Offline

#5 2017-01-05 11:04:11

Sensibility
Member
Registered: 2017-01-05
Posts: 4

Re: [SOLVED] Weird issue with Python and Python2 installed

Only

/usr/lib64/libpython2.7.so

Offline

#6 2017-01-05 11:05:58

loqs
Member
Registered: 2014-03-06
Posts: 19,183

Re: [SOLVED] Weird issue with Python and Python2 installed

If you unset LD_PRELOAD then run the commands again is the result the same?

Offline

#7 2017-01-05 11:11:52

Sensibility
Member
Registered: 2017-01-05
Posts: 4

Re: [SOLVED] Weird issue with Python and Python2 installed

Seems like that was enough to fix it. I'll keep that in mind if I come across a similar issue. Thanks for your help.

Offline

Board footer

Powered by FluxBB