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>
Created attachment 1862847 [details] File: backtrace
Created attachment 1862848 [details] File: cpuinfo
Created attachment 1862849 [details] File: environ
Created attachment 1862850 [details] File: mountinfo
Created attachment 1862851 [details] File: namespaces
Created attachment 1862852 [details] File: open_fds
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
- `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
When you launch `jupyter-notebook notebook.ipynb` what is your current working directory? Does `import six` works with `python3` from the same directory?
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`
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`?
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
Could you please paste the output of: $ locate six.pyc $ locate six.cpython-310.pyc
See e.g. https://github.com/benjaminp/six/issues/359
Thanks, that GitHub issue comment from `atc0005` helped as it was the same culprit.
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.
How to prevent this kind of problem: https://discuss.python.org/t/python-flag-envvar-not-to-put-current-directory-to-sys-path-but-dont-ignore-pythonpath/4235/2
> 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.
I've opened https://github.com/rpm-software-management/dnf/pull/1815 to at least prevent this in dnf.
And, I've requested Python to give more information when this happens: https://bugs.python.org/issue46835
I've also opened https://discuss.python.org/t/should-console-scripts-entry-points-exclude-teh-scripts-directory-from-sys-path/13896 for console_scripts entry points (which dnf is not but notebook is): https://discuss.python.org/t/should-console-scripts-entry-points-exclude-the-scripts-directory-from-sys-path/13896
Thank you for your efforts