Skip to content

Forum in maintenance, we will back soon 🙂

Python programming
 
Notifications
Clear all

Python programming

5 Posts
4 Users
1 Reactions
176 Views
Dim2001
(@dassa)
Posts: 99
Member
Topic starter
 

Hi, I faced some errors when importing modules to Python code.  you can see the first image. but if I import it to a different file it does work.

2
1

 

 

 
Posted : 04/05/2024 5:13 am
Topic Tags
(@husein)
Posts: 532
Member Moderator
 

@dassa When you get errors concerning modules, it's probably either you still haven't installed the specific module, or you have a file with the same name as the module.

So, try installing the modules first if you haven't done so. You do that as follows (make sure to substitute module_name with its name):

pip install module_name

Keep in mind that sometimes the module name in the import is a little different than when installing it, so if it didnt work ask ChatGPT(or any AI) for the right name for installing.

 
Posted : 04/05/2024 7:36 am
Dim2001
(@dassa)
Posts: 99
Member
Topic starter
 

@husein all the modules installed. As I mention above some codes recognize modules. but some are not.

 
Posted : 04/05/2024 1:43 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@dassa 

  1. Make a project directory
  2. Change directory to your project directory
  3. Create a virtual environment
  4. pip install <required module>

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 04/05/2024 9:43 pm
Hasan Aboul Hasan
(@admin)
Posts: 1253
Member Admin
 

as @ssadvisor mentioned, try isolating the project with a virtual enviroment.

 
Posted : 04/06/2024 8:39 am
Dim2001 reacted
Share: