1

So few days ago I realized I couldn't import a module called "nbt" that I recently installed, I didn't really bother too much about it because I didn't really have a big need of it.

So I kept going on with my main project, and managed to launch it yesterday and started working for the next update of the project. I needed a few more modules, and started doing some research, found a few and installed them. Now when I try to import the module, it says "Unable to import 'module-name'. And I got confused, installed a few more modules, and same on those too.

I checked to make sure they were being installed in the correct directory, and they are! All the modules that do work are there, the same as the ones I recently installed.

I have done some research, but I don't seem to figure out the issue! I tried adding paths, 'PYTHON_HOME'. And connected that to my 'python path' in my C drive. Still, it does not work!

Also tried re-installing python, no luck. I tried to re-install the 'Python' extension on VSC, and as you might know, did not work.

obs: I have tried to make new python files in different directories, and that didn't work either.

  • I'm not sure if you're doing this, but I would create a virtual environment for your project and install your modules that way. I personally feel like I have less issues with this. Here's a good video about virtual environments: https://www.youtube.com/watch?v=APOPm01BVrk Then when you're using the integrated terminal for pip install, just make sure it's using the virtual environment. – daniel-eh May 31 '20 at 19:39
  • 1
    I have a virtual environment for my project, its a Flask project :) –  May 31 '20 at 19:40
  • Hm, that sounds odd. For me, I always reload the window after installing modules, maybe that's the problem. Otherwise I'm not too sure. VS Code can be a little funky sometimes, I will often get unresolved import warnings but then have the code work fine when I run it. – daniel-eh May 31 '20 at 19:42
  • 1
    yeah, I cant run the code, or use the module at all. It just happened randomly probably 3-4 days ago. Just says "Unable to import 'hypixel'", though it says "pylint(import-error)", re-installed pylint/updated. Nothing. –  May 31 '20 at 19:46
  • 1
    Okay, here's a stack thread about something similar and adding the path of the library to your extra paths. There are also some other highly upvoted responses here, hopefully it can help you: https://stackoverflow.com/questions/43574995/visual-studio-code-pylint-unable-to-import-protorpc – daniel-eh May 31 '20 at 19:49
  • I was just on that thread, and saw that "SurajKj" fix works fine! haha, thanks for the help though :)' –  May 31 '20 at 19:51

0 Answers0