LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora > Fedora - Installation
User Name
Password
Fedora - Installation This forum is for the discussion of installation issues with Fedora.

Notices


Reply
  Search this Thread
Old 11-10-2019, 07:13 AM   #1
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Rep: Reputation: Disabled
Angry dnf configuration error?


Hi,

I successfully installed Fedora 31 on my laptop. After few days of using, I did something wrong with pip:

pip list | awk '{ printf("pip install %s --upgrade --ignore-installed\n", $1);}' | bash

After that I run 'dnf' and got this error:

===
/usr/local/lib/python3.7/site-packages/rpm.py:15: UserWarning: The RPM Python bindings are not currently available via PyPI.

Please install them with your distro package manager (typically called
'python2-rpm' or 'python3-rpm'), and ensure that any virtual environments
needing the API are configured to be able to see the system site packages
directory.

warnings.warn(warning_msg)
Traceback (most recent call last):
File "/usr/bin/dnf", line 57, in <module>
from dnf.cli import main
File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 30, in <module>
import dnf.base
File "/usr/lib/python3.7/site-packages/dnf/base.py", line 90, in <module>
class Base(object):
File "/usr/lib/python3.7/site-packages/dnf/base.py", line 501, in Base
_TS_FLAGS_TO_RPM = {'noscripts': rpm.RPMTRANS_FLAG_NOSCRIPTS,
AttributeError: module 'rpm' has no attribute 'RPMTRANS_FLAG_NOSCRIPTS'
===

Now dnf stopped working. Please help me to fix this error. Thanks a lot!!
 
Old 11-10-2019, 07:34 AM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by nhchauvnu View Post
Hi,

I successfully installed Fedora 31 on my laptop. After few days of using, I did something wrong with pip:

pip list | awk '{ printf("pip install %s --upgrade --ignore-installed\n", $1);}' | bash

After that I run 'dnf' and got this error:

===
/usr/local/lib/python3.7/site-packages/rpm.py:15: UserWarning: The RPM Python bindings are not currently available via PyPI.

Please install them with your distro package manager (typically called
'python2-rpm' or 'python3-rpm'), and ensure that any virtual environments
needing the API are configured to be able to see the system site packages
directory.

warnings.warn(warning_msg)
Traceback (most recent call last):
File "/usr/bin/dnf", line 57, in <module>
from dnf.cli import main
File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 30, in <module>
import dnf.base
File "/usr/lib/python3.7/site-packages/dnf/base.py", line 90, in <module>
class Base(object):
File "/usr/lib/python3.7/site-packages/dnf/base.py", line 501, in Base
_TS_FLAGS_TO_RPM = {'noscripts': rpm.RPMTRANS_FLAG_NOSCRIPTS,
AttributeError: module 'rpm' has no attribute 'RPMTRANS_FLAG_NOSCRIPTS'
===

Now dnf stopped working. Please help me to fix this error. Thanks a lot!!
It's clearly a problem with dnf's Python 3 scripts.

You could try manually downloading the python3-rpm package, then using the rpm command to install it. You'll have to open this link in your browser, go to one of the mirror's and hunt down the package called "python3-rpm" that matches your machine's architecture.
 
1 members found this post helpful.
Old 11-10-2019, 07:43 AM   #3
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
It's clearly a problem with dnf's Python 3 scripts.

You could try manually downloading the python3-rpm package, then using the rpm command to install it. You'll have to open this link in your browser, go to one of the mirror's and hunt down the package called "python3-rpm" that matches your machine's architecture.
Thank you, I downloaded python3-rpm and reinstall it. However dnf still report the same errors.

rpm --reinstall -vh python3-rpm-4.15.0-6.fc31.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1: python3-rpm-4.15.0-6.fc31 ################################# [ 50%]
Cleaning up / removing...
2: python3-rpm-4.15.0-6.fc31 ################################# [100%]


Any more action to take?

Last edited by nhchauvnu; 11-10-2019 at 07:46 AM. Reason: smiling characters appear in code/output
 
Old 11-10-2019, 07:47 AM   #4
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
You could also try reinstalling dnf itself and/or python 3 from the package(s) in the same Fedora online repo too. To be clear: these problems only started to happen when you ran the pip install command, correct?

PS: You should use CODE tags when posting command output.
 
1 members found this post helpful.
Old 11-10-2019, 07:55 AM   #5
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
You could also try reinstalling dnf itself and/or python 3 from the package(s) in the same Fedora online repo too. To be clear: these problems only started to happen when you ran the pip install command, correct?

PS: You should use CODE tags when posting command output.
Yes, the problems only started after I run pip install. I installed all packages you recommend:
Code:
rpm --reinstall -vh dnf-4.2.9-5.fc31.noarch.rpm python3-3.7.5-1.fc31.x86_64.rpm python3-dnf-4.2.9-5.fc31.noarch.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:python3-3.7.5-1.fc31             ################################# [ 17%]
   2:python3-dnf-4.2.9-5.fc31         ################################# [ 33%]
   3:dnf-4.2.9-5.fc31                 ################################# [ 50%]
Cleaning up / removing...
   4:dnf-4.2.9-5.fc31                 ################################# [ 67%]
   5:python3-dnf-4.2.9-5.fc31         ################################# [ 83%]
   6:python3-3.7.5-1.fc31             ################################# [100%]
but the errors remain. Perhaps something is wrong in Python configuration as it said "/usr/local/lib/python3.7/site-packages/rpm.py:15: UserWarning: The RPM Python bindings are not currently available via PyPI." I actually removed the PyPI.
 
Old 11-10-2019, 08:04 AM   #6
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
No, it appears to be a problem with the python scripts - I suspect whatever you installed with pip has overwritten the scripts dnf is complaining about.

In any case, try doing the same for the python3-dnf package - as upon checking that's what contains the /usr/lib/python3.7/site-packages/dnf/base.py file.
 
1 members found this post helpful.
Old 11-10-2019, 08:06 AM   #7
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Angry

Quote:
Originally Posted by jsbjsb001 View Post
No, it appears to be a problem with the python scripts - I suspect whatever you installed with pip has overwritten the scripts dnf is complaining about.

In any case, try doing the same for the python3-dnf package - as upon checking that's what contains the /usr/lib/python3.7/site-packages/dnf/base.py file.
Yes, I already did that but dnf is still error
 
Old 11-10-2019, 08:20 AM   #8
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Sorry, I missed you'd already installed the python3-dnf package above. Are you sure it did actually reinstall it? I think to be sure about that, you could try forcing a complete uninstall of the python3-dnf, then installing it fresh. After you've done that, you could also try restarting the system. Although since the scripts dnf is complaining about are in that package, and given what you've said, not sure why it's still complaining anyway.

Also, are you still getting exactly the same error messages from dnf as you posted in post #1?
 
1 members found this post helpful.
Old 11-10-2019, 08:25 AM   #9
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by jsbjsb001 View Post
Sorry, I missed you'd already installed the python3-dnf package above. Are you sure it did actually reinstall it? I think to be sure about that, you could try forcing a complete uninstall of the python3-dnf, then installing it fresh. After you've done that, you could also try restarting the system. Although since the scripts dnf is complaining about are in that package, and given what you've said, not sure why it's still complaining anyway.

Also, are you still getting exactly the same error messages from dnf as you posted in post #1?
Yes I got the exactly same error:
Code:
dnf
/usr/local/lib/python3.7/site-packages/rpm.py:15: UserWarning: The RPM Python bindings are not currently available via PyPI.

Please install them with your distro package manager (typically called
'python2-rpm' or 'python3-rpm'), and ensure that any virtual environments
needing the API are configured to be able to see the system site packages
directory.

  warnings.warn(warning_msg)
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 90, in <module>
    class Base(object):
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 501, in Base
    _TS_FLAGS_TO_RPM = {'noscripts': rpm.RPMTRANS_FLAG_NOSCRIPTS,
AttributeError: module 'rpm' has no attribute 'RPMTRANS_FLAG_NOSCRIPTS'
To remove the python3-dnf, I have to remove some dependencies including anaconda-core:
Code:
rpm -e python3-dnf
error: Failed dependencies:
	python3-dnf >= 4.2.1 is needed by (installed) python3-dnf-plugins-extras-common-4.0.5-3.fc31.noarch
	python3-dnf >= 3.6.0 is needed by (installed) anaconda-core-31.22.6-2.fc31.x86_64
	python3-dnf >= 4.2.8 is needed by (installed) python3-dnf-plugins-core-4.0.9-1.fc31.noarch
	python3-dnf is needed by (installed) python3-libreport-2.10.1-2.fc31.x86_64
	python3-dnf = 4.2.9-5.fc31 is needed by (installed) dnf-4.2.9-5.fc31.noarch
It is dangerous to do that, isn't it?
 
Old 11-10-2019, 08:30 AM   #10
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Yes, don't remove the dependencies rpm is complaining about, you can try the --force option. Then install the python3-dnf package.
 
1 members found this post helpful.
Old 11-10-2019, 08:42 AM   #11
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by jsbjsb001 View Post
Yes, don't remove the dependencies rpm is complaining about, you can try the --force option. Then install the python3-dnf package.
I use --force option, but the error is still the same:
Code:
# rpm --install --force -vh dnf-4.2.9-5.fc31.noarch.rpm python3-3.7.5-1.fc31.x86_64.rpm python3-dnf-4.2.9-5.fc31.noarch.rpm python3-rpm-4.15.0-6.fc31.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:python3-3.7.5-1.fc31             ################################# [ 25%]
   2:python3-rpm-4.15.0-6.fc31        ################################# [ 50%]
   3:python3-dnf-4.2.9-5.fc31         ################################# [ 75%]
   4:dnf-4.2.9-5.fc31                 ################################# [100%]

# dnf
/usr/local/lib/python3.7/site-packages/rpm.py:15: UserWarning: The RPM Python bindings are not currently available via PyPI.

Please install them with your distro package manager (typically called
'python2-rpm' or 'python3-rpm'), and ensure that any virtual environments
needing the API are configured to be able to see the system site packages
directory.

  warnings.warn(warning_msg)
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 90, in <module>
    class Base(object):
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 501, in Base
    _TS_FLAGS_TO_RPM = {'noscripts': rpm.RPMTRANS_FLAG_NOSCRIPTS,
AttributeError: module 'rpm' has no attribute 'RPMTRANS_FLAG_NOSCRIPTS'
 
Old 11-10-2019, 08:55 AM   #12
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
I meant to force an uninstall of the python3-dnf package, then install it fresh, rather than forcing a reinstall. The point was so we know that the original scripts dnf is complaining about have for certain been reinstalled. I should have said the --nodeps option instead of the --force option, sorry about that.

So,

Code:
rpm -e --nodeps python3-dnf
then,

Code:
rpm --install python3-dnf
to reinstall the python3-dnf package.

If you still get the same errors from dnf, then try restarting your system, then see if dnf still gives the same errors. If so, then you could try repeating the above for the dnf package (and possibly the python3 package as well) as well. If that still doesn't fix dnf, then I'm not sure what else to suggest. So in that case, it might be best to backup anything important you have on the system, and just reinstall the whole system and start again. And be more careful using pip next time. Unless you can remember exactly what pip changed, and can restore it back to what it was before you ran pip.
 
1 members found this post helpful.
Old 11-12-2019, 06:49 PM   #13
nhchauvnu
LQ Newbie
 
Registered: Nov 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
I meant to force an uninstall of the python3-dnf package, then install it fresh, rather than forcing a reinstall. The point was so we know that the original scripts dnf is complaining about have for certain been reinstalled. I should have said the --nodeps option instead of the --force option, sorry about that.

So,

Code:
rpm -e --nodeps python3-dnf
then,

Code:
rpm --install python3-dnf
to reinstall the python3-dnf package.

If you still get the same errors from dnf, then try restarting your system, then see if dnf still gives the same errors. If so, then you could try repeating the above for the dnf package (and possibly the python3 package as well) as well. If that still doesn't fix dnf, then I'm not sure what else to suggest. So in that case, it might be best to backup anything important you have on the system, and just reinstall the whole system and start again. And be more careful using pip next time. Unless you can remember exactly what pip changed, and can restore it back to what it was before you ran pip.
Thank you very much for your help. I tried all possibilities but not succeeded. I reinstalled my computer. However I will install a small virtual machine and reproduce this error to see if any solution exists.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
keepcache option at repository configuration level for dnf does not work tshikose Linux - Software 0 07-21-2019 12:45 PM
[SOLVED] Fedora, updating notices and packages : dnf updateinfo & dnf check-update fanoflq Linux - Newbie 9 05-20-2017 07:07 PM
[SOLVED] Fedora 22 dnf update error messages thanquol1313 Linux - Newbie 8 10-02-2015 04:52 PM
[SOLVED] dnf remove repo, dnf command help ? mshlinux Fedora 2 10-01-2015 10:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora > Fedora - Installation

All times are GMT -5. The time now is 05:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration