Bug 2057340 - [abrt] python3-notebook: module(): _parser.py:42:<module>:ImportError: bad magic number in 'six': b'\x03\xf3\r\n'
Summary: [abrt] python3-notebook: module(): _parser.py:42:<module>:ImportError: bad ma...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: python-notebook
Version: 35
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:c0ad166b9a467f083456f442a3a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-23 09:00 UTC by nh
Modified: 2022-02-23 13:31 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-23 11:30:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (9.98 KB, text/plain)
2022-02-23 09:00 UTC, nh
no flags Details
File: cpuinfo (2.55 KB, text/plain)
2022-02-23 09:00 UTC, nh
no flags Details
File: environ (2.18 KB, text/plain)
2022-02-23 09:00 UTC, nh
no flags Details
File: mountinfo (3.34 KB, text/plain)
2022-02-23 09:00 UTC, nh
no flags Details
File: namespaces (172 bytes, text/plain)
2022-02-23 09:00 UTC, nh
no flags Details
File: open_fds (552 bytes, text/plain)
2022-02-23 09:00 UTC, nh
no flags Details

Description nh 2022-02-23 09:00:07 UTC
Description of problem:
Open a ipynb file with Jupyter Notebook

Version-Release number of selected component:
python3-notebook-6.4.0-3.fc35

Additional info:
reporter:       libreport-2.15.2
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-jupyter\x2dnotebook-fae1f70b10a84e6d982183da60d05eba.scope
crash_function: module
exception_type: ImportError
executable:     /usr/bin/jupyter-notebook
interpreter:    python3-3.10.2-1.fc35.x86_64
kernel:         5.16.9-200.fc35.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
#1 [/usr/lib/python3.10/site-packages/dateutil/parser/_parser.py:42] <module>
#2 [/usr/lib/python3.10/site-packages/dateutil/parser/__init__.py:2] <module>
#3 [/usr/lib/python3.10/site-packages/jupyter_client/jsonutil.py:10] <module>
#4 [/usr/lib/python3.10/site-packages/jupyter_client/session.py:41] <module>
#5 [/usr/lib/python3.10/site-packages/notebook/services/kernels/kernelmanager.py:18] <module>
#6 [/usr/lib/python3.10/site-packages/notebook/notebookapp.py:78] <module>
#7 [/usr/bin/jupyter-notebook:5] <module>

Comment 1 nh 2022-02-23 09:00:09 UTC
Created attachment 1862847 [details]
File: backtrace

Comment 2 nh 2022-02-23 09:00:10 UTC
Created attachment 1862848 [details]
File: cpuinfo

Comment 3 nh 2022-02-23 09:00:11 UTC
Created attachment 1862849 [details]
File: environ

Comment 4 nh 2022-02-23 09:00:12 UTC
Created attachment 1862850 [details]
File: mountinfo

Comment 5 nh 2022-02-23 09:00:13 UTC
Created attachment 1862851 [details]
File: namespaces

Comment 6 nh 2022-02-23 09:00:14 UTC
Created attachment 1862852 [details]
File: open_fds

Comment 7 Miro Hrončok 2022-02-23 11:07:17 UTC
Does this work?

$ python3
Python 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import six

Or does it produce the same error?


It appears that you have a faulty installation of six somewhere on your computer, e.g. ~/.local/lib/python3.9/site-packages

Comment 8 nh 2022-02-23 11:12:28 UTC
- `import six` works with `python3`
- When I launch `jupyter-notebook notebook.ipynb` from the terminal, it also happens.
- I deleted ~/.local/lib, it only contained a site-package for pip

Comment 9 Miro Hrončok 2022-02-23 11:14:25 UTC
When you launch `jupyter-notebook notebook.ipynb` what is your current working directory? Does `import six` works with `python3` from the same directory?

Comment 10 nh 2022-02-23 11:16:13 UTC
It's just a normal folder inside `~/projects/` and yes importing six works from there too. It also happens when I just run `jupyter-notebook`

Comment 11 nh 2022-02-23 11:19:15 UTC
I noticed when I try a `dnf update` it also shows 
```
Failed loading plugin "changelog": bad magic number in 'six': b'\x03\xf3\r\n'
```

It started happening after I disabled and re-enabled the `updates` repository with `dnf config-manager --set-disabled` / `dnf config-manager --set-enabled`


and the file got modified
```
.rw-r--r--@  728 root 11 Oct  2021   fedora-cisco-openh264.repo
.rw-r--r--@ 1.3k root 11 Oct  2021   fedora-modular.repo
.rw-r--r--@ 1.3k root 11 Oct  2021   fedora-updates-modular.repo
.rw-r--r--@ 1.4k root 11 Oct  2021   fedora-updates-testing-modular.repo
.rw-r--r--@ 1.3k root 11 Oct  2021   fedora-updates-testing.repo
.rw-r--r--@ 1.3k root 16 Feb 09:54   fedora-updates.repo
.rw-r--r--@ 1.2k root 11 Oct  2021   fedora.repo
```

How can I restore the original `fedora-updates.repo`?

Comment 12 Miro Hrončok 2022-02-23 11:22:12 UTC
This is mine:

$ cat /etc/yum.repos.d/fedora-updates.repo 
[updates]
name=Fedora $releasever - $basearch - Updates
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

[updates-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

[updates-source]
name=Fedora $releasever - Updates Source
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/SRPMS/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

Comment 13 Miro Hrončok 2022-02-23 11:24:33 UTC
Could you please paste the output of:

$ locate six.pyc

$ locate six.cpython-310.pyc

Comment 14 Miro Hrončok 2022-02-23 11:25:22 UTC
See e.g. https://github.com/benjaminp/six/issues/359

Comment 15 nh 2022-02-23 11:27:37 UTC
Thanks, that GitHub issue comment from `atc0005` helped as it was the same culprit.

Comment 16 Miro Hrončok 2022-02-23 11:30:26 UTC
I can reproruce this with what they say in the issue:

pathlib.Path('/usr/bin/six.pyc').write_bytes(b'\x03\xf3\r\n')

...

$ dnf info python3-six --disablerepo='*'
Failed loading plugin "changelog": bad magic number in 'six': b'\x03\xf3\r\n'




The reason you cannot reproduce in pure python3 is that /usr/bin is not on PATH that way. I wonder how to remove it for scripts installed in /usr/bin but that would be a bit problematic.

Anyway, glad that this is fixed.

Comment 18 Miro Hrončok 2022-02-23 11:38:26 UTC
> The reason you cannot reproduce in pure python3 is that /usr/bin is not on PATH that way.

I wanted to say:


The reason you cannot reproduce in pure python3 is that /usr/bin is not on sys.path that way.

Comment 19 Miro Hrončok 2022-02-23 12:36:23 UTC
I've opened https://github.com/rpm-software-management/dnf/pull/1815 to at least prevent this in dnf.

Comment 20 Miro Hrončok 2022-02-23 12:43:59 UTC
And, I've requested Python to give more information when this happens: https://bugs.python.org/issue46835

Comment 22 nh 2022-02-23 13:31:28 UTC
Thank you for your efforts


Note You need to log in before you can comment on or make changes to this bug.