You are not logged in.

#1 2017-05-18 07:52:54

bmarques
Member
Registered: 2014-12-09
Posts: 30

[SOLVED] Python3 - Import error subprocess after pacman -Syu

Hi there,

I am not sure it is related to archlinux, but since it happened after an update, I will still post here:

After a post-upgrade restart of my computer, Python3 cannot import the "subprocess" module.
I get the following error message:

    Traceback (most recent call last):
      File "/usr/bin/archey3", line 17, in <module>
        import subprocess, optparse, re, sys, configparser
      File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
        import _posixsubprocess
    ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)

Though, I don't know how to debug this issue, as none of the packages I upgraded were supposed, to my knowledge, to make any changes to my Python setup, as shows my pacman.log:

[2017-05-16 10:23] [PACMAN] Running 'pacman -Syyu'
[2017-05-16 10:23] [PACMAN] synchronizing package lists
[2017-05-16 10:23] [PACMAN] starting full system upgrade
[2017-05-16 10:23] [ALPM] running '70-dkms-remove.hook'...
[2017-05-16 10:23] [ALPM] transaction started
[2017-05-16 10:23] [ALPM] upgraded iana-etc (20170426-1 -> 20170512-1)
[2017-05-16 10:23] [ALPM] upgraded attica-qt5 (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded grub (1:2.02.rc2-1 -> 2:2.02-1)
[2017-05-16 10:23] [ALPM] upgraded imlib2 (1.4.9-1 -> 1.4.10-1)
[2017-05-16 10:23] [ALPM] upgraded intel-tbb (2017_20170226-1 -> 2017_20170412-1)
[2017-05-16 10:23] [ALPM] upgraded karchive (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kcoreaddons (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kauth (5.33.0-2 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kdbusaddons (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kconfig (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kwindowsystem (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kcrash (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kglobalaccel (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kwidgetsaddons (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kcompletion (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded ki18n (5.33.0-2 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kservice (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kcodecs (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kguiaddons (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kconfigwidgets (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kitemviews (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kiconthemes (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded sonnet (5.33.0-2 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded ktextwidgets (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kxmlgui (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kbookmarks (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded solid (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kjobwidgets (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded knotifications (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kwallet (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kio (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded kinit (5.33.0-1 -> 5.34.0-1)
[2017-05-16 10:23] [ALPM] upgraded libmariadbclient (10.1.23-1 -> 10.1.23-2)
[2017-05-16 10:23] [ALPM] upgraded libreoffice-fresh (5.3.2-3 -> 5.3.3-1)
[2017-05-16 10:24] [ALPM] upgraded libreoffice-fresh-fr (5.3.2-1 -> 5.3.3-1)
[2017-05-16 10:24] [ALPM] upgraded libreoffice-fresh-sk (5.3.2-1 -> 5.3.3-1)
[2017-05-16 10:24] [ALPM] upgraded libsigsegv (2.10-2 -> 2.11-1)
[2017-05-16 10:24] [ALPM] upgraded linux (4.10.9-1 -> 4.10.13-1)
[2017-05-16 10:24] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2017-05-16 10:24] [ALPM] upgraded linux-headers (4.10.9-1 -> 4.10.13-1)
[2017-05-16 10:24] [ALPM] upgraded mariadb-clients (10.1.23-1 -> 10.1.23-2)
[2017-05-16 10:24] [ALPM] upgraded mariadb (10.1.23-1 -> 10.1.23-2)
[2017-05-16 10:24] [ALPM] upgraded oxygen-icons (1:5.33.0-1 -> 1:5.34.0-1)
[2017-05-16 10:24] [ALPM] upgraded wine (2.7-1 -> 2.8-1)
[2017-05-16 10:24] [ALPM] upgraded xfce4-terminal (0.8.4-1 -> 0.8.5.1-1)
[2017-05-16 10:24] [ALPM] transaction completed
[2017-05-16 10:24] [ALPM] running '70-dkms-install.hook'...
[2017-05-16 10:24] [ALPM] running '90-linux.hook'...
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Starting build: 4.10.13-1-ARCH
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [base]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [udev]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [autodetect]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [modconf]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [block]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [filesystems]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [keyboard]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [fsck]
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Generating module dependencies
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Image generation successful
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Starting build: 4.10.13-1-ARCH
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [base]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [udev]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [modconf]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [block]
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> WARNING: Possibly missing firmware for module: wd719x
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> WARNING: Possibly missing firmware for module: aic94xx
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [filesystems]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [keyboard]
[2017-05-16 10:24] [ALPM-SCRIPTLET]   -> Running build hook: [fsck]
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Generating module dependencies
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
[2017-05-16 10:24] [ALPM-SCRIPTLET] ==> Image generation successful
[2017-05-16 10:24] [ALPM] running 'gtk-update-icon-cache.hook'...
[2017-05-16 10:24] [ALPM] running 'systemd-sysusers.hook'...
[2017-05-16 10:24] [ALPM] running 'systemd-tmpfiles.hook'...
[2017-05-16 10:24] [ALPM] running 'systemd-update.hook'...
[2017-05-16 10:24] [ALPM] running 'texinfo-install.hook'...
[2017-05-16 10:24] [ALPM] running 'update-desktop-database.hook'...
[2017-05-16 10:24] [ALPM] running 'update-mime-database.hook'...
[2017-05-16 10:24] [ALPM-SCRIPTLET] Unknown media type in type 'all/all'
[2017-05-16 10:24] [ALPM-SCRIPTLET] Unknown media type in type 'all/allfiles'
[2017-05-17 11:13] [PACMAN] Running 'pacman -Scc firefox'
[2017-05-17 11:13] [PACMAN] Running 'pacman -Rns firefox'
[2017-05-17 11:13] [ALPM] transaction started
[2017-05-17 11:13] [ALPM] removed firefox (53.0.2-1)
[2017-05-17 11:13] [ALPM] removed mime-types (9-1)
[2017-05-17 11:13] [ALPM] transaction completed
[2017-05-17 11:13] [ALPM] running 'gtk-update-icon-cache.hook'...
[2017-05-17 11:13] [ALPM] running 'systemd-update.hook'...
[2017-05-17 11:13] [ALPM] running 'update-desktop-database.hook'...
[2017-05-17 11:13] [PACMAN] Running 'pacman -Syy firefox'
[2017-05-17 11:13] [PACMAN] synchronizing package lists
[2017-05-17 11:13] [ALPM] transaction started
[2017-05-17 11:13] [ALPM] installed mime-types (9-1)
[2017-05-17 11:14] [ALPM] installed firefox (53.0.2-1)
[2017-05-17 11:14] [ALPM] transaction completed
[2017-05-17 11:14] [ALPM] running 'gtk-update-icon-cache.hook'...
[2017-05-17 11:14] [ALPM] running 'systemd-update.hook'...
[2017-05-17 11:14] [ALPM] running 'update-desktop-database.hook'...

I don't know much about python, so I don't know how importing stuff works for it, but thats what happen when I search for _posixsubprocess on my system:

find / -name "_posixsubprocess.*" 2> /dev/null
/usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so
/usr/lib/python2.7/site-packages/_posixsubprocess.so

As you can see, there is a lib for python3, but it's not in site-packages, and it has a suffix with cpython... dunno what that is, nor how I can add it to python's default path..
Can anyone help me?

Thanks in advance smile

EDIT:
Issue solved by removing "/usr/lib/python2.7/site-packages:/usr/local/lib/python2.7/site-packages", that was appened to $PYTHONPATH in my zshrc. Probably somehow forcing python3 to search for subprocess at the wrong place.
Thanks everyone smile

Last edited by bmarques (2017-05-19 14:44:01)

Offline

#2 2017-05-18 08:35:26

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Never run pacman -Sy $package, it breaks things.


And it is your job to update AUR packages after libraries are bumped, not pacmans.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-05-18 09:00:23

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Well damn! Thanks for the reply

So upgrading a single package was my mistake, because it also upgraded python in the background without consideration to other programs using the previous version of python...
But how can I fix my noob's mistake?
My AUR packages seem up to date, so I tried downgrading python from 3.6.1.1 -> 3.5.2-3, but once downgraded a python -V still shows "Python 3.6.1"

Offline

#4 2017-05-18 14:45:39

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

bmarques wrote:

But how can I fix my noob's mistake?

Update your system.  pacman -Syu
Then, recheck your foreign packages (AUR stuff) and ensure they are still up to date.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2017-05-18 15:38:13

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Thanks ewaller,

Thing is, I did so, and I still have the issue:

$ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 archlinuxfr is up to date
:: Starting full system upgrade...
 there is nothing to do
$ yaourt -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 archlinuxfr is up to date
$ archey3
Traceback (most recent call last):
  File "/usr/bin/archey3", line 17, in <module>
    import subprocess, optparse, re, sys, configparser
  File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)

I know that yaourt is not the recommended way to maintain AUR packages...

Last edited by bmarques (2017-05-18 15:38:44)

Offline

#6 2017-05-18 15:42:30

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Running yaourt -Syu is exactly the same as running pacman -Syu - It doesn't check for updates to AUR packages.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#7 2017-05-18 15:43:55

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

wow! got it... missing the --aur...
Thanks!

Offline

#8 2017-05-18 15:54:04

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Try the following on your system and report back with the full output
What are the output of
pacman -Q python
pacman -Qo /usr/lib/python3.6/subprocess.py
ls -l /usr/lib/python3.6/subprocess.py
and
sha256sum /usr/lib/python3.6/subprocess.py

What happens if you enter the python shell from a console and try to import subprocess.py ?
When you get the error in post #1, how were you starting python?  With a python script (program)?  If so, please post the first few lines of that script.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#9 2017-05-18 16:07:48

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

$ pacman -Q python
python 3.6.1-1

$ pacman -Qo /usr/lib/python3.6/subprocess.py 
/usr/lib/python3.6/subprocess.py is owned by python 3.6.1-1

$ ls -l /usr/lib/python3.6/subprocess.py 
-rw-r--r-- 1 root root 60984 Mar 26 18:29 /usr/lib/python3.6/subprocess.py

$ sha256sum /usr/lib/python3.6/subprocess.py 
f4c8331b4cb3c19e191f7babbf6a107df2d0a9515fd0be34de611800ff76edd3  /usr/lib/python3.6/subprocess.py

$ python3.6
Python 3.6.1 (default, Mar 27 2017, 00:27:06) 
[GCC 6.3.1 20170306] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)
>>>

$ archey3
Traceback (most recent call last):
  File "/usr/bin/archey3", line 17, in <module>
    import subprocess, optparse, re, sys, configparser
  File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)

import lines of /usr/bin/archey3:

$ head -n 30 /usr/bin/archey3
#!/usr/bin/python3
#
# archey3
#
# Copyright 2010 Melik Manukyan <melik@archlinux.us>
# Copyright 2010-2012 Laurie Clark-Michalek <bluepeppers@archlinux.us>
# Distributed under the terms of the GNU General Public License v3.
# See http://www.gnu.org/licenses/gpl.txt for the full license text.
#
# Simple python script to display an Archlinux logo in ASCII art
# Along with basic system information.

__version__ = "0.5"

# Import libraries
import collections
import subprocess, optparse, re, sys, configparser
from subprocess import Popen, PIPE
from optparse import OptionParser
from getpass import getuser
from time import ctime, sleep
from os import getenv
from datetime import datetime
import re
import os.path
import multiprocessing

try:
    from logbook import Logger, lookup_level
except ImportError:
.....

From a script or from the console, I get the same result when trying to import subprocess

Offline

#10 2017-05-18 16:19:18

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Okay, let's dig deeper.

What are the output of
pacman -Qo /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so
and
ls -l /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so

Edit:  Have you rebooted lately?

Last edited by ewaller (2017-05-18 16:20:08)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2017-05-18 16:33:07

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Also from python3.6.1-1:

$ pacman -Qo /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so 
/usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so is owned by python 3.6.1-1
$ ls -l /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 1 root root 15784 Mar 26 18:29 /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so
$ sha256sum /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so 
ebc67156233f6551fc72ab955cf4b69ca1e195705fda19fd302ecc5a9178b7d6  /usr/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so

I did reboot a few times today already

Offline

#12 2017-05-18 17:04:53

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

That hash matches mine as well.  BTW, I can import subprocess.py just fine hmm
Can you import _posixsubprocess into the Python shell?  I'll bet you cannot.  I can.

Edit:  I assume this is x86_64.  As a sanity check, what is the output of uname -a

Last edited by ewaller (2017-05-18 17:06:28)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#13 2017-05-18 20:14:53

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Yeah, I get the same problem:

>>> import _posixsubprocess
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)

I am up to date with the latest kernel version:

$ uname -a
Linux gigabyte 4.10.13-1-ARCH #1 SMP PREEMPT Thu Apr 27 12:15:09 CEST 2017 x86_64 GNU/Linux

Offline

#14 2017-05-19 02:03:39

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

I am out of ideas.   Have you tried creating a new user with a clean profile and see if you can do the import?
Is PYTHONPATH set in your environmental variables?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#15 2017-05-19 07:37:10

bmarques
Member
Registered: 2014-12-09
Posts: 30

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

Hi, thanks ewaller!

I made a new user, logged in on a tty and imported subprocess successfully from command line.
So I checked the new user's $PYTHONPATH variable and noticed there wasn't anything in there.
On my account though, my .zshrc was overriding it with:

PYTHONPATH=${PYTHONPATH}:/usr/lib/python2.7/site-packages:/usr/local/lib/python2.7/site-packages

So I commented the line out to see what would happen, and now I don't have the problem anymore...
I don't really understand why adding these specific values to the empty $PYTHONPATH provoked the problem, but it's solved!
I tried adding an existing folder, and also non-existent path to PYTHONPATH just to see if it would reproduce the issue, but it didn't.

Thanks a lot for your help!

Offline

#16 2017-05-19 09:28:54

Alber
Member
From: Spain - España
Registered: 2011-11-11
Posts: 227

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

I think you and ewaller found out the answer.
PYTHONPATH is look before that standard library directories, so when using Python3 you imported subprocess from Python2 because Python first before.
As test. Look what is the difference with the next Python commands too (using a Python 2 and 3 interpreters and with your PYTHONPATH and without it):

import sys
sys.path


Edit:
As always I must be wrong. Something you've fixed.
Because in your first post clearly it is importing from pyton 3.6

Traceback (most recent call last):
      File "/usr/bin/archey3", line 17, in <module>
        import subprocess, optparse, re, sys, configparser
      File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
        import _posixsubprocess
    ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)

Last edited by Alber (2017-05-19 09:45:57)


Because not all of us are native English speakers, try no to use slang or abbreviations, thank you.

Offline

#17 2017-05-19 14:27:18

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Python3 - Import error subprocess after pacman -Syu

I think they may have been picking up _posixsubprocess from the wrong place, not subprocess itself. 
_posixsubprocess is imported by subprocess

Edit:. Also, be sure to edit your first post and change the title to prepend "[SOLVED]"

Last edited by ewaller (2017-05-19 14:29:00)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB