LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-30-2024, 03:14 PM   #1
shams
Member
 
Registered: Jan 2004
Posts: 537

Rep: Reputation: 30
python code error: ModuleNotFoundError: No module named 'mariadb'


Hi,
I successfully installed the mariadb python module to the python virtual enviroment '/home/user/venv' with the command '/home/user/venv/bin/pip install mariadb' in arch linux, and activated the venv with command '/home/user/venv/bin/activate' now when run the python code:
Code:
import mariadb
import sys
import configparser
The code cannot import the mariadb module from '/home/user/venv', and print this error:
Code:
ModuleNotFoundError: No module named 'mariadb'
 
Old 05-01-2024, 12:13 AM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,972

Rep: Reputation: 271Reputation: 271Reputation: 271
Did the install of the python module's libraries go into lib instead of lib64? I had the same error with solaar recently. I have a 64-bit system. It put its python libraries in /lib/python3.11 but python was looking for them in /usr/lib64/python3.11 https://www.linuxquestions.org/quest...ib-4175736432/
 
Old 05-01-2024, 02:18 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,967

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
I think you need to activate that venv before installing anything into it.
 
Old 05-01-2024, 07:18 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,678
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Quote:
Originally Posted by pan64 View Post
I think you need to activate that venv before installing anything into it.
I also believe this to be the case. First activate the venv, then use the pip-install command. (But first: after activating the venv, "does it work now?")
 
Old 05-01-2024, 05:18 PM   #5
shams
Member
 
Registered: Jan 2004
Posts: 537

Original Poster
Rep: Reputation: 30
Thanks for replies, it is lib64 as well there, i activated the venv first then installed the mariadb but still get the above error.
 
Old 05-02-2024, 02:04 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,967

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
Quote:
Originally Posted by shams View Post
i activated the venv first then installed the mariadb but still get the above error.
Do you know it is nonsense? This is the official way to install it. I'm pretty sure you made something differently, or you made a mistake or who knows? But saying "still get the above error" contains no usable information, we can only say it is nonsense. Or probably the error is in line 27.
Would be nice to show us the details. Exactly what did you execute, what's happened.
 
  


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
I get the ModuleNotFoundError: No module named 'virtManager' error compiling a custom libvirt-python+virt-manager stack marietto Ubuntu 4 06-03-2021 05:10 PM
[SOLVED] python3, pycharm ModuleNotFoundError: No module named 'wx' kaz2100 Linux - Software 3 05-25-2021 06:02 PM
[SOLVED] ModuleNotFoundError: No module named 'html.entities'; 'html' is not a package (python3 error) kaz2100 Linux - Software 3 05-25-2021 12:48 AM
[SOLVED] apt install broken - ConfigParser import SafeConfigParser ModuleNotFoundError: No module named 'ConfigParser' anon052 Linux - Newbie 16 08-06-2020 06:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:03 PM.

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