How to Fix PyCharm Import Error and Setup Your Interpreter

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น • 754

  • @TechWithTim
    @TechWithTim  5 ปีที่แล้ว +154

    I can't count the amount of times I get asked how to fix this, so i decided to make a video about it! To clarify once again, there are a ton of reasons why this may not work for you. This video simply contains the most common fixes. PLEASE have mercy on me in the comments :0

    • @xenelixer9841
      @xenelixer9841 5 ปีที่แล้ว +3

      can't find '__main__' module it keeps showing this error I don't know what to do...
      I've been at this for a whole day yesterday and just gave up so is their any way to fix this?

    • @ericosariemen5655
      @ericosariemen5655 4 ปีที่แล้ว

      Please can you do the same video for python Django and Pygame . Thank You

    • @baburajp8342
      @baburajp8342 4 ปีที่แล้ว

      .

    • @dhruvshah4645
      @dhruvshah4645 4 ปีที่แล้ว

      Trying import discord py not working

    • @gautamgirotra3572
      @gautamgirotra3572 4 ปีที่แล้ว +1

      I installed dlib using conda. It shows successfully installed. But when I try to add it to pycharm the package does not show up in the list. I'm stuck. Please help

  • @Gamingbeluga34
    @Gamingbeluga34 ปีที่แล้ว +5

    I've been trying to solve this problem for two days. And then I found 3-year old video. You're the only person that helped. Thanks man. Appriciate your work.

  • @d3v4nsh80
    @d3v4nsh80 3 ปีที่แล้ว +15

    I seriously have no idea how to thank you, you're a life saver.

  • @FSH15
    @FSH15 ปีที่แล้ว +1

    are you a god ? a prophet ?
    I've been trying to fix this problem for 7+ hours and I couldn't fix it till I watched your video
    I only needed to change the interpreter to the default one
    THANKS A LOT

  • @ckmajumdar1
    @ckmajumdar1 4 ปีที่แล้ว +1

    Dear Tim,
    I'm from India, very new to coding. Your video has helped me ID the issue & fix it.
    Thanks Brother, you are very good at it.
    CK

  • @MaenMarashdeh
    @MaenMarashdeh 5 ปีที่แล้ว +3

    For anyone still trying to install Pygame and this still hasn't worked go to file, settings, project interpretor, click on pip, scroll down till you find Pygame, click install
    This video may not have showed me this but it did help me find it thank you

    • @sunstar8893
      @sunstar8893 5 ปีที่แล้ว

      this worked for me after trying to get pygame to work for multiple hours. Thank you!

  • @aliffnabil5542
    @aliffnabil5542 4 ปีที่แล้ว +84

    BRO YOU JUST SOLVED MY PROBLEM WHICH I STRUGGLED FOR THE PAST DAYS MAN. I WAS ABOUT TO QUIT PROGRAMMING SIOT AHAHAHAHAHAHHAHAHAHAHHAAH

    • @nentryx.9522
      @nentryx.9522 4 ปีที่แล้ว +3

      Same dude xdd

    • @mastershooter64
      @mastershooter64 4 ปีที่แล้ว +5

      were you about to quit PROGRAMMING just because a specific thing in one IDE wasn't working?

    • @yashrajchouhan700
      @yashrajchouhan700 3 ปีที่แล้ว +2

      @@mastershooter64 bro but when we make a game and it consume such long time and energy and we found that we cant run a programe then it hurts the most :( but we have to never loose a hope and keep working ;)

    • @yashrajchouhan700
      @yashrajchouhan700 3 ปีที่แล้ว +2

      atleast I learned it from naruto XD

  • @sanket10
    @sanket10 4 ปีที่แล้ว

    Dude.. 5 Hours of searching on millions of sites and the you happened
    I LOVE YOU!!!!!!!!!!!!!!!!
    Thank you

  • @nishkalalgupta7366
    @nishkalalgupta7366 3 ปีที่แล้ว +1

    Thank You So Much!!! The only useful video on TH-cam is this..... I was stuck on this for hours until I found this video. Thanks A Lot

  • @aaronmay-zhang2483
    @aaronmay-zhang2483 3 ปีที่แล้ว

    THANK YOU- your final tip of closing out of pycharm and restarting it fixed it....unbelievable...

  • @siddhantsahu8039
    @siddhantsahu8039 4 ปีที่แล้ว +6

    It was really helpful man. You saved a lot of time I nearly spent 2 hrs trying to find what was wrong. Thanks for the help.

  • @jtdellasega
    @jtdellasega ปีที่แล้ว

    GREAT JOB! I called my computer programmer cousin for help and he couldn't explain, but you did PERFECT! Thanks!

  • @christiandeubel3739
    @christiandeubel3739 3 ปีที่แล้ว

    DUDE CRAZY, I was just following one of your longer tutorials on flask and had this problem and in the last minute of this video you show how to fix this stupid 'unresolved' thing. THANK YOU

  • @zhehengfan3134
    @zhehengfan3134 2 ปีที่แล้ว

    Thank you so much. I spend two hour and could not find the problem until I see this video.

  • @manukrishnan9533
    @manukrishnan9533 3 ปีที่แล้ว

    this was my error project interpreter.. and it solved now.. i was searching for a solution of this error for 2 weeks. it helped me a lot... thank you so much..!!!!

  • @Jomjom1114
    @Jomjom1114 2 ปีที่แล้ว

    I dunno if you are going to read this comment, but THANK YOU SO MUCH!! you don't know how much you have helped me..I had this problem for two days and I watched 100 videos but I couldn't find the answer except in your video..really thank you so so much

  • @richaa832
    @richaa832 4 หลายเดือนก่อน

    I was searching and trying from 3 days Numpyerror issue...and your vidro solved it....thanks a lot....its very helpful ...and explained so well👏👏👏👏👏

  • @temirlanU
    @temirlanU 5 ปีที่แล้ว +6

    Man. you advice with anaconda was really helpful. Thanks from Russia!

  • @siraqFN
    @siraqFN 2 ปีที่แล้ว

    Wasn't any of theas but watching this video flipped a switch and I figured it out. Thank you 🔥🔥

  • @abanur3163
    @abanur3163 4 ปีที่แล้ว +2

    it took for me 3 days to solve this i watched more than 20 video tutorials to solve this problem but at last video (your video) is made my day bro thanks a lot maan!!

  • @haroonrasheed8212
    @haroonrasheed8212 11 หลายเดือนก่อน

    Thank you so much, I've had this issue for a while and was on the verge of giving up as I couldn't work on my projects. This video helped me fix the issue.

  • @blitzdbs
    @blitzdbs 3 ปีที่แล้ว +3

    Thank you so much!!! Two years later this still helps me. I had to switch my interpreter version, you were right. You're awesome and keep up the great work Tim!!!

  • @raindown4965
    @raindown4965 4 ปีที่แล้ว

    Thank you THANK YOU so much! I’ve spent hours to solve this problem, nothing worked. This video literally saved my life. I can’t thank you enough. I also appreciate immensely your slow pace and patience. You’ve gained a new subscriber!

  • @RealSupaHotFireVEVO
    @RealSupaHotFireVEVO 4 ปีที่แล้ว

    The Anaconda one worked flawlessly. As long as I use that one environment it will work on whatever project I have set up. Really save me here, Tim. Thank you.

  • @fitbee8709
    @fitbee8709 ปีที่แล้ว

    I have spent so many times and tried to solve this problem, this is a legend video.

  • @charleswalters5869
    @charleswalters5869 ปีที่แล้ว

    Thanks for the video! Still works even 3 years after you made the video.

  • @nikhilp6462
    @nikhilp6462 3 ปีที่แล้ว

    Thank you buddy, I finally resolved my issue. I watched many videos but couldnt find the sol. Now, I learned some extra info as well.

  • @gracechan3039
    @gracechan3039 5 ปีที่แล้ว

    I followed your video, realised pycharm couldnt find my scripts. Realised I could just reinstall the packages using pycharm instead of pip and did that. Things work now. Thank you!!!

  • @biggideal
    @biggideal 4 ปีที่แล้ว

    You.
    Are.
    The.
    Best.
    I was searching for hours non stop. THANK you.

    • @biggideal
      @biggideal 4 ปีที่แล้ว

      Just to let you know I was using Anaconda, and I did not load any virtual environments. So thank you for covering that too.

  • @desislavaandreeva4359
    @desislavaandreeva4359 5 ปีที่แล้ว +11

    This resolved my issue! Thank you, Tim! Much appreciated mate!

  • @jonasjeron1475
    @jonasjeron1475 5 ปีที่แล้ว

    Dude, TH-cam is just amazing!
    I am Brazilian and I was looking for a long time how to fix this error and TH-cam recommended me your channel and now my problem has been solved! Even though I don't understand what you said, I had my problem solved thanks to you! Thank you very much friend or Thank you very much muito obrigado!

  • @travnik8000
    @travnik8000 3 ปีที่แล้ว +1

    Man Thanks so much. I was not able to find any tutorial working in 2021 on Python3.9 but even after a year this is still relevant tutorial and you saved me so much. Thank you Man

  • @joansantos4698
    @joansantos4698 4 ปีที่แล้ว

    Spent hours just trying to solve this problem and finally this worked. Thanks a lot!

  • @bruuhgh7005
    @bruuhgh7005 4 ปีที่แล้ว +5

    bruuuuh u literally saved my life
    that's the appreciated like i've ever given to anyone

  • @spectronimo7964
    @spectronimo7964 3 ปีที่แล้ว +1

    Thought I was going to be troubleshooting for the rest of my days... lmao. Thank you so much for the fixes.

  • @nadie-qm8rq
    @nadie-qm8rq 4 ปีที่แล้ว

    OMG THANK YOU SO MUCH THIS REALLY WORKED
    I WASN'T ABLE TO USE PYCHARM FOR ANACONDA THIS WHOLE YEAR I'M GLAD I FOUND YOUR VIDEO
    So I was using an empty env inside the carpet env in anaconda3 (because I didn't have any env) instead of the anaconda env which had all the packages I needed already installed, so I did what it said in 7:43

  • @dennisng5852
    @dennisng5852 4 ปีที่แล้ว

    CTRL+ALT+S to open up the settings page.
    What a great video!

  •  5 ปีที่แล้ว +4

    another one way to solve this, first run CMD and use pip to install the package you want by typing: "pip (or pip3 if you're on Python 3) install [the package you want]", once you done, search for the "include" folder in your Python folders (for example my one is: C:\Users\FLvME\AppData\Local\Programs\Python\Python38\include) , copy the name of the file you installed, next is open Files/Settings, go to Your Project: YourProjectName, click on Project Structure, find the venv/Libs/site-packages folder (while venv is marked as your excluded folder), access it via Explorer and paste the package file you copied in there, then go back to PyCharm, apply the setting. Hope this might help.
    you can upvote this method to tell the others if they still cannot install the package in pyCharm.

    • @tmaccomeon
      @tmaccomeon 5 ปีที่แล้ว +1

      thanks. it helped me

    • @antipainK
      @antipainK 4 ปีที่แล้ว +1

      It was not in "include" folder, but in "C:\Users\\AppData\Local\Programs\Python\Python38-32\Lib\site-packages" and basically had to put it in the folder you showed (in my case it was "venv\Lib\site-packages")

    • @bibekbirsingh9433
      @bibekbirsingh9433 4 ปีที่แล้ว

      Here's what I did:
      1. typed pip3 install pygame in cmd, which told me: requirement already satisfied pygame in C:\Users\mike\AppData\Roaming\Python\Python38\site-packages
      2. I opened the site-packages folder and copied pygame
      3. go to File> settings> project: project name> project structure .
      You will see the location of the project file and a venv folder inside of it. Go to site-packages inside of it.
      C:\Users\mike\PycharmProjects\Namaste\venv\Lib\site-packages
      4. Pasted the pygame folder there and ran import pygame and it worked.

  • @polarnyne
    @polarnyne 4 ปีที่แล้ว

    I've just recently started learning programming. If it weren't for you, I'd probably had quit. Thank you for your help, Tim!

  • @Tanrichiz
    @Tanrichiz 2 ปีที่แล้ว

    Thank you, you saved my life i would never start without it.

  • @momolight2468
    @momolight2468 2 ปีที่แล้ว

    OMG!!
    I now officially declare you as The Ultimate GIGACHAD of Python!!
    Your videos are really detailed and DEEEEEEP!
    Thanks a lot you really helped me in solving the problem, which I had spent about 2 days trying to solve, even asking research assistant at my university, but unfortunately, no success.

  • @rahulvishwakarma6663
    @rahulvishwakarma6663 4 ปีที่แล้ว

    Thank You So Much Brother For Making This Video. I was Facing This Issue since 2 Days and was damn tired by searching the solution and finally you solved my Problem. Again Thank You So Much Brother 🙏

  • @patrickbaker7014
    @patrickbaker7014 4 ปีที่แล้ว +2

    Thanks for this, got 99% of the problem fixed, but in the end I just ended up uninstalling both python and pycharm, then reinstalling them

  • @sheepsushis5720
    @sheepsushis5720 5 ปีที่แล้ว +2

    I've been trying to get this to work for ages!
    those having trouble getting pygame to work with pycharm, go into cmd and do pip install pygame, and then set the pygame interpreter to the pythonw inside your python directory.

  • @sabit648
    @sabit648 4 ปีที่แล้ว

    Tim plz tell me how should I thank you......I spent around 4 hours looking for the solution. Man thank you....may success be always ur companion in life....I'm joining ur community for sure

  • @instaminox
    @instaminox 5 ปีที่แล้ว +92

    I spent literally 4 hours trying to open up 2 different projects ... its annoying

    • @heshamaljohani6850
      @heshamaljohani6850 4 ปีที่แล้ว +4

      yea me too

    • @townjava6845
      @townjava6845 4 ปีที่แล้ว +2

      It seems that I am not alone in the fight hahahahaha

  • @highschoolboiiii7936
    @highschoolboiiii7936 3 ปีที่แล้ว

    Thanks Tim i have been struggling for whole day but now the problem ressolved

  • @ridlaw12
    @ridlaw12 4 ปีที่แล้ว

    just 3 minutes into the video and I was able to fix the problem. thank you!

  • @KrazeeKrab
    @KrazeeKrab 3 ปีที่แล้ว +3

    holy fucking shit why can't all tutorials be like this
    Thank you so much

  • @Bobby-Hiromozono
    @Bobby-Hiromozono 2 ปีที่แล้ว

    You're the 🐐
    I've had sleepless nights over this
    Thanks man

  • @arroneisen8646
    @arroneisen8646 4 ปีที่แล้ว

    Thanks so much for your help. The fix just required altering the file path. What a life saver you are!!!

  • @ranbeermalhotra3308
    @ranbeermalhotra3308 4 ปีที่แล้ว +6

    Thanks a lot Tim!
    Your slow and steady explanations made me point out the mistake I was making
    Actually I am not good in the concept of VirtualEnv as I am at school level and I pointed out that all I was creating was new virtual environments so I selected the base environment this time and the pip installed modules worked like charm for me

  • @noahgranger6749
    @noahgranger6749 4 ปีที่แล้ว

    GOOD GOD IN HEAVEN UP ABOVE!
    thank you, sir! I've been trying to install PyAudio for 3 days to use in your voice assistant program.
    this video finally gave me the answer!

  • @sanjeevKumar-eg6hp
    @sanjeevKumar-eg6hp 2 ปีที่แล้ว

    Thanks a lot tim. There many videos out there but yours made the perfect sense, thanks to which i understood the issue. I cant thank you enough for it .It nearly took me 4 hours to try to find a mistake. Thanks for making this video

  • @MelodicallyManya
    @MelodicallyManya 4 ปีที่แล้ว +1

    Omg I'm soooo thankful for this video, thanks soooo much Tim!! I had been searching all over the bet but then I finally stumbled across your video and it solved my problem!! Thanks sooooo muchhhh!! 🖤✨

  • @ChungNguyen-sv4el
    @ChungNguyen-sv4el 2 ปีที่แล้ว

    Thanks for the guide here. I was spending like 2 hours install / uninstall python / pycharm and pip all kind of things but it doesnt' work till i follow your video. Thumb up !

  • @captaineliasjinko5108
    @captaineliasjinko5108 3 ปีที่แล้ว

    Wow, You excellently great. Keep up the good. This video saved me from three days of headache. Thank You

  • @ahaahhha224
    @ahaahhha224 2 หลายเดือนก่อน

    omg! thank you so much i have trying to fix this for like two hours and now it works

  • @code_nest
    @code_nest 4 ปีที่แล้ว

    Omg, thank you so much for the solution dude. I've been stuck with IDLE to create games with pygame because for some reason, pygame doesn't work on my pycharm. But now, it does. Keep up the good work man.

  • @DylanSwarts
    @DylanSwarts 4 ปีที่แล้ว

    idk what happened, but I kinda used the video, and also just did some things, and now it works lmao. Thanks for te video! Would never have got it working without it.

  • @scienceandengineering9673
    @scienceandengineering9673 5 ปีที่แล้ว +1

    Thankyou. I had tried to fix this problem spending hours but could not. Finally, this video helped me fix that.

  • @jonbranch6553
    @jonbranch6553 ปีที่แล้ว

    Thanks so much this video is still relevant in 2023!

  • @mallikarjunrterdal
    @mallikarjunrterdal 4 ปีที่แล้ว

    Resolved my issue even before watching the complete video. Thanks a lot

  • @portal007games6
    @portal007games6 4 ปีที่แล้ว

    thanks for showing how to fix these errors, i uninstalled pycharm because pygame didnt show up there even though i installed it so then i started coding in sublime but wanted a new ide but couldnt find one that good like pycharm. and i saw this video, and finally after wasting several days of researching the best python ide works with pygame

  • @АружанАккозиева
    @АружанАккозиева 4 ปีที่แล้ว

    just Thank YOU SO MUCH!! I couldn't find information that would work and fix it for 3 hours. thank you

  • @janczabowski6500
    @janczabowski6500 4 ปีที่แล้ว +4

    Brooo thank you for his video after 2 hours watching diffrent tutorials I realized that I have wrong interpreter 🤣

  • @xindizheng7664
    @xindizheng7664 4 ปีที่แล้ว +2

    Thank you so much for this thorough tutorial. I end up fixing my python interpreter and it is working now.

  • @lincolnreid1649
    @lincolnreid1649 ปีที่แล้ว

    Thank you so much! You've saved me a lot of trouble, it was really aggravating to solve this

  • @pat-coder1396
    @pat-coder1396 5 ปีที่แล้ว

    You are a master u just solved my 32 problems in one video ur the best

  • @benfritz8099
    @benfritz8099 4 ปีที่แล้ว

    Worked well for me. This only worked when I downloaded 3.7.0. It was your last topic that did the job. Thanks !

  • @JRizzlePaschJohnathan
    @JRizzlePaschJohnathan 5 ปีที่แล้ว

    I don't comment on vids, but you are truly helpful. Thanks for your great explanations.

  • @TorgnyLandin
    @TorgnyLandin 3 ปีที่แล้ว

    Thank you.
    This video still helps people, just so you know.

  • @topoftech6459
    @topoftech6459 4 ปีที่แล้ว

    Thank you so much! I hope you know how frustrating it can be if your modules you installed simply don't work. Thank you again!

  • @santhoshs291
    @santhoshs291 2 ปีที่แล้ว

    Bro the issue got solved within 2 min of this video, really really thanks for this ....idk what to say, it took 1 day to do this...🤗🤗🤗

  • @gyanarihant7113
    @gyanarihant7113 2 ปีที่แล้ว

    Damn dude! you helped! I had to change my interpreter and I had installed multiple versions of python.
    I had to make sure the settings were back to default settings on pycharm and I choose the right interpreter and just like that the problem was no more.

  • @thelonesculler
    @thelonesculler 4 ปีที่แล้ว

    Yay it worked. As a complete Python novice this was very helpful

  • @abubakkersiddiqh3868
    @abubakkersiddiqh3868 4 ปีที่แล้ว

    Thank you so much! you're video was pinpoint and now my module is working !!

  • @wyvern8272
    @wyvern8272 4 ปีที่แล้ว

    WOW it actually worked ... it take me two days to fix it Thank you man perfect content really helpful 👍

  • @28princi
    @28princi 4 ปีที่แล้ว

    Wow! I've been struggling with something else altogether and after watching your video and fixing this basic has actually resolved my problem. Thanks a tonne.

  • @ConSys2023
    @ConSys2023 4 ปีที่แล้ว

    This video solved my problem...you are a blessing!!!

  • @tracksmyman
    @tracksmyman 2 ปีที่แล้ว

    Thank you!! I was having trouble installing a module called "clipboard" but I realised I had 2 versions of python!

  • @Liquidhun
    @Liquidhun 4 ปีที่แล้ว

    Thanky Tim. This method solved Win10 + PyAudio install and import errors. Great explanation.

  • @mohanachuthvarma6478
    @mohanachuthvarma6478 5 ปีที่แล้ว

    After 3hours of search i found the best video

  • @yccheng3864
    @yccheng3864 4 ปีที่แล้ว

    Thanks I got my code running now (pended for a week because of this)! Cheers!

  • @dotunderin9033
    @dotunderin9033 หลายเดือนก่อน

    Thanks man, this helped, had to switch to vscode because of this but now it works and i'm back on pycharm..best python ide

  • @medoabdin480
    @medoabdin480 4 ปีที่แล้ว

    even though this video doesn't work with me but I think that is half of the solution for me to makes me don't return again to show what happens and makes me think if the path of python has some errors.
    I wish if you have more tutorials about this real issue because it's really annoying.
    thank you, Tim.

  • @mountassirfares3888
    @mountassirfares3888 2 หลายเดือนก่อน

    Thank you so much, I spent almost two days to add a former version of python in vain and I quit, for I coudn't install any module into it, thanks once again.

  • @thesilverpen
    @thesilverpen 7 หลายเดือนก่อน

    finally, someone who knows what my problem is, and how to fix it. I wish I could pin a blue ribbon here. Thanks a lot for the help!!!

  • @amlanroy5274
    @amlanroy5274 5 ปีที่แล้ว

    Thanks bro. I've been searching for the problem since yesterday and you finally solved the problem. Great video. Serves it's purpose.👍

  • @irfanyaqub9643
    @irfanyaqub9643 4 ปีที่แล้ว

    you saved my time bro .. thank you very much ... God bless you . please keep it up .

  • @elpjotre2009
    @elpjotre2009 3 ปีที่แล้ว

    Thank you Tim, got my Pycharm running on Linux Mint. Brought me on the right Path and helped a lot.

  • @yashnavlakha9843
    @yashnavlakha9843 3 ปีที่แล้ว

    You are a savior and I cannot thank you enough!

  • @prabhjeetsingh1205
    @prabhjeetsingh1205 2 ปีที่แล้ว

    thankyou brother ....love from INDIA ♥️

  • @kaoukabhouda
    @kaoukabhouda 4 ปีที่แล้ว

    This is literally one of the life-saving videos :) :) thanks bro

  • @Huvaido
    @Huvaido 4 ปีที่แล้ว

    Good. It did not work for me, but it gave a hint on how to solve my problem. Basically, I couldn't import PIL from Pillow. Windows prompt kept reporting that Pillow is installed, and my pip is the latest version, by PyCharm did not see PIL anyway. What I did is I set my configuration as you showed in your video and used PyCharm terminal to force the reinstallation of the pip using this command python -m pip install -U --force-reinstall pip. It solved my problem.
    I am new to Python (2 months) and could be wrong, but I previously had issues when I wanted to pip install anything through PyCharm terminal and used instead windows prompt and had no problem, but this time I run into the problem that it did not see the PIL and the above mentioned approached helped me. So, take away for me or a lesson is that we should have our configuration set up as you showed in your video. Thanx.

  • @handlol
    @handlol 4 ปีที่แล้ว

    you are a legend man, i have been looking for a fix the whole day!!

  • @imranshirzad8658
    @imranshirzad8658 3 ปีที่แล้ว

    Thanks for the video
    i was really struggling with this, finally found the help.

  • @AJ-yc7hu
    @AJ-yc7hu 4 ปีที่แล้ว

    you saved me. I almost quit. Thank you so much

  • @malteplath
    @malteplath 4 ปีที่แล้ว +1

    There is another thing that can trip you up. If you get import errors with your own modules (in the same project), especially when you get them when you run your app from PyCharm but not when you run it from the terminal or vice versa, you probably need to set the correct root directory for your application in PyCharm. You can do this from the context menu in the project pane.

  • @demi9672
    @demi9672 4 ปีที่แล้ว

    Thanks! Uninstalled my python 3.7, switched my interpreter from 3.7 to 3.8 in pyCharm and suddenly my import cx_Oracle works. Woo!